Пример #1
0
    def __init__(self, key=None, default=None, type=None):
        parts = key.split(".")
        self.schema_id, self.key = ".".join(parts[:-1]), parts[-1]

        self.type = type
        self.default = default
        self.schema_default = self.default or Schema.load_schema(self.schema_id, self.key)
        log.debug("Got the schema_default: %s for key: %s.%s" % (self.schema_default, self.schema_id, self.key))

        if self.schema_id in Gio.Settings.list_schemas():
            self.settings = Gio.Settings(self.schema_id)
        else:
            raise Exception('Oops, Settings schema "%s" is not installed' % self.schema_id)

        if self.key not in self.settings.list_keys():
            log.error("No key (%s) for schema %s" % (self.key, self.schema_id))

        if default and self.get_value() == None:
            self.set_value(default)
Пример #2
0
    def __init__(self, key=None, default=None, type=None):
        parts = key.split('.')
        self.schema_id, self.key = '.'.join(parts[:-1]), parts[-1]

        self.type = type
        self.default = default
        self.schema_default = self.default or Schema.load_schema(
            self.schema_id, self.key)
        log.debug("Got the schema_default: %s for key: %s.%s" % \
                  (self.schema_default, self.schema_id, self.key))

        if self.schema_id in Gio.Settings.list_schemas():
            self.settings = Gio.Settings(self.schema_id)
        else:
            raise Exception('Oops, Settings schema "%s" is not installed' %
                            self.schema_id)

        if self.key not in self.settings.list_keys():
            log.error("No key (%s) for schema %s" % (self.key, self.schema_id))

        if default and self.get_value() == None:
            self.set_value(default)
Пример #3
0
    def __init__(self, key=None, default=None, type=None):
        self._path = key.split('::')[0]
        self._type = type
        self._default = default
        self.key = key
        self._section = key.split('::')[1].split('#')[0]
        self._option = key.split('::')[1].split('#')[1]

        if self.is_override_schema(self._path):
            self._path = self.build_schema_path(self._path)
            self.key = self.build_schema_path(self.key)
            log.debug("is override schema, so update path to %s" % self._path)
            self.schema_default = default or Schema.load_schema(
                self._section, self._option)
            log.debug("schema_default is %s" % self.schema_default)

        log.debug("Build ConfigSetting for path: %s\n"
                  "\tkey: %s\n"
                  "\tdefault: %s, type: %s\n" %
                  (self._path, self.key, self._default, self._type))

        RawConfigSetting.__init__(self, self._path, type=self._type)
Пример #4
0
    def __init__(self, key=None, default=None, type=None):
        self._path = key.split('::')[0]
        self._type = type
        self._default = default
        self.key = key
        self._section = key.split('::')[1].split('#')[0]
        self._option = key.split('::')[1].split('#')[1]

        if self.is_override_schema(self._path):
            self._path = self.build_schema_path(self._path)
            self.key = self.build_schema_path(self.key)
            log.debug("is override schema, so update path to %s" % self._path)
            self.schema_default = default or Schema.load_schema(self._section, self._option)
            log.debug("schema_default is %s" % self.schema_default)

        log.debug("Build ConfigSetting for path: %s\n"
                  "\tkey: %s\n"
                  "\tdefault: %s, type: %s\n" % (self._path,
                                                 self.key,
                                                 self._default, 
                                                 self._type))

        RawConfigSetting.__init__(self, self._path, type=self._type)