Example #1
0
    def __init__(self, name, schema_name, key_name, **options):
        self.schema_name = schema_name
        self.key_name = key_name
        self._extra_info = None
        if 'uid' not in options:
            options['uid'] = key_name
        try:
            self.settings = GSettingsSetting(schema_name, **options)
            Tweak.__init__(self,
                name,
                options.get("description",self.settings.schema_get_description(key_name)),
                **options)
        except GSettingsMissingError as e:
            self.settings = GSettingsFakeSetting()
            Tweak.__init__(self, "", "")
            self.loaded = False
            logging.info("GSetting missing %s", e)
        except KeyError:
            self.settings = GSettingsFakeSetting()
            Tweak.__init__(self, "", "")
            self.loaded = False
            logging.info("GSettings missing key %s (key %s)" % (schema_name, key_name))

        if options.get("logout_required") and self.loaded:
            self.settings.connect("changed::%s" % key_name, self._on_changed_notify_logout)
Example #2
0
class _GSettingsTweak(Tweak):
    def __init__(self, name, schema_name, key_name, **options):
        schema_name = adjust_schema_for_overrides(schema_name, key_name,
                                                  options)
        self.schema_name = schema_name
        self.key_name = key_name
        self._extra_info = None
        if 'uid' not in options:
            options['uid'] = key_name
        try:
            self.settings = GSettingsSetting(schema_name, **options)
            Tweak.__init__(
                self, name,
                options.get("description",
                            self.settings.schema_get_description(key_name)),
                **options)
        except GSettingsMissingError, e:
            self.settings = GSettingsFakeSetting()
            Tweak.__init__(self, "", "")
            self.loaded = False
            logging.info("GSetting missing %s" % (e.message))
        except KeyError:
            self.settings = GSettingsFakeSetting()
            Tweak.__init__(self, "", "")
            self.loaded = False
            logging.info("GSettings missing key %s (key %s)" %
                         (schema_name, key_name))
Example #3
0
 def __init__(self, schema_name, key_name, **options):
     self.schema_name = schema_name
     self.key_name = key_name
     try:
         self.settings = GSettingsSetting(schema_name, **options)
         Tweak.__init__(self,
             options.get("summary",self.settings.schema_get_summary(key_name)),
             options.get("description",self.settings.schema_get_description(key_name)),
             **options)
     except GSettingsMissingError, e:
         self.settings = GSettingsFakeSetting()
         Tweak.__init__(self,"","")
         self.loaded = False
         logging.info("Missing gsettings %s (key %s)" % (e.message, key_name))
 def __init__(self, name, schema_name, key_name, **options):
     schema_name = adjust_schema_for_overrides(schema_name, key_name, options)
     self.schema_name = schema_name
     self.key_name = key_name
     self._extra_info = None
     if 'uid' not in options:
         options['uid'] = key_name
     try:
         self.settings = GSettingsSetting(schema_name, **options)
         Tweak.__init__(self,
             name,
             options.get("description",self.settings.schema_get_description(key_name)),
             **options)
     except GSettingsMissingError, e:
         self.settings = GSettingsFakeSetting()
         Tweak.__init__(self,"","")
         self.loaded = False
         logging.info("GSetting missing %s" % (e.message))
Example #5
0
class _GSettingsTweak(Tweak):
    def __init__(self, name, schema_name, key_name, **options):
        schema_name = adjust_schema_for_overrides(schema_name, key_name,
                                                  options)
        self.schema_name = schema_name
        self.key_name = key_name
        self._extra_info = None
        if 'uid' not in options:
            options['uid'] = key_name
        try:
            self.settings = GSettingsSetting(schema_name, **options)
            Tweak.__init__(
                self, name,
                options.get("description",
                            self.settings.schema_get_description(key_name)),
                **options)
        except GSettingsMissingError as e:
            self.settings = GSettingsFakeSetting()
            Tweak.__init__(self, "", "")
            self.loaded = False
            logging.info("GSetting missing %s", e)
        except KeyError:
            self.settings = GSettingsFakeSetting()
            Tweak.__init__(self, "", "")
            self.loaded = False
            logging.info("GSettings missing key %s (key %s)" %
                         (schema_name, key_name))

        if options.get("logout_required") and self.loaded:
            self.settings.connect("changed::%s" % key_name,
                                  self._on_changed_notify_logout)

    def _on_changed_notify_logout(self, settings, key_name):
        self.notify_logout()

    @property
    def extra_info(self):
        if self._extra_info is None:
            self._extra_info = self.settings.schema_get_summary(self.key_name)
        return self._extra_info