Ignore:
Timestamp:
12/21/12 15:44:59 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added the new Cruise page where the cruise level can be modified (#160)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/flight.py

    r365 r383  
    2424    It is also the hub for the other main objects participating in the handling of
    2525    the flight."""
     26    @staticmethod
     27    def canLogCruiseAltitude(stage):
     28        """Determine if the cruise altitude can be logged in the given
     29        stage."""
     30        return stage in [const.STAGE_CRUISE, const.STAGE_DESCENT,
     31                         const.STAGE_LANDING]
     32
    2633    def __init__(self, logger, gui):
    2734        """Construct the flight."""
     
    414421    def cruiseLevelChanged(self):
    415422        """Called when the cruise level hass changed."""
    416         if self._stage in [const.STAGE_CRUISE, const.STAGE_DESCENT,
    417                            const.STAGE_LANDING]:
     423        if self.canLogCruiseAltitude(self._stage):
    418424            message = "Cruise altitude modified to %d feet" % \
    419                       (self.cruiseAltitude,)
     425                      (self._gui.loggableCruiseAltitude,)
    420426            self.logger.message(self.aircraft.timestamp, message)
     427            return True
     428        else:
     429            return False
    421430
    422431    def _updateFlownDistance(self, currentState):
Note: See TracChangeset for help on using the changeset viewer.