Changeset 859:1e789c934953 for src/mlx/gui/gui.py
- Timestamp:
- 06/18/17 11:17:51 (7 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r858 r859 97 97 self._credentialsPassword = None 98 98 99 self._bookFlightsUserCallback = None 100 self._bookFlightsBusyCallback = None 101 99 102 self.webHandler = web.Handler(config, self._getCredentialsCallback) 100 103 self.webHandler.start() … … 557 560 self._flightInfo.enable(aircraftType) 558 561 562 def bookFlights(self, callback, flightIDs, date, tailNumber, 563 busyCallback = None): 564 """Initiate the booking of flights with the given timetable IDs and 565 other data""" 566 self._bookFlightsUserCallback = callback 567 self._bookFlightsBusyCallback = busyCallback 568 569 self.beginBusy(xstr("bookflights_busy")) 570 if busyCallback is not None: 571 busyCallback(True) 572 573 self.webHandler.bookFlights(self._bookFlightsCallback, 574 flightIDs, date, tailNumber) 575 576 def _bookFlightsCallback(self, returned, result): 577 """Called when the booking of flights has finished.""" 578 gobject.idle_add(self._handleBookFlightsResult, returned, result) 579 580 def _handleBookFlightsResult(self, returned, result): 581 """Called when the booking of flights is done. 582 583 If it was successful, the booked flights are added to the list of the 584 flight selector.""" 585 if self._bookFlightsBusyCallback is not None: 586 self._bookFlightsBusyCallback(False) 587 self.endBusy() 588 589 if returned: 590 for bookedFlight in result.bookedFlights: 591 self._wizard.addFlight(bookedFlight) 592 593 self._bookFlightsUserCallback(returned, result) 594 559 595 def cancelFlight(self): 560 596 """Cancel the current file, if the user confirms it.""" … … 853 889 gobject.idle_add(self.getFleet, callback, force) 854 890 855 def getFleet(self, callback = None, force = False ):891 def getFleet(self, callback = None, force = False, busyCallback = None): 856 892 """Get the fleet. 857 893 … … 860 896 if self._fleet is None or force: 861 897 self._fleetCallback = callback 898 self._fleetBusyCallback = busyCallback 899 if busyCallback is not None: 900 busyCallback(True) 862 901 self.beginBusy(xstr("fleet_busy")) 863 902 self.webHandler.getFleet(self._fleetResultCallback) … … 896 935 """Handle the fleet result.""" 897 936 self.endBusy() 937 if self._fleetBusyCallback is not None: 938 self._fleetBusyCallback(False) 898 939 if returned: 899 940 self._fleet = result.fleet … … 911 952 callback = self._fleetCallback 912 953 self._fleetCallback = None 954 self._fleetBusyCallback = None 913 955 if callback is not None: 914 956 callback(self._fleet)
Note:
See TracChangeset
for help on using the changeset viewer.