Esempio n. 1
0
 def get(self, pref):
     if pref.key in self._data:
         return self._data[pref.key]
     elif pref.platformSpecific:
         return platformcfg.get(pref)
     else:
         return pref.default
Esempio n. 2
0
 def get(self, pref):
     if pref.key in self._data:
         return self._data[pref.key]
     elif pref.platformSpecific:
         return platformcfg.get(pref)
     else:
         return pref.default
Esempio n. 3
0
    def get_platform_default(self, descriptor):
        """Get the platform-specific default value for a preference.

        For platform-specific preferences, we can't set the default attribute
        since it will be different for each platform and also could depend on
        things like the home directory.

        Instead, use this method to get the value from the miro.plat.config
        module.
        """
        return platformcfg.get(descriptor)
Esempio n. 4
0
    def get_platform_default(self, descriptor):
        """Get the platform-specific default value for a preference.

        For platform-specific preferences, we can't set the default attribute
        since it will be different for each platform and also could depend on
        things like the home directory.

        Instead, use this method to get the value from the miro.plat.config
        module.
        """
        return platformcfg.get(descriptor)
Esempio n. 5
0
 def get(self, descriptor, use_theme_data=True):
     if descriptor.key in self._data:
         value = self._data[descriptor.key]
         if ((descriptor.possible_values is not None
              and not value in descriptor.possible_values)):
             logging.warn(
                 'bad preference value %s for key %s.  using failsafe: %s',
                 value, descriptor.key, descriptor.failsafe_value)
             return descriptor.failsafe_value
         else:
             return value
     elif descriptor.platformSpecific:
         return platformcfg.get(descriptor)
     if app.configfile.contains(descriptor.key, use_theme_data):
         return app.configfile.get(descriptor.key, use_theme_data)
     else:
         return descriptor.default
Esempio n. 6
0
 def get(self, descriptor, use_theme_data=True):
     if descriptor.key in self._data:
         value = self._data[descriptor.key]
         if ((descriptor.possible_values is not None
              and not value in descriptor.possible_values)):
             logging.warn(
                 'bad preference value %s for key %s.  using failsafe: %s',
                 value, descriptor.key, descriptor.failsafe_value)
             return descriptor.failsafe_value
         else:
             return value
     elif descriptor.platformSpecific:
         return platformcfg.get(descriptor)
     if app.configfile.contains(descriptor.key, use_theme_data):
         return app.configfile.get(descriptor.key, use_theme_data)
     else:
         return descriptor.default
Esempio n. 7
0
def fix_movies_gone():
    app.config.set(prefs.MOVIES_DIRECTORY, platformcfg.get(prefs.MOVIES_DIRECTORY))
    eventloop.add_urgent_call(finish_backend_startup, "reconnect downloaders")
Esempio n. 8
0
def fix_movies_gone():
    app.config.set(prefs.MOVIES_DIRECTORY,
                   platformcfg.get(prefs.MOVIES_DIRECTORY))
    eventloop.add_urgent_call(finish_backend_startup, "reconnect downloaders")