Changeset 824:599a3e9cb025 for src
- Timestamp:
- 09/25/16 07:34:11 (8 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r823 r824 544 544 """Refly the given flight.""" 545 545 self._addFlight(flight) 546 self._updatePending() 547 548 def _updatePending(self): 549 """Update the stuff depending on the set of pending flights.""" 546 550 self._setupHelp() 547 551 self._updatePendingButton() … … 5492 5496 self._removePendingFlight(bookedFlight) 5493 5497 self._flightSelectionPage._reflyFlight(bookedFlight) 5498 5499 def deleteFlight(self, bookedFlight): 5500 """Remove the given flight from the pending flight list.""" 5501 self._removePendingFlight(bookedFlight) 5502 self._flightSelectionPage._updatePending() 5494 5503 5495 5504 def cancelFlight(self, reloadCallback): -
src/mlx/gui/flightlist.py
r823 r824 243 243 ] 244 244 245 def __init__(self, which, wizard ):245 def __init__(self, which, wizard, window): 246 246 """Construct the frame with the given title.""" 247 247 super(PendingFlightsFrame, self).__init__(xstr("pendflt_title_" + which)) … … 249 249 self._which = which 250 250 self._wizard = wizard 251 self._window = window 251 252 252 253 alignment = gtk.Alignment(xscale = 1.0, yscale = 1.0) … … 277 278 self._deleteButton = gtk.Button(xstr("pendflt_delete_" + which)) 278 279 self._deleteButton.set_sensitive(False) 280 self._deleteButton.connect("clicked", self._deleteClicked) 279 281 buttonBox.pack_start(self._deleteButton, False, False, 2) 280 282 … … 340 342 self._wizard.reflyFlight(flight) 341 343 344 def _deleteClicked(self, button): 345 """Called when the Delete button is clicked.""" 346 dialog = gtk.MessageDialog(parent = self._window, 347 type = MESSAGETYPE_QUESTION, 348 message_format = xstr("flight_delete_question")) 349 350 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO) 351 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES) 352 353 dialog.set_title(WINDOW_TITLE_BASE) 354 result = dialog.run() 355 dialog.hide() 356 357 if result==RESPONSETYPE_YES: 358 gui = self._wizard.gui 359 gui.beginBusy(xstr("pendflt_refly_busy")) 360 self.set_sensitive(False) 361 362 flightIDs = [self._flights[i].id 363 for i in self._flightList.selectedIndexes] 364 gui.webHandler.deleteFlights(self._deleteResultCallback, flightIDs) 365 366 def _deleteResultCallback(self, returned, result): 367 """Called when the deletion result is available.""" 368 gobject.idle_add(self._handleDeleteResult, returned, result) 369 370 def _handleDeleteResult(self, returned, result): 371 """Handle the delete result.""" 372 373 self.set_sensitive(True) 374 gui = self._wizard.gui 375 gui.endBusy() 376 377 print "PendingFlightsFrame._handleDeleteResult", returned, result 378 379 if returned: 380 indexes = self._flightList.selectedIndexes 381 382 flights = [self._flights[index] for index in indexes] 383 384 self._flightList.removeFlights(indexes) 385 for index in indexes[::-1]: 386 del self._flights[index] 387 388 for flight in flights: 389 self._wizard.deleteFlight(flight) 342 390 343 391 #----------------------------------------------------------------------------- … … 364 412 vbox = gtk.VBox() 365 413 366 self._reportedFrame = PendingFlightsFrame("reported", wizard )414 self._reportedFrame = PendingFlightsFrame("reported", wizard, self) 367 415 vbox.pack_start(self._reportedFrame, True, True, 2) 368 416 369 self._rejectedFrame = PendingFlightsFrame("rejected", wizard )417 self._rejectedFrame = PendingFlightsFrame("rejected", wizard, self) 370 418 vbox.pack_start(self._rejectedFrame, True, True, 2) 371 419 -
src/mlx/rpc.py
r821 r824 345 345 self._server.reflyFlights(sessionID, flightIDs)) 346 346 347 def deleteFlights(self, flightIDs): 348 """Delete the flights with the given IDs.""" 349 self._performCall(lambda sessionID: 350 self._server.deleteFlights(sessionID, flightIDs)) 351 347 352 def _performCall(self, callFn, acceptResults = []): 348 353 """Perform a call using the given call function. -
src/mlx/web.py
r821 r824 1256 1256 #------------------------------------------------------------------------------ 1257 1257 1258 class DeleteFlights(RPCRequest): 1259 """A request to delete certain flights.""" 1260 def __init__(self, client, callback, flightIDs): 1261 """Construct the request.""" 1262 super(DeleteFlights, self).__init__(client, callback) 1263 self._flightIDs = flightIDs 1264 1265 def run(self): 1266 """Perform the update.""" 1267 self._client.deleteFlights(self._flightIDs) 1268 return Result() 1269 1270 #------------------------------------------------------------------------------ 1271 1258 1272 class Handler(threading.Thread): 1259 1273 """The handler for the web services. … … 1341 1355 self._addRequest(ReflyFlights(self._rpcClient, callback, flightIDs)) 1342 1356 1357 def deleteFlights(self, callback, flightIDs): 1358 """Delete the flights with the given IDs.""" 1359 self._addRequest(DeleteFlights(self._rpcClient, callback, flightIDs)) 1360 1343 1361 def run(self): 1344 1362 """Process the requests."""
Note:
See TracChangeset
for help on using the changeset viewer.