Changeset 821:158bfb360027 for src
- Timestamp:
- 09/25/16 06:42:50 (8 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r819 r821 541 541 self._flightList.addFlight(flight) 542 542 543 def _reflyFlight(self, flight): 544 """Refly the given flight.""" 545 self._addFlight(flight) 546 self._setupHelp() 547 self._updatePendingButton() 548 543 549 def _pendingClicked(self, button): 544 550 """Called when the Pending flights button is clicked.""" … … 5080 5086 self._loginPage = LoginPage(self) 5081 5087 self._pages.append(self._loginPage) 5082 self._pages.append(FlightSelectionPage(self)) 5088 self._flightSelectionPage = FlightSelectionPage(self) 5089 self._pages.append(self._flightSelectionPage) 5083 5090 self._pages.append(GateSelectionPage(self)) 5084 5091 self._pages.append(RegisterPage(self)) … … 5481 5488 self.login(callback, None, None) 5482 5489 5490 def reflyFlight(self, bookedFlight): 5491 """Add the given booked flight to the flight selection page.""" 5492 self._removePendingFlight(bookedFlight) 5493 self._flightSelectionPage._reflyFlight(bookedFlight) 5494 5483 5495 def cancelFlight(self, reloadCallback): 5484 5496 """Cancel the flight. … … 5526 5538 if page is not originator: 5527 5539 page.changeMETAR(metar) 5540 5541 def _removePendingFlight(self, flight): 5542 """Remove the given pending flight from the login result.""" 5543 for flights in [self._loginResult.reportedFlights, 5544 self._loginResult.rejectedFlights]: 5545 for f in flights: 5546 if f.id==flight.id: 5547 flights.remove(f) 5548 return 5528 5549 5529 5550 def _loginResultCallback(self, returned, result): -
src/mlx/gui/flightlist.py
r819 r821 251 251 self._reflyButton = gtk.Button(xstr("pendflt_refly_" + which)) 252 252 self._reflyButton.set_sensitive(False) 253 self._reflyButton.connect("clicked", self._reflyClicked) 253 254 buttonBox.pack_start(self._reflyButton, False, False, 2) 254 255 … … 284 285 self._deleteButton.set_sensitive(sensitive) 285 286 287 def _reflyClicked(self, button): 288 """Called when the Refly button is clicked.""" 289 gui = self._wizard.gui 290 gui.beginBusy(xstr("pendflt_refly_busy")) 291 self.set_sensitive(False) 292 293 flight = self._flights[self._flightList.selectedIndex] 294 gui.webHandler.reflyFlights(self._reflyResultCallback, [flight.id]) 295 296 def _reflyResultCallback(self, returned, result): 297 """Called when the refly result is available.""" 298 gobject.idle_add(self._handleReflyResult, returned, result) 299 300 def _handleReflyResult(self, returned, result): 301 """Handle the refly result.""" 302 303 self.set_sensitive(True) 304 gui = self._wizard.gui 305 gui.endBusy() 306 307 print "PendingFlightsFrame._handleReflyResult", returned, result 308 309 if returned: 310 index = self._flightList.selectedIndex 311 312 flight = self._flights[index] 313 314 self._flightList.removeFlight(index) 315 del self._flights[index] 316 317 self._wizard.reflyFlight(flight) 318 319 286 320 #----------------------------------------------------------------------------- 287 321 -
src/mlx/rpc.py
r820 r821 340 340 self._server.setCheckFlightPassed(sessionID, type)) 341 341 342 def reflyFlights(self, flightIDs): 343 """Mark the flights with the given IDs for reflying.""" 344 self._performCall(lambda sessionID: 345 self._server.reflyFlights(sessionID, flightIDs)) 346 342 347 def _performCall(self, callFn, acceptResults = []): 343 348 """Perform a call using the given call function. -
src/mlx/web.py
r809 r821 1242 1242 #------------------------------------------------------------------------------ 1243 1243 1244 class ReflyFlights(RPCRequest): 1245 """A request to mark certain flights for reflying.""" 1246 def __init__(self, client, callback, flightIDs): 1247 """Construct the request.""" 1248 super(ReflyFlights, self).__init__(client, callback) 1249 self._flightIDs = flightIDs 1250 1251 def run(self): 1252 """Perform the update.""" 1253 self._client.reflyFlights(self._flightIDs) 1254 return Result() 1255 1256 #------------------------------------------------------------------------------ 1257 1244 1258 class Handler(threading.Thread): 1245 1259 """The handler for the web services. … … 1323 1337 callback, aircraftType)) 1324 1338 1339 def reflyFlights(self, callback, flightIDs): 1340 """Mark the flights with the given IDs for reflying.""" 1341 self._addRequest(ReflyFlights(self._rpcClient, callback, flightIDs)) 1342 1325 1343 def run(self): 1326 1344 """Process the requests."""
Note:
See TracChangeset
for help on using the changeset viewer.