예제 #1
0
    def fetch_item(self, section, key, readonly=False):
        if self._config == None:
            return

        s = '/'.join(
            [s for s in '/'.join([self._prefix, section]).split('/') if s])
        try:
            v = None
            # gobject-introspection has a bug.
            # https://bugzilla.gnome.org/show_bug.cgi?id=670509
            # GLib.log_set_handler("IBUS", GLib.LogLevelFlags.LEVEL_MASK,
            #                      self.__log_handler, False)
            if self.__no_key_warning:
                IBus.set_log_handler(False)
            variant = self._config.get_value(s, key)
            if self.__no_key_warning:
                IBus.unset_log_handler()
            v = self.variant_to_value(variant)
        except:
            v = None
        if readonly:
            return v != None
        if v != None:
            self.modified.setdefault(section, {})[key] = v if v != [''] else []
        return True
예제 #2
0
파일: prefs.py 프로젝트: kaio/ibus-anthy
 def get_value_direct(self, section, key, default=None):
     s = section
     section = '/'.join(
         [s for s in '/'.join([self._prefix, section]).split('/') if s])
     try:
         if self.__no_key_warning:
             IBus.set_log_handler(False)
         variant = self._config.get_value(section, key)
         if self.__no_key_warning:
             IBus.unset_log_handler()
         return self.variant_to_value(variant)
     except:
         return default
예제 #3
0
    def get_value_direct(self, section, key, default=None):
        if self._config == None:
            return default

        s = section
        section = '/'.join(
            [s for s in '/'.join([self._prefix, section]).split('/') if s])
        try:
            if self.__no_key_warning:
                IBus.set_log_handler(False)
            variant = self._config.get_value(section, key)
            if self.__no_key_warning:
                IBus.unset_log_handler()
            return self.variant_to_value(variant)
        except:
            return default