Ignore:
Timestamp:
07/03/12 17:30:04 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added the playback of approach callouts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/config.py

    r270 r273  
    157157            index += 1
    158158
     159    def getAltitudes(self, descending = True):
     160        """Get the altitudes in decreasing order by default."""
     161        altitudes = self._mapping.keys()
     162        altitudes.sort(reverse = descending)
     163        return altitudes
     164
     165    def __nonzero__(self):
     166        """Return if there is anything in the mapping."""
     167        return not not self._mapping
     168
    159169    def __eq__(self, other):
    160170        """Determine if the approach callout mapping is equal to the given
     
    172182
    173183    def __getitem__(self, altitude):
    174         """Get the file that is associated with the highest altitude not higher
    175         than the given one.
     184        """Get the file that is associated with the given altitude.
    176185
    177186        If no such file found, return None."""
    178         candidate = None
    179         for (alt, path) in self._mapping.iteritems():
    180             if alt<=altitude:
    181                 if candidate is None or alt>candidate[0]:
    182                     candidate = (alt, path)
    183 
    184         return candidate
     187        return self._mapping[altitude] if altitude in self._mapping else None
    185188
    186189    def __iter__(self):
    187190        """Iterate over the pairs of altitudes and paths in decreasing order of
    188191        the altitude."""
    189         altitudes = self._mapping.keys()
    190         altitudes.sort(reverse = True)
     192        altitudes = self.getAltitudes()
    191193
    192194        for altitude in altitudes:
Note: See TracChangeset for help on using the changeset viewer.