Ignore:
Timestamp:
12/22/12 09:05:16 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Implemented the configuration of automatic PIREP saving (re #163)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/config.py

    r373 r392  
    234234
    235235        self._pirepDirectory = None
     236        self._pirepAutoSave = False
    236237
    237238        self._enableSounds = not secondaryInstallation
     
    453454            self._pirepDirectory = None if pirepDirectory=="" \
    454455                                   else pirepDirectory
     456            if self._pirepDirectory is None:
     457                self._pirepAutoSave = False
     458            self._modified = True
     459
     460    @property
     461    def pirepAutoSave(self):
     462        """Get whether the PIREP should be saved automatically when it becomes
     463        saveable."""
     464        return self._pirepAutoSave
     465
     466    @pirepAutoSave.setter
     467    def pirepAutoSave(self, pirepAutoSave):
     468        """Set whether the PIREP should be saved automatically when it becomes
     469        saveable."""
     470        pirepAutoSave = pirepAutoSave and self._pirepDirectory is not None
     471        if pirepAutoSave!=self._pirepAutoSave:
     472            self._pirepAutoSave = pirepAutoSave
    455473            self._modified = True
    456474
     
    649667                                         "pirepDirectory", None)
    650668
     669        self._pirepAutoSave = self._get(config, "general",
     670                                        "pirepAutoSave", False)
     671        self._pirepAutoSave = self._pirepAutoSave and \
     672                              self._pirepAutoSave is not None
     673
    651674        self._messageTypeLevels = {}
    652675        for messageType in const.messageTypes:
     
    720743        if self._pirepDirectory is not None:
    721744            config.set("general", "pirepDirectory", self._pirepDirectory)
     745        config.set("general", "pirepAutoSave",
     746                   "yes" if self._pirepAutoSave else "no")
    722747
    723748        config.add_section(Config._messageTypesSection)
Note: See TracChangeset for help on using the changeset viewer.