diff options
author | fujiwarat <takao.fujiwara1@gmail.com> | 2010-01-15 00:54:22 +0900 |
---|---|---|
committer | fujiwarat <takao.fujiwara1@gmail.com> | 2010-01-15 00:54:22 +0900 |
commit | c582132ab69cb1c092a8e667bf0ec99645aff0d4 (patch) | |
tree | 62f37f97ec71717e7ee839f5d79624d840e28697 | |
parent | 4fe1e6d1c32f0450218098f6cd947be37852edf5 (diff) | |
download | ibus-anthy-c582132ab69cb1c092a8e667bf0ec99645aff0d4.tar.gz |
Fix typo gconf keys. #731
-rw-r--r-- | engine/engine.py | 6 | ||||
-rw-r--r-- | setup/anthyprefs.py | 37 | ||||
-rw-r--r-- | setup/main.py | 2 | ||||
-rw-r--r-- | setup/prefs.py | 5 | ||||
-rw-r--r-- | setup/setup.glade | 8 |
5 files changed, 47 insertions, 11 deletions
diff --git a/engine/engine.py b/engine/engine.py index 99b4054..c5841cb 100644 --- a/engine/engine.py +++ b/engine/engine.py @@ -519,7 +519,7 @@ class Engine(ibus.EngineBase): # self.__invalidate() def focus_out(self): - mode = self.__prefs.get_value('common', 'behivior_on_focus_out') + mode = self.__prefs.get_value('common', 'behavior_on_focus_out') if mode == 0: self.__reset() self.__invalidate() @@ -1091,7 +1091,7 @@ class Engine(ibus.EngineBase): try: ret = self.__on_key_common(ord(keyval)) if (keyval in u',.、。' and - self.__prefs.get_value('common', 'behivior_on_period')): + self.__prefs.get_value('common', 'behavior_on_period')): return self.__cmd_convert(keyval, state) return ret except: @@ -1222,7 +1222,7 @@ class Engine(ibus.EngineBase): keyval = keysyms.yen ret = self.__on_key_common(keyval) if (unichr(keyval) in u',.' and - self.__prefs.get_value('common', 'behivior_on_period')): + self.__prefs.get_value('common', 'behavior_on_period')): return self.__cmd_convert(keyval, state) return ret else: diff --git a/setup/anthyprefs.py b/setup/anthyprefs.py index f632c1e..9af9ba4 100644 --- a/setup/anthyprefs.py +++ b/setup/anthyprefs.py @@ -22,6 +22,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import gtk +import sys from prefs import Prefs @@ -36,8 +37,40 @@ class AnthyPrefs(Prefs): super(AnthyPrefs, self).__init__(bus, config) self.default = _config + # The keys will be EOSL in the near future. + self.__update_key ("common", + "behivior_on_focus_out", + "behavior_on_focus_out") + self.__update_key ("common", + "behivior_on_period", + "behavior_on_period") self.fetch_all() + def __update_key (self, section, old_key, new_key): + file = __file__ + path_list = __file__.split('/') + if path_list: + path_list.reverse() + file = path_list[0] + warning_message = \ + "(" + file + ") ibus-anthy-WARNING **: " \ + "The key (" + old_key + ") will be removed in the future. " \ + "Currently the key (" + new_key + ") is used instead. " \ + "The ibus keys are defined in " + \ + "/".join(["/desktop/ibus", self._prefix, section]) + " ." + + if not self.fetch_item(section, old_key, True): + return + print >> sys.stderr, warning_message + if self.fetch_item(section, new_key, True): + return + + self.fetch_item(section, old_key) + value = self.get_value(section, old_key) + self.set_value(section, new_key, value) + self.commit_item(section, new_key) + self.undo_item(section, new_key) + def keys(self, section): if section.startswith('shortcut/'): return _cmd_keys @@ -125,8 +158,8 @@ _config = { 'period_style': 0, 'symbol_style': 1, 'ten_key_mode': 1, - 'behivior_on_focus_out': 0, - 'behivior_on_period': 0, + 'behavior_on_focus_out': 0, + 'behavior_on_period': 0, 'page_size': 10, 'half_width_symbol': False, diff --git a/setup/main.py b/setup/main.py index e584fa6..9105fcb 100644 --- a/setup/main.py +++ b/setup/main.py @@ -52,7 +52,7 @@ class AnthySetup(object): for name in ['input_mode', 'typing_method', 'period_style', 'symbol_style', 'ten_key_mode', - 'behivior_on_focus_out', 'behivior_on_period', + 'behavior_on_focus_out', 'behavior_on_period', 'half_width_symbol', 'half_width_number', 'half_width_space']: xml.get_widget(name).set_active(prefs.get_value('common', name)) diff --git a/setup/prefs.py b/setup/prefs.py index 4aa900b..0b342d4 100644 --- a/setup/prefs.py +++ b/setup/prefs.py @@ -62,12 +62,15 @@ class Prefs(object): for k in self.keys(section): self.fetch_item(section, k) - def fetch_item(self, section, key): + def fetch_item(self, section, key, readonly=False): s = '/'.join( [s for s in '/'.join([self._prefix, section]).split('/') if s]) v = self._config.get_value(s, key, None) + if readonly: + return v != None if v != None: self.modified.setdefault(section, {})[key] = v if v != [''] else [] + return True def commit_all(self): for s in self.new.keys(): diff --git a/setup/setup.glade b/setup/setup.glade index c8405cd..f068938 100644 --- a/setup/setup.glade +++ b/setup/setup.glade @@ -233,7 +233,7 @@ Convert Characters <property name="xalign">0</property> <property name="label" translatable="yes">_Behavior on Period:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">behivior_on_period</property> + <property name="mnemonic_widget">behavior_on_period</property> </widget> <packing> <property name="top_attach">3</property> @@ -248,7 +248,7 @@ Convert Characters <property name="xalign">0</property> <property name="label" translatable="yes">Behavior on _Focus Out:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">behivior_on_focus_out</property> + <property name="mnemonic_widget">behavior_on_focus_out</property> </widget> <packing> <property name="top_attach">4</property> @@ -258,7 +258,7 @@ Convert Characters </packing> </child> <child> - <widget class="GtkComboBox" id="behivior_on_period"> + <widget class="GtkComboBox" id="behavior_on_period"> <property name="visible">True</property> <property name="items" translatable="yes">Do Nothing Auto Convert</property> @@ -273,7 +273,7 @@ Auto Convert</property> </packing> </child> <child> - <widget class="GtkComboBox" id="behivior_on_focus_out"> + <widget class="GtkComboBox" id="behavior_on_focus_out"> <property name="visible">True</property> <property name="items" translatable="yes">Clear Commit |