Ignore:
Timestamp:
12/10/23 09:50:04 (5 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Support for an alternative sound set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/config.py

    r1098 r1123  
    255255        self._enableApproachCallouts = False
    256256        self._speedbrakeAtTD = True
     257        self._soundSet = 0
    257258
    258259        self._enableChecklists = False
     
    672673        if speedbrakeAtTD!=self._speedbrakeAtTD:
    673674            self._speedbrakeAtTD = speedbrakeAtTD
     675            self._modified = True
     676
     677    @property
     678    def soundSet(self):
     679        """Get the number of the  sound set to use."""
     680        return self._soundSet
     681
     682    @soundSet.setter
     683    def soundSet(self, soundSet):
     684        """Set the number of the sound set."""
     685        if soundSet!=self._soundSet:
     686            self._soundSet = soundSet
    674687            self._modified = True
    675688
     
    856869        self._speedbrakeAtTD = self._getBoolean(config, "sounds",
    857870                                                "speedbrakeAtTD", True)
     871        self._soundSet = self._getInteger(config, "sounds",
     872                                          "soundSet", 0)
    858873
    859874        self._enableChecklists = self._getBoolean(config, "sounds",
     
    963978        config.set("sounds", "speedbrakeAtTD",
    964979                   "yes" if self._speedbrakeAtTD else "no")
     980        config.set("sounds", "soundSet", str(self._soundSet))
    965981
    966982        config.set("sounds", "enableChecklists",
     
    9981014        otherwise the default."""
    9991015        return config.getboolean(section, option) \
     1016               if config.has_option(section, option) \
     1017               else default
     1018
     1019    def _getInteger(self, config, section, option, default):
     1020        """Get the given option as an integer, if found in the given config,
     1021        otherwise the default."""
     1022        return config.getint(section, option) \
    10001023               if config.has_option(section, option) \
    10011024               else default
     
    11091132        print("  enableApproachCallouts:", self._enableApproachCallouts)
    11101133        print("  speedbrakeAtTD:", self._speedbrakeAtTD)
     1134        print("  soundSet:", self._soundSet)
    11111135
    11121136        print("  enableChecklists:", self._enableChecklists)
Note: See TracChangeset for help on using the changeset viewer.