Changeset 275:155f94c971e0


Ignore:
Timestamp:
07/07/12 06:33:14 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The "Cancel flight" buttons are disabled when the flight has ended

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/flight.py

    r274 r275  
    9898
    9999        self._wizard = wizard
     100
     101        self._cancelFlightButton = None
    100102
    101103        self._completed = False
     
    126128    def addCancelFlightButton(self):
    127129        """Add the 'Cancel flight' button to the page."""
    128         return self.addButton(xstr("button_cancelFlight"),
    129                               sensitive = True,
    130                               tooltip = xstr("button_cancelFlight_tooltip"),
    131                               clicked = self._cancelFlight,
    132                               padding = 16)
     130        self._cancelFlightButton = \
     131            self.addButton(xstr("button_cancelFlight"),
     132                           sensitive = True,
     133                           tooltip = xstr("button_cancelFlight_tooltip"),
     134                           clicked = self._cancelFlight,
     135                           padding = 16)
     136        return self._cancelFlightButton
    133137
    134138    def addPreviousButton(self, sensitive = True, clicked = None):
     
    193197        self._completed = False
    194198        self._fromPage = None
     199        if self._cancelFlightButton is not None:
     200            self._cancelFlightButton.set_sensitive(True)
    195201
    196202    def goBack(self):
     
    199205       
    200206        self._wizard.setCurrentPage(self._fromPage, finalize = False)
     207
     208    def flightEnded(self):
     209        """Called when the flight has ended.
     210
     211        This default implementation disables the cancel flight button."""
     212        if self._cancelFlightButton is not None:
     213            self._cancelFlightButton.set_sensitive(False)
    201214
    202215    def _cancelFlight(self, button):
     
    21902203    def flightEnded(self):
    21912204        """Called when the flight has ended."""
     2205        super(LandingPage, self).flightEnded()
    21922206        self._flightEnded = True
    21932207        self._updateForwardButton()
     
    28542868           
    28552869        elif stage==const.STAGE_END:
    2856             self._landingPage.flightEnded()
     2870            for page in self._pages:
     2871                page.flightEnded()
    28572872
    28582873    def _initialize(self, keepLoginResult = False, loginResult = None):
Note: See TracChangeset for help on using the changeset viewer.