summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2017-12-28 20:48:32 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2017-12-28 20:48:32 +0900
commit89f8ddf86f417ed3074532e7b66f5eabc9595984 (patch)
tree7c74356b963fd56a88ce4a2e74759612c424a93a
parentae039c727a89c8a27d5224adafb656a37d345d22 (diff)
downloadibus-anthy-89f8ddf86f417ed3074532e7b66f5eabc9595984.tar.gz
Migrated DConf to GSettings for python2
-rw-r--r--data/Makefile.am12
-rw-r--r--engine/python2/Makefile.am5
-rw-r--r--engine/python2/_config.py.in5
-rw-r--r--engine/python2/engine.py277
-rw-r--r--engine/python2/factory.py19
-rw-r--r--engine/python2/jastring.py20
-rw-r--r--engine/python2/kana.py56
-rw-r--r--engine/python2/romaji.py32
-rw-r--r--engine/python2/thumb.py86
-rw-r--r--engine/python3/engine.py1
-rw-r--r--ibus-anthy.spec.in12
-rw-r--r--po/POTFILES.in4
-rw-r--r--po/ibus-anthy.pot325
-rw-r--r--setup/python2/Makefile.am15
-rw-r--r--setup/python2/anthyprefs.py342
-rw-r--r--setup/python2/anthyprefs.py.in1368
-rw-r--r--setup/python2/main.py633
-rw-r--r--setup/python2/prefs.py425
-rw-r--r--setup/python2/setup.ui134
-rw-r--r--setup/python3/main.py33
-rw-r--r--setup/python3/prefs.py21
-rw-r--r--tests/anthytest.py16
22 files changed, 1267 insertions, 2574 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 5d5747e..d94ff54 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -75,6 +75,18 @@ zipcode.t: $(ANTHY_ZIPCODE_FILE)
CLEANFILES += zipcode.t
endif
+install-data-hook:
+ if test -z "$(DESTDIR)"; then \
+ glib-compile-schemas $(schemasdir); \
+ fi
+
+uninstall-hook:
+ SCHEMAS_FILES=`ls $(schemasdir)/*.gschema.xml` || true; \
+ if test -z "$$SCHEMAS_FILES" && \
+ test -f $(schemasdir)/gschemas.compiled; then \
+ rm $(schemasdir)/gschemas.compiled; \
+ fi
+
EXTRA_DIST = \
$(appdata_in_files) \
$(schemas_in_files) \
diff --git a/engine/python2/Makefile.am b/engine/python2/Makefile.am
index 47a7574..ec9cdd6 100644
--- a/engine/python2/Makefile.am
+++ b/engine/python2/Makefile.am
@@ -3,8 +3,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -102,6 +102,7 @@ _config.py: _config.py.in
-e "s|\@LAYOUT\@|$(LAYOUT)|g" \
-e "s|\@SYMBOL_CHAR_INT\@|$(SYMBOL_CHAR_INT)|g" \
-e "s|\@ICON_PREFERENCE\@|$(ICON_PREFERENCE)|g" \
+ -e "s|\@VERSION\@|$(VERSION)|g" \
$< > $@
test:
diff --git a/engine/python2/_config.py.in b/engine/python2/_config.py.in
index d78d182..f7eff10 100644
--- a/engine/python2/_config.py.in
+++ b/engine/python2/_config.py.in
@@ -4,8 +4,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,4 +27,5 @@ LOCALEDIR = '@datadir@/locale'
LAYOUT = '@LAYOUT@'
SYMBOL_CHAR = unichr(@SYMBOL_CHAR_INT@)
ICON_PREFERENCE = '@ICON_PREFERENCE@'
+VERSION = '@VERSION@'
DEBUG = False
diff --git a/engine/python2/engine.py b/engine/python2/engine.py
index 44d6ad1..1dc937c 100644
--- a/engine/python2/engine.py
+++ b/engine/python2/engine.py
@@ -156,7 +156,7 @@ class Engine(IBus.EngineSimple):
# cursor_pos=0,
# cursor_visible=True,
# round=True)
- size = self.__prefs.get_value('common', 'page_size')
+ size = self.__prefs.get_value('common', 'page-size')
self.__lookup_table = IBus.LookupTable.new(page_size=size,
cursor_pos=0,
cursor_visible=True,
@@ -178,10 +178,6 @@ class Engine(IBus.EngineSimple):
# use reset to init values
self.__reset()
- ibus_config = bus.get_config()
- if ibus_config != None:
- ibus_config.connect('value-changed',
- self.__config_value_changed_cb)
def __ibus_check_version(self, v):
major = IBus.MAJOR_VERSION
@@ -279,7 +275,7 @@ class Engine(IBus.EngineSimple):
# the engine keeps the class method in the memory.
Engine.__input_mode = INPUT_MODE_HIRAGANA
Engine.__input_mode = self.__prefs.get_value('common',
- 'input_mode')
+ 'input-mode')
if not self.__prefs.get_value('common', 'show-input-mode'):
return
@@ -372,7 +368,7 @@ class Engine(IBus.EngineSimple):
if Engine.__typing_mode == None:
Engine.__typing_mode = jastring.TYPING_MODE_ROMAJI
Engine.__typing_mode = self.__prefs.get_value('common',
- 'typing_method')
+ 'typing-method')
if not self.__prefs.get_value('common', 'show-typing-method'):
return
@@ -440,7 +436,7 @@ class Engine(IBus.EngineSimple):
if Engine.__segment_mode == None:
Engine.__segment_mode = SEGMENT_DEFAULT
Engine.__segment_mode = self.__prefs.get_value('common',
- 'conversion_segment_mode')
+ 'conversion-segment-mode')
if not self.__prefs.get_value('common', 'show-segment-mode'):
return
@@ -520,8 +516,8 @@ class Engine(IBus.EngineSimple):
if not self.__prefs.get_value('common', 'show-dict-mode'):
return
- short_label = self.__prefs.get_value('dict/file/embedded',
- 'short_label')
+ dicts = self.__prefs.get_value('dict', 'list')
+ short_label = dicts['embedded'].short_label
label = _("%(description)s (%(symbol)s)") % \
{ 'description' : _("Dictionary mode"), 'symbol' : short_label }
dict_mode_prop = IBus.Property(key=u'DictMode',
@@ -537,8 +533,7 @@ class Engine(IBus.EngineSimple):
self.__prop_dict[u'DictMode'] = dict_mode_prop
props = IBus.PropList()
- long_label = self.__prefs.get_value('dict/file/embedded',
- 'long_label')
+ long_label = dicts['embedded'].long_label
props.append(IBus.Property(key=u'DictMode.embedded',
prop_type=IBus.PropType.RADIO,
# if long_label is UTF-8
@@ -549,15 +544,24 @@ class Engine(IBus.EngineSimple):
visible=True,
state=IBus.PropState.UNCHECKED,
sub_props=None))
- for file in self.__prefs.get_value('dict', 'files'):
- if not self.__link_dict_file(file):
- continue
- id = self.__get_dict_id_from_file(file)
- section = 'dict/file/' + id
- if not self.__prefs.get_value(section, 'single'):
- continue
+ order = self.__prefs.get_value('dict', 'order')
+ if len(order) == 0:
+ order = list(self.__prefs.get_value('dict', 'files').keys())
+ files = self.__prefs.get_value('dict', 'files')
+ dicts = self.__prefs.get_value('dict', 'list')
+ for id in order:
+ dict_item = dicts[id]
+ is_cont = False
+ for file in files[id]:
+ if not self.__link_dict_file(dict_item, file):
+ is_cont = True
+ break
+ if is_cont:
+ continue
+ if not dict_item.single:
+ continue
key = 'DictMode.' + id
- long_label = self.__prefs.get_value(section, 'long_label')
+ long_label = dict_item.long_label
# ibus-config 'value-changed' signal updated dict/files but
# not dict/file/new yet.
@@ -565,8 +569,7 @@ class Engine(IBus.EngineSimple):
continue
# if long_label is UTF-8
- if 'is_system' in self.__prefs.keys(section) and \
- self.__prefs.get_value(section, 'is_system'):
+ if dict_item.is_system:
uni_long_label = UN(_(long_label))
else:
uni_long_label = UN(long_label)
@@ -607,8 +610,8 @@ class Engine(IBus.EngineSimple):
if not self.__prefs.get_value('common', 'show-dict-config'):
return
- admin_command = self.__prefs.get_value('common', 'dict_admin_command')
- icon_path = self.__prefs.get_value('common', 'dict_config_icon')
+ admin_command = self.__prefs.get_value('common', 'dict-admin-command')
+ icon_path = self.__prefs.get_value('common', 'dict-config-icon')
if not path.exists(admin_command[0]):
return
@@ -670,20 +673,28 @@ class Engine(IBus.EngineSimple):
return clipboard_text
def __get_single_dict_files(self):
+ order = self.__prefs.get_value('dict', 'order')
+ if len(order) == 0:
+ order = list(self.__prefs.get_value('dict', 'files').keys())
files = self.__prefs.get_value('dict', 'files')
+ dicts = self.__prefs.get_value('dict', 'list')
single_files = []
- for file in files:
- if not path.exists(file):
- continue
- id = self.__get_dict_id_from_file(file)
- section = 'dict/file/' + id
- if self.__prefs.get_value(section, 'single'):
- single_files.append(file)
+ for id in order:
+ for file in files[id]:
+ if not path.exists(file):
+ continue
+ dict_item = dicts[id]
+ if dict_item.single:
+ single_files.append(file)
return single_files
def __remove_dict_files(self):
- for file in self.__prefs.get_value('dict', 'files'):
- self.__remove_dict_file(file)
+ dicts = self.__prefs.get_value('dict', 'list')
+ files = self.__prefs.get_value('dict', 'files')
+ for id in files.keys():
+ dict_item = dicts[id]
+ for file in files[id]:
+ self.__remove_dict_file(dict_item, file)
def update_preedit(self, string, attrs, cursor_pos, visible):
text = IBus.Text.new_from_string(string)
@@ -695,7 +706,7 @@ class Engine(IBus.EngineSimple):
attr.get_start_index(),
attr.get_end_index())
i += 1
- mode = self.__prefs.get_value('common', 'behavior_on_focus_out')
+ mode = self.__prefs.get_value('common', 'behavior-on-focus-out')
if self.__has_update_preedit_text_with_mode and mode == 1:
self.update_preedit_text_with_mode(text,
cursor_pos, visible,
@@ -1016,8 +1027,8 @@ class Engine(IBus.EngineSimple):
self.__context.do_set_personality(str(dict_name))
prop = self.__prop_dict[u'DictMode']
- section = 'dict/file/' + id
- symbol = self.__prefs.get_value(section, 'short_label')
+ dicts = self.__prefs.get_value('dict', 'list')
+ symbol = dicts[id].short_label
label = _("%(description)s (%(symbol)s)") % \
{ 'description' : _("Dictionary mode"), 'symbol' : symbol }
prop.set_symbol(IBus.Text.new_from_string(symbol))
@@ -1033,19 +1044,19 @@ class Engine(IBus.EngineSimple):
def do_focus_in(self):
self.register_properties(self.__prop_list)
self.__refresh_typing_mode_property()
- mode = self.__prefs.get_value('common', 'behavior_on_focus_out')
+ mode = self.__prefs.get_value('common', 'behavior-on-focus-out')
if mode == 2:
self.__update_input_chars()
# self.__reset()
# self.__invalidate()
- size = self.__prefs.get_value('common', 'page_size')
+ size = self.__prefs.get_value('common', 'page-size')
if size != self.__lookup_table.get_page_size():
self.__lookup_table.set_page_size(size)
def do_focus_out(self):
if self.__has_input_purpose:
self.__input_purpose = 0
- mode = self.__prefs.get_value('common', 'behavior_on_focus_out')
+ mode = self.__prefs.get_value('common', 'behavior-on-focus-out')
if mode == 0 or mode == 1:
self.__reset()
self.__invalidate()
@@ -1646,11 +1657,12 @@ class Engine(IBus.EngineSimple):
#=======================================================================
@classmethod
- def CONFIG_RELOADED(cls, bus):
+ def CONFIG_RELOADED(cls):
if config.DEBUG:
print 'RELOADED'
if not cls.__prefs:
- cls.__prefs = AnthyPrefs(bus)
+ cls.__prefs = AnthyPrefs()
+ cls.__prefs.connect('changed', cls.CONFIG_VALUE_CHANGED)
cls._init_prefs()
cls.__keybind = cls._mk_keybind()
@@ -1658,70 +1670,45 @@ class Engine(IBus.EngineSimple):
jastring.JaString.SET_PREFS(cls.__prefs)
@classmethod
- def CONFIG_VALUE_CHANGED(cls, bus, section, name, variant):
+ def CONFIG_VALUE_CHANGED(cls, prefs, section, key, variant):
if config.DEBUG:
- print 'VALUE_CHAMGED =', section, name, variant
-
- if not section.startswith('engine/anthy'):
- # This value is used for IBus.config.set_value only.
- return
-
- # The key was deleted by dconf.
- # test case: update /desktop/ibus/engine/anthy/thumb/ls
- # and reset the key with dconf direclty.
- if variant.get_type_string() == '()':
- cls.__prefs.undo_item(section, name)
- return
-
- value = cls.__prefs.variant_to_value(variant)
- base_sec = section[len(cls.__prefs._prefix) + 1:]
- sec = cls._get_shortcut_type()
- if base_sec == sec:
- cmd = '_Engine__cmd_' + name
- old = cls.__prefs.get_value(sec, name)
- value = value if value != [''] else []
- for s in set(old).difference(value):
- cls.__keybind.get(cls._s_to_key(s), []).remove(cmd)
-
- keys = cls.__prefs.keys(sec)
- for s in set(value).difference(old):
- cls.__keybind.setdefault(cls._s_to_key(s), []).append(cmd)
- cls.__keybind.get(cls._s_to_key(s)).sort(
- lambda a, b: cmp(keys.index(a[13:]), keys.index(b[13:])))
-
- cls.__prefs.set_value(sec, name, value)
- elif base_sec == 'common':
- cls.__prefs.set_value(base_sec, name, value)
- if name == 'shortcut_type':
+ print('VALUE_CHAMGED =', section, key, variant)
+ if section == 'shortcut':
+ cls.__keybind = cls._mk_keybind()
+ elif section == 'common':
+ if key == 'shortcut-type':
cls.__keybind = cls._mk_keybind()
- if name == 'latin_with_shift':
+ elif key == 'latin-with-shift':
+ value = prefs.get_value(section, key)
cls.__latin_with_shift = value
- jastring.JaString.RESET(cls.__prefs, base_sec, name, value)
- elif base_sec.startswith('kana_typing_rule'):
- jastring.JaString.RESET(cls.__prefs, base_sec, name, value)
+ jastring.JaString.RESET(cls.__prefs, section, key, value)
+ elif section == 'kana-typing-rule':
+ value = prefs.get_value(section, key)
+ jastring.JaString.RESET(cls.__prefs, section, key, value)
@classmethod
def _init_prefs(cls):
prefs = cls.__prefs
- value = prefs.get_value('common', 'latin_with_shift')
+ value = prefs.get_value('common', 'latin-with-shift')
cls.__latin_with_shift = value
@classmethod
def _mk_keybind(cls):
keybind = {}
sec = cls._get_shortcut_type()
- for k in cls.__prefs.keys(sec):
+ shortcuts = cls.__prefs.get_value('shortcut', sec)
+ for k in shortcuts.keys():
cmd = '_Engine__cmd_' + k
- for s in cls.__prefs.get_value(sec, k):
+ for s in shortcuts[k]:
keybind.setdefault(cls._s_to_key(s), []).append(cmd)
return keybind
@classmethod
def _get_shortcut_type(cls):
try:
- t = 'shortcut/' + cls.__prefs.get_value('common', 'shortcut_type')
+ t = cls.__prefs.get_value('common', 'shortcut-type')
except:
- t = 'shortcut/default'
+ t = 'default'
return t
@classmethod
@@ -1787,9 +1774,9 @@ class Engine(IBus.EngineSimple):
self._MM = self._SS = 0
ret = self.__on_key_common(ord(keyval))
if (keyval in
- UN(self.__prefs.get_value('common', 'trigger_periods'))):
+ UN(self.__prefs.get_value('common', 'trigger-periods'))):
behavior = self.__prefs.get_value('common',
- 'behavior_on_period')
+ 'behavior-on-period')
if behavior == 1:
return self.__cmd_convert(keyval, state)
elif behavior == 2:
@@ -1828,7 +1815,7 @@ class Engine(IBus.EngineSimple):
IBus.ModifierType.RELEASE_MASK)
if keyval in KP_Table and self.__prefs.get_value('common',
- 'ten_key_mode'):
+ 'ten-key-mode'):
keyval = KP_Table[keyval]
if state & IBus.ModifierType.RELEASE_MASK:
@@ -1924,7 +1911,7 @@ class Engine(IBus.EngineSimple):
return False
if keyval in KP_Table and self.__prefs.get_value('common',
- 'ten_key_mode'):
+ 'ten-key-mode'):
keyval = KP_Table[keyval]
key = self._mk_key(keyval, state)
@@ -1958,9 +1945,9 @@ class Engine(IBus.EngineSimple):
ret = self.__on_key_common(keyval, state)
if (Engine.__input_mode != INPUT_MODE_LATIN and
unichr(keyval) in
- UN(self.__prefs.get_value('common', 'trigger_periods'))):
+ UN(self.__prefs.get_value('common', 'trigger-periods'))):
behavior = self.__prefs.get_value('common',
- 'behavior_on_period')
+ 'behavior-on-period')
if behavior == 1:
return self.__cmd_convert(keyval, state)
elif behavior == 2:
@@ -2020,7 +2007,7 @@ class Engine(IBus.EngineSimple):
def __get_dict_id_from_file(self, file):
return self.__get_quoted_id(file)
- def __link_dict_file_with_id(self, file, id, link_mode):
+ def __link_dict_file_with_mode(self, id, file, link_mode):
if id == None:
return
if link_mode == LINK_DICT_EMBEDDED:
@@ -2051,7 +2038,7 @@ class Engine(IBus.EngineSimple):
if backup_dir != None:
os.chdir(backup_dir)
- def __remove_dict_file_with_id(self, file, id, link_mode):
+ def __remove_dict_file_with_mode(self, id, file, link_mode):
if id == None:
return
if link_mode == LINK_DICT_EMBEDDED:
@@ -2073,97 +2060,23 @@ class Engine(IBus.EngineSimple):
if backup_dir != None:
os.chdir(backup_dir)
- def __link_dict_file(self, file):
+ def __link_dict_file(self, dict_item, file):
if not path.exists(file):
printerr(file + ' does not exist')
return False
- id = self.__get_dict_id_from_file(file)
- section = 'dict/file/' + id
- if section not in self.__prefs.sections():
- self.__fetch_dict_values(section)
- if self.__prefs.get_value(section, 'embed'):
- self.__link_dict_file_with_id(file, id, LINK_DICT_EMBEDDED)
- if self.__prefs.get_value(section, 'single'):
- self.__link_dict_file_with_id(file, id, LINK_DICT_SINGLE)
+ id = dict_item.id
+ if dict_item.embed:
+ self.__link_dict_file_with_mode(id, file, LINK_DICT_EMBEDDED)
+ if dict_item.single:
+ self.__link_dict_file_with_mode(id, file, LINK_DICT_SINGLE)
return True
- def __remove_dict_file(self, file):
- id = self.__get_dict_id_from_file(file)
- section = 'dict/file/' + id
- if section not in self.__prefs.sections():
- self.__fetch_dict_values(section)
- if self.__prefs.get_value(section, 'embed'):
- self.__remove_dict_file_with_id(file, id, LINK_DICT_EMBEDDED)
- if self.__prefs.get_value(section, 'single'):
- self.__remove_dict_file_with_id(file, id, LINK_DICT_SINGLE)
-
- def __set_dict_files_value(self, base_sec, name, value):
- if name == 'files':
- str_list = []
- for file in value:
- str_list.append(self.__prefs.str(file))
- old_files = self.__prefs.get_value(base_sec, name)
- for file in old_files:
- if file in str_list:
- continue
- self.__remove_dict_file(file)
- for file in str_list:
- if file in old_files:
- continue
- self.__link_dict_file(file)
- self.__prefs.set_value(base_sec, name, str_list)
- else:
- self.__prefs.set_value(base_sec, name, value)
-
- def __fetch_dict_values(self, section):
- self.__prefs.set_new_section(section)
- self.__prefs.set_new_key(section, 'short_label')
- self.__prefs.set_no_key_warning(True)
- self.__prefs.fetch_item(section, 'short_label')
- self.__prefs.set_new_key(section, 'long_label')
- self.__prefs.fetch_item(section, 'long_label')
- self.__prefs.set_new_key(section, 'embed')
- self.__prefs.fetch_item(section, 'embed')
- self.__prefs.set_new_key(section, 'single')
- self.__prefs.fetch_item(section, 'single')
- self.__prefs.set_new_key(section, 'reverse')
- self.__prefs.fetch_item(section, 'reverse')
- self.__prefs.set_no_key_warning(False)
-
- def __config_value_changed_cb(self, ibus_config, section, name, variant):
- if config.DEBUG:
- print 'VALUE_CHAMGED =', section, name, variant
-
- if not section.startswith('engine/anthy'):
- # This value is used for IBus.config.set_value only.
- return
-
- # The key was deleted by dconf.
- # test case: update /desktop/ibus/engine/anthy/thumb/ls
- # and reset the key with dconf direclty.
- if variant.get_type_string() == '()':
- self.__prefs.undo_item(section, name)
- return
-
- value = self.__prefs.variant_to_value(variant)
- base_sec = section[len(self.__prefs._prefix) + 1:]
- sec = self._get_shortcut_type()
-
- if base_sec == 'thumb':
- self.__prefs.set_value(base_sec, name, value)
- self._reset_thumb()
- elif base_sec == 'dict':
- self.__set_dict_files_value(base_sec, name, value)
- self.__set_dict_mode_props(self.__prop_list, True)
- elif base_sec.startswith('dict/file/'):
- if base_sec not in self.__prefs.sections():
- self.__fetch_dict_values(base_sec)
- self.__prefs.set_value(base_sec, name, value)
- self.__set_dict_mode_props(self.__prop_list, True)
- elif base_sec:
- self.__prefs.set_value(base_sec, name, value)
- else:
- self.__prefs.set_value(section, name, value)
+ def __remove_dict_file(self, dict_item, file):
+ id = dict_item.id
+ if dict_item.embed:
+ self.__remove_dict_file_with_mode(id, file, LINK_DICT_EMBEDDED)
+ if dict_item.single:
+ self.__remove_dict_file_with_mode(id, file, LINK_DICT_SINGLE)
#mod_keys
def __set_input_mode(self, mode):
@@ -2294,7 +2207,7 @@ class Engine(IBus.EngineSimple):
def __cmd_insert_space(self, keyval, state):
if Engine.__input_mode == INPUT_MODE_LATIN:
return False
- if (self.__prefs.get_value('common', 'half_width_space') or
+ if (self.__prefs.get_value('common', 'half-width-space') or
Engine.__input_mode == INPUT_MODE_HALF_WIDTH_KATAKANA):
return self.__cmd_insert_half_space(keyval, state)
else:
@@ -2303,7 +2216,7 @@ class Engine(IBus.EngineSimple):
def __cmd_insert_alternate_space(self, keyval, state):
if Engine.__input_mode == INPUT_MODE_LATIN:
return False
- if (self.__prefs.get_value('common', 'half_width_space') or
+ if (self.__prefs.get_value('common', 'half-width-space') or
Engine.__input_mode == INPUT_MODE_HALF_WIDTH_KATAKANA):
return self.__cmd_insert_wide_space(keyval, state)
else:
@@ -2901,11 +2814,11 @@ class Engine(IBus.EngineSimple):
return True
def __start_dict_admin(self):
- command = self.__prefs.get_value('common', 'dict_admin_command')
+ command = self.__prefs.get_value('common', 'dict-admin-command')
os.spawnl(os.P_NOWAIT, *command)
def __start_add_word(self):
- command = self.__prefs.get_value('common', 'add_word_command')
+ command = self.__prefs.get_value('common', 'add-word-command')
os.spawnl(os.P_NOWAIT, *command)
def __start_setup(self):
diff --git a/engine/python2/factory.py b/engine/python2/factory.py
index 8aec2b2..b7b1e89 100644
--- a/engine/python2/factory.py
+++ b/engine/python2/factory.py
@@ -4,8 +4,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -44,19 +44,11 @@ class EngineFactory(IBus.Factory):
def __init__(self, bus):
self.__bus = bus
- engine.Engine.CONFIG_RELOADED(bus)
+ engine.Engine.CONFIG_RELOADED()
super(EngineFactory, self).__init__(object_path=IBus.PATH_FACTORY,
connection=bus.get_connection())
self.__id = 0
- self.__config = self.__bus.get_config()
-
- if self.__config != None:
- self.__config.connect('value-changed',
- self.__config_value_changed_cb)
- else:
- print >> sys.stderr, \
- 'ibus-config is not running or bus address is not correct.'
bus.get_connection().signal_subscribe('org.freedesktop.DBus',
'org.freedesktop.DBus',
@@ -74,11 +66,8 @@ class EngineFactory(IBus.Factory):
return super(EngineFactory, self).do_create_engine(engine_name)
- def __config_value_changed_cb(self, config, section, name, value):
- engine.Engine.CONFIG_VALUE_CHANGED(self.__bus, section, name, value)
-
def __name_owner_changed_cb(self, connection, sender_name, object_path,
interface_name, signal_name, parameters,
user_data):
if signal_name == 'NameOwnerChanged':
- engine.Engine.CONFIG_RELOADED(self.__bus)
+ engine.Engine.CONFIG_RELOADED()
diff --git a/engine/python2/jastring.py b/engine/python2/jastring.py
index aeb7e6e..26b7b74 100644
--- a/engine/python2/jastring.py
+++ b/engine/python2/jastring.py
@@ -4,8 +4,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -78,13 +78,13 @@ class JaString:
cls._prefs = prefs
@classmethod
- def RESET(cls, prefs, section, name, value):
+ def RESET(cls, prefs, section, key, value):
cls._prefs = prefs
- if section.startswith('kana_typing_rule'):
+ if section == 'kana-typing-rule':
mode = TYPING_MODE_KANA
- kana.KanaSegment.RESET(prefs, section, name, value)
+ kana.KanaSegment.RESET(prefs, section, key, value)
cls._init_mode(mode)
- if section == 'common' and name == 'latin_with_shift':
+ if section == 'common' and key == 'latin-with-shift':
romaji.RomajiSegment.SET_LATIN_WITH_SHIFT(value)
def set_shift(self, shift):
@@ -241,10 +241,10 @@ class JaString:
self.__cursor = self.__cursor + 1
def _chk_text(self, s):
- period = self._prefs.get_value('common', 'period_style')
- symbol = self._prefs.get_value('common', 'symbol_style')
- half_symbol = self._prefs.get_value('common', 'half_width_symbol')
- half_number = self._prefs.get_value('common', 'half_width_number')
+ period = self._prefs.get_value('common', 'period-style')
+ symbol = self._prefs.get_value('common', 'symbol-style')
+ half_symbol = self._prefs.get_value('common', 'half-width-symbol')
+ half_number = self._prefs.get_value('common', 'half-width-number')
ret = ''
for c in s:
c = c if not period else PeriodTable.get(c, c)
diff --git a/engine/python2/kana.py b/engine/python2/kana.py
index c85a199..9027571 100644
--- a/engine/python2/kana.py
+++ b/engine/python2/kana.py
@@ -4,8 +4,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,8 +30,9 @@ _UNFINISHED_HIRAGANA = set(u'かきくけこさしすせそたちつてとはひ
class KanaSegment(segment.Segment):
_prefs = None
- _kana_typing_rule_section = None
+ _kana_typing_rule_method = None
_kana_voiced_consonant_rule = None
+ _kana_voiced_consonant_dict = None
def __init__(self, enchars=u'', jachars=u''):
if not jachars:
@@ -42,24 +43,25 @@ class KanaSegment(segment.Segment):
def INIT_KANA_TYPING_RULE(cls, prefs):
cls._prefs = prefs
if prefs == None:
- cls._kana_typing_rule_section = None
+ cls._kana_typing_rule_method = None
return
- if cls._kana_typing_rule_section == None:
+ if cls._kana_typing_rule_method == None:
cls._init_kana_typing_method()
if cls._kana_voiced_consonant_rule == None and \
- cls._kana_typing_rule_section != None:
+ cls._kana_typing_rule_method != None:
cls._init_kana_voiced_consonant_rule()
@classmethod
def _init_kana_typing_method(cls, method=None):
prefs = cls._prefs
if method == None:
- method = prefs.get_value('kana_typing_rule', 'method')
+ method = prefs.get_value('kana-typing-rule', 'method')
if method == None:
method = 'jp'
- cls._kana_typing_rule_section = 'kana_typing_rule/' + method
- if cls._kana_typing_rule_section not in prefs.sections():
- cls._kana_typing_rule_section = None
+ cls._kana_typing_rule_method = method
+ keymap = prefs.get_value('kana-typing-rule', 'list')
+ if cls._kana_typing_rule_method not in keymap.keys():
+ cls._kana_typing_rule_method = None
@classmethod
def _init_kana_voiced_consonant_rule(cls):
@@ -70,9 +72,10 @@ class KanaSegment(segment.Segment):
# If the customized table provides U+309b with other chars,
# it needs to be detected dynamically.
cls._kana_voiced_consonant_rule = {}
- section = cls._kana_typing_rule_section
- for gkey in prefs.keys(section):
- value = prefs.get_value(section, gkey)
+ method = cls._kana_typing_rule_method
+ keymap = prefs.get_value('kana-typing-rule', 'list')[method]
+ for gkey in keymap.keys():
+ value = keymap[gkey]
key = prefs.typing_from_config_key(gkey)
if key == '':
continue
@@ -88,37 +91,26 @@ class KanaSegment(segment.Segment):
cls._kana_voiced_consonant_rule[rule] = voiced
@classmethod
- def RESET(cls, prefs, section, name, value):
+ def RESET(cls, prefs, section, key, value):
cls._prefs = prefs
- if section == 'kana_typing_rule' and name == 'method' and \
- value != None:
- cls._kana_typing_rule_section = None
- cls._kana_voiced_consonant_rule = None
- cls._init_kana_typing_method(value)
- elif section.startswith('kana_typing_rule/'):
- # Probably it's better to restart ibus by manual
- # instead of saving the emitted values from config.
+ if section == 'kana-typing-rule' and value != None:
+ cls._kana_typing_rule_method = None
cls._kana_voiced_consonant_rule = None
+ cls.INIT_KANA_TYPING_RULE(prefs)
def __get_kana_typing_rule(self, enchars, retval=None):
prefs = self._prefs
value = None
- section = self._kana_typing_rule_section
- if section != None:
+ method = self._kana_typing_rule_method
+ if method != None:
# Need to send Unicode to typing_to_config_key instead of UTF-8
# not to separate U+A5
gkey = prefs.typing_to_config_key(enchars)
if gkey == '':
return None
enchars = gkey
- if enchars in prefs.keys(section):
- value = prefs.unicode(prefs.str(prefs.get_value(section, enchars)))
- else:
- prefs.set_no_key_warning(True)
- value = prefs.get_value_direct(section, enchars)
- prefs.set_no_key_warning(False)
- if value != None:
- value = prefs.unicode(prefs.str(value))
+ keymap = prefs.get_value('kana-typing-rule', 'list')[method]
+ value = prefs.unicode(keymap.get(enchars))
if value == '':
value = None
if value == None:
diff --git a/engine/python2/romaji.py b/engine/python2/romaji.py
index 48167c6..333d438 100644
--- a/engine/python2/romaji.py
+++ b/engine/python2/romaji.py
@@ -4,8 +4,8 @@
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2010-2013 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2013 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ def romaji_correction_rule_get(k, d):
class RomajiSegment(segment.Segment):
_prefs = None
- _romaji_typing_rule_section = None
+ _romaji_typing_rule_method = None
_latin_with_shift = True
_shift_mode = False
@@ -59,14 +59,15 @@ class RomajiSegment(segment.Segment):
def INIT_ROMAJI_TYPING_RULE(cls, prefs):
cls._prefs = prefs
if prefs == None:
- cls._romaji_typing_rule_section = None
+ cls._romaji_typing_rule_method = None
return
- method = prefs.get_value('romaji_typing_rule', 'method')
+ method = prefs.get_value('romaji-typing-rule', 'method')
if method == None:
method = 'default'
- cls._romaji_typing_rule_section = 'romaji_typing_rule/' + method
- if cls._romaji_typing_rule_section not in prefs.sections():
- cls._romaji_typing_rule_section = None
+ cls._romaji_typing_rule_method = method
+ keymap = prefs.get_value('romaji-typing-rule', 'list')
+ if cls._romaji_typing_rule_method not in keymap.keys():
+ cls._romaji_typing_rule_method = None
@classmethod
def SET_LATIN_WITH_SHIFT(cls, latin_with_shift):
@@ -76,22 +77,15 @@ class RomajiSegment(segment.Segment):
def __get_romaji_typing_rule(self, enchars, retval=None):
prefs = self._prefs
value = None
- section = self._romaji_typing_rule_section
- if section != None:
+ method = self._romaji_typing_rule_method
+ if method != None:
# Need to send Unicode to typing_to_config_key instead of UTF-8
# not to separate U+A5
gkey = prefs.typing_to_config_key(enchars)
if gkey == '':
return None
- if gkey in prefs.keys(section):
- value = prefs.unicode(prefs.str(
- prefs.get_value(section, gkey)))
- else:
- prefs.set_no_key_warning(True)
- value = prefs.get_value_direct(section, gkey)
- prefs.set_no_key_warning(False)
- if value != None:
- value = prefs.unicode(prefs.str(value))
+ keymap = prefs.get_value('romaji-typing-rule', 'list')[method]
+ value = prefs.unicode(keymap.get(gkey))
if value == '':
value = None
if value == None:
diff --git a/engine/python2/thumb.py b/engine/python2/thumb.py
index 6cb6980..7073aa2 100644
--- a/engine/python2/thumb.py
+++ b/engine/python2/thumb.py
@@ -5,8 +5,8 @@
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -231,8 +231,7 @@ class ThumbShiftKeyboard:
self.__layout = 0
self.__fmv_extension = 2
self.__handakuten = False
- self.__thumb_typing_rule_section_base = None
- self.__thumb_typing_rule_section = None
+ self.__thumb_typing_rule_method = None
self.__init_thumb_typing_rule()
self.__init_layout_table()
if self.__prefs != None:
@@ -242,34 +241,27 @@ class ThumbShiftKeyboard:
def __init_thumb_typing_rule(self):
prefs = self.__prefs
if prefs == None:
- self.__thumb_typing_rule_section = None
+ self.__thumb_typing_rule_method = None
return
- method = prefs.get_value('thumb_typing_rule', 'method')
+ method = prefs.get_value('thumb-typing-rule', 'method')
if method == None:
method = _THUMB_BASIC_METHOD
- self.__thumb_typing_rule_section_base = 'thumb_typing_rule'
- self.__thumb_typing_rule_section = \
- self.__thumb_typing_rule_section_base + '/' + method
- if self.__thumb_typing_rule_section not in prefs.sections():
- self.__thumb_typing_rule_section = None
+ self.__thumb_typing_rule_method = method
+ keymap = prefs.get_value('thumb-typing-rule', 'list')
+ if self.__thumb_typing_rule_method not in keymap.keys():
+ self.__thumb_typing_rule_method = None
def __init_layout_table(self):
if self.__table != {}:
self.__table.clear()
if self.__r_table != {}:
self.__r_table.clear()
- section_base = self.__thumb_typing_rule_section_base
- section = self.__thumb_typing_rule_section
- if section != None:
+ method = self.__thumb_typing_rule_method
+ if method != None:
prefs = self.__prefs
- for k in prefs.keys(section):
- value = prefs.get_value(section, k)
- ch = prefs.typing_from_config_key(k)
- if ch == '':
- continue
- self.__set_bus_table(ch, value)
- for k in prefs.get_value(section_base, 'newkeys'):
- value = prefs.get_value_direct(section, k)
+ keymap = prefs.get_value('thumb-typing-rule', 'list')[method]
+ for k in keymap.keys():
+ value = keymap.get(k)
ch = prefs.typing_from_config_key(k)
if ch == '':
continue
@@ -313,19 +305,12 @@ class ThumbShiftKeyboard:
sub_table = f_table
if method == None or sub_table == None:
return
- section_base = self.__thumb_typing_rule_section_base
- section = self.__thumb_typing_rule_section
- sub_section = section_base + '/' + method
- if section != None:
+ method = self.__thumb_typing_rule_method
+ if method != None:
prefs = self.__prefs
- for k in prefs.keys(sub_section):
- value = prefs.get_value(sub_section, k)
- ch = prefs.typing_from_config_key(k)
- if ch == '':
- continue
- self.__set_bus_table(ch, value)
- for k in prefs.get_value(section_base, method + '_newkeys'):
- value = prefs.get_value_direct(sub_section, k)
+ keymap = prefs.get_value('thumb-typing-rule', 'list')[method]
+ for k in keymap.keys():
+ value = keymap.get(k)
ch = prefs.typing_from_config_key(k)
if ch == '':
continue
@@ -460,15 +445,15 @@ class ThumbShiftKeyboard:
return layout
def __reset_layout_and_handakuten(self):
- mode = self.__prefs.get_value('thumb', 'keyboard_layout_mode')
+ mode = self.__prefs.get_value('thumb', 'keyboard-layout-mode')
layout = 0
if mode == 1:
layout = self.__get_xkb_layout()
else:
- layout = self.__prefs.get_value('thumb', 'keyboard_layout')
+ layout = self.__prefs.get_value('thumb', 'keyboard-layout')
self.set_layout(layout)
- fmv_extension = self.__prefs.get_value('thumb', 'fmv_extension')
+ fmv_extension = self.__prefs.get_value('thumb', 'fmv-extension')
self.set_fmv_extension(fmv_extension)
handakuten = self.__prefs.get_value('thumb', 'handakuten')
self.set_handakuten(handakuten)
@@ -585,32 +570,25 @@ class ThumbShiftSegment(segment.Segment):
if prefs == None:
cls._thumb_typing_rule_section = None
return
- method = prefs.get_value('thumb_typing_rule', 'method')
+ method = prefs.get_value('thumb-typing-rule', 'method')
if method == None:
method = _THUMB_BASIC_METHOD
- cls._thumb_typing_rule_section_base = 'thumb_typing_rule'
- cls._thumb_typing_rule_section = \
- cls._thumb_typing_rule_section_base + '/' + method
- if cls._thumb_typing_rule_section not in prefs.sections():
- cls._thumb_typing_rule_section = None
+ cls._thumb_typing_rule_method = method
+ keymap = prefs.get_value('thumb-typing-rule', 'list')
+ if cls._thumb_typing_rule_method not in keymap.keys():
+ cls._thumb_typing_rule_method = None
cls._init_layout_table()
@classmethod
def _init_layout_table(cls):
if cls._r_table != {}:
cls._r_table.clear()
- section_base = cls._thumb_typing_rule_section_base
- section = cls._thumb_typing_rule_section
- if section != None:
+ method = cls._thumb_typing_rule_method
+ if method != None:
prefs = cls._prefs
- for k in prefs.keys(section):
- value = prefs.get_value(section, k)
- ch = prefs.typing_from_config_key(k)
- if ch == '':
- continue
- cls._set_bus_table(ch, value)
- for k in prefs.get_value(section_base, 'newkeys'):
- value = prefs.get_value_direct(section, k)
+ keymap = prefs.get_value('thumb-typing-rule', 'list')[method]
+ for k in keymap.keys():
+ value = keymap.get(k)
ch = prefs.typing_from_config_key(k)
if ch == '':
continue
diff --git a/engine/python3/engine.py b/engine/python3/engine.py
index f150a9f..bb84d3d 100644
--- a/engine/python3/engine.py
+++ b/engine/python3/engine.py
@@ -1681,7 +1681,6 @@ class Engine(IBus.EngineSimple):
value = prefs.get_value(section, key)
jastring.JaString.RESET(cls.__prefs, section, key, value)
-
@classmethod
def _init_prefs(cls):
prefs = cls.__prefs
diff --git a/ibus-anthy.spec.in b/ibus-anthy.spec.in
index a6ddc70..b1d67f3 100644
--- a/ibus-anthy.spec.in
+++ b/ibus-anthy.spec.in
@@ -70,22 +70,32 @@ rm -rf $RPM_BUILD_ROOT
touch --no-create %{_datadir}/icons/hicolor || :
[ -x %{_bindir}/gtk-update-icon-cache ] && \
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+[ -x %{_bindir}/glib-compile-schemas ] && \
+[ -d %{_datadir}/glib-2.0/schemas ] && \
+ %{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%postun
# recreate icon cache
touch --no-create %{_datadir}/icons/hicolor || :
[ -x %{_bindir}/gtk-update-icon-cache ] && \
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+[ -x %{_bindir}/glib-compile-schemas ] && \
+[ -d %{_datadir}/glib-2.0/schemas ] && \
+ %{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
# %dir %{python_sitearch}/ibus
-%{_libdir}/libanthygobject-%{sub_version}.so.*
%{_libdir}/girepository-1.0/Anthy*.typelib
+%{_libdir}/libanthygobject-%{sub_version}.so.*
%{_libexecdir}/ibus-*-anthy
+%{_datadir}/appdata/*.appdata.xml
+%{_datadir}/applications/ibus-setup-anthy.desktop
+%{_datadir}/glib-2.0/schemas/org.freedesktop.ibus.engine.anthy.gschema.xml
%{_datadir}/ibus-anthy
%{_datadir}/ibus/component/*
+%{_datadir}/icons/hicolor/scalable/apps/ibus-anthy.svg
%files devel
%{_datadir}/gir-1.0/Anthy*.gir
diff --git a/po/POTFILES.in b/po/POTFILES.in
index eb75bc2..6d40da9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,11 +7,11 @@ engine/python2/factory.py
engine/python3/default.xml.in.in
engine/python3/engine.py
engine/python3/factory.py
-setup/python2/anthyprefs.py.in
+setup/python2/anthyprefs.py
setup/python2/ibus-setup-anthy.desktop.in.in
setup/python2/main.py
[type: gettext/glade]setup/python2/setup.ui
-setup/python3/anthyprefs.py.in
+setup/python3/anthyprefs.py
setup/python3/ibus-setup-anthy.desktop.in.in
setup/python3/main.py
[type: gettext/glade]setup/python3/setup.ui
diff --git a/po/ibus-anthy.pot b/po/ibus-anthy.pot
index 36b5068..4dbbe71 100644
--- a/po/ibus-anthy.pot
+++ b/po/ibus-anthy.pot
@@ -1,13 +1,13 @@
# Source translation of ibus-anthy.
# Copyright (C) 2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (C) 2009-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (C) 2009-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
# This file is distributed under the same license as the ibus-anthy package.
#
msgid ""
msgstr ""
"Project-Id-Version: ibus-anthy master\n"
"Report-Msgid-Bugs-To: https://github.com/ibus/ibus-anthy/issues\n"
-"POT-Creation-Date: 2017-03-17 13:10+0900\n"
+"POT-Creation-Date: 2017-12-25 00:18+0900\n"
"PO-Revision-Date: 2011-05-13 14:54+0900\n"
"Last-Translator: Takao Fujiwara <takao.fujiwara1@gmail.com>\n"
"Language-Team: Source\n"
@@ -36,7 +36,7 @@ msgstr ""
msgid "Anthy Input Method"
msgstr ""
-#: ../engine/python2/engine.py:207 ../engine/python3/engine.py:208
+#: ../engine/python2/engine.py:203 ../engine/python3/engine.py:204
msgid ""
"Could not enable Anthy.\n"
"The end of the content of the file .anthy/last-record2_default.utf8 in your "
@@ -44,188 +44,183 @@ msgid ""
"Please fix the file or remove it by manual and restart IBus."
msgstr ""
-#: ../engine/python2/engine.py:255 ../engine/python3/engine.py:256
-#: ../setup/python2/main.py:416 ../setup/python3/main.py:421
+#: ../engine/python2/engine.py:251 ../engine/python3/engine.py:252
+#: ../setup/python2/main.py:442 ../setup/python3/main.py:447
msgid "Preferences - Anthy"
msgstr ""
-#: ../engine/python2/engine.py:257 ../engine/python3/engine.py:258
+#: ../engine/python2/engine.py:253 ../engine/python3/engine.py:254
msgid "Configure Anthy"
msgstr ""
#. Translators: Specify the order of %s with your translation.
#. It will be "Input Mode (A)" for example.
-#: ../engine/python2/engine.py:294 ../engine/python2/engine.py:382
-#: ../engine/python2/engine.py:449 ../engine/python2/engine.py:525
-#: ../engine/python2/engine.py:856 ../engine/python2/engine.py:884
-#: ../engine/python2/engine.py:908 ../engine/python2/engine.py:934
-#: ../engine/python2/engine.py:996 ../engine/python3/engine.py:295
-#: ../engine/python3/engine.py:383 ../engine/python3/engine.py:450
-#: ../engine/python3/engine.py:526 ../engine/python3/engine.py:851
-#: ../engine/python3/engine.py:879 ../engine/python3/engine.py:903
-#: ../engine/python3/engine.py:929 ../engine/python3/engine.py:991
+#: ../engine/python2/engine.py:290 ../engine/python2/engine.py:378
+#: ../engine/python2/engine.py:445 ../engine/python2/engine.py:521
+#: ../engine/python2/engine.py:886 ../engine/python2/engine.py:917
+#: ../engine/python2/engine.py:941 ../engine/python2/engine.py:970
+#: ../engine/python2/engine.py:1032 ../engine/python3/engine.py:291
+#: ../engine/python3/engine.py:379 ../engine/python3/engine.py:446
+#: ../engine/python3/engine.py:522 ../engine/python3/engine.py:881
+#: ../engine/python3/engine.py:912 ../engine/python3/engine.py:936
+#: ../engine/python3/engine.py:965 ../engine/python3/engine.py:1027
#, python-format
msgid "%(description)s (%(symbol)s)"
msgstr ""
-#: ../engine/python2/engine.py:295 ../engine/python2/engine.py:857
-#: ../engine/python3/engine.py:296 ../engine/python3/engine.py:852
-#: ../setup/python2/main.py:401 ../setup/python3/main.py:406
+#: ../engine/python2/engine.py:291 ../engine/python2/engine.py:887
+#: ../engine/python3/engine.py:292 ../engine/python3/engine.py:882
+#: ../setup/python2/main.py:427 ../setup/python3/main.py:432
msgid "Input mode"
msgstr ""
-#: ../engine/python2/engine.py:301 ../engine/python3/engine.py:302
+#: ../engine/python2/engine.py:297 ../engine/python3/engine.py:298
msgid "Switch input mode"
msgstr ""
-#: ../engine/python2/engine.py:311 ../engine/python3/engine.py:312
+#: ../engine/python2/engine.py:307 ../engine/python3/engine.py:308
#: ../setup/python2/setup.ui.h:1 ../setup/python3/setup.ui.h:1
msgid "Hiragana"
msgstr ""
-#: ../engine/python2/engine.py:320 ../engine/python3/engine.py:321
+#: ../engine/python2/engine.py:316 ../engine/python3/engine.py:317
#: ../setup/python2/setup.ui.h:2 ../setup/python3/setup.ui.h:2
msgid "Katakana"
msgstr ""
-#: ../engine/python2/engine.py:329 ../engine/python3/engine.py:330
+#: ../engine/python2/engine.py:325 ../engine/python3/engine.py:326
#: ../setup/python2/setup.ui.h:3 ../setup/python3/setup.ui.h:3
msgid "Halfwidth Katakana"
msgstr ""
-#: ../engine/python2/engine.py:338 ../engine/python3/engine.py:339
+#: ../engine/python2/engine.py:334 ../engine/python3/engine.py:335
#: ../setup/python2/setup.ui.h:4 ../setup/python3/setup.ui.h:4
msgid "Latin"
msgstr ""
-#: ../engine/python2/engine.py:347 ../engine/python3/engine.py:348
+#: ../engine/python2/engine.py:343 ../engine/python3/engine.py:344
#: ../setup/python2/setup.ui.h:5 ../setup/python3/setup.ui.h:5
msgid "Wide Latin"
msgstr ""
-#: ../engine/python2/engine.py:383 ../engine/python2/engine.py:885
-#: ../engine/python2/engine.py:909 ../engine/python3/engine.py:384
-#: ../engine/python3/engine.py:880 ../engine/python3/engine.py:904
-#: ../setup/python2/main.py:404 ../setup/python3/main.py:409
+#: ../engine/python2/engine.py:379 ../engine/python2/engine.py:918
+#: ../engine/python2/engine.py:942 ../engine/python3/engine.py:380
+#: ../engine/python3/engine.py:913 ../engine/python3/engine.py:937
+#: ../setup/python2/main.py:430 ../setup/python3/main.py:435
msgid "Typing method"
msgstr ""
-#: ../engine/python2/engine.py:389 ../engine/python3/engine.py:390
+#: ../engine/python2/engine.py:385 ../engine/python3/engine.py:386
msgid "Switch typing method"
msgstr ""
-#: ../engine/python2/engine.py:399 ../engine/python3/engine.py:400
+#: ../engine/python2/engine.py:395 ../engine/python3/engine.py:396
#: ../setup/python2/setup.ui.h:12 ../setup/python3/setup.ui.h:12
msgid "Romaji"
msgstr ""
-#: ../engine/python2/engine.py:408 ../engine/python3/engine.py:409
+#: ../engine/python2/engine.py:404 ../engine/python3/engine.py:405
#: ../setup/python2/setup.ui.h:13 ../setup/python3/setup.ui.h:13
msgid "Kana"
msgstr ""
-#: ../engine/python2/engine.py:417 ../engine/python3/engine.py:418
+#: ../engine/python2/engine.py:413 ../engine/python3/engine.py:414
#: ../setup/python2/setup.ui.h:14 ../setup/python3/setup.ui.h:14
msgid "Thumb shift"
msgstr ""
-#: ../engine/python2/engine.py:450 ../engine/python2/engine.py:935
-#: ../engine/python3/engine.py:451 ../engine/python3/engine.py:930
-#: ../setup/python2/main.py:407 ../setup/python3/main.py:412
+#: ../engine/python2/engine.py:446 ../engine/python2/engine.py:971
+#: ../engine/python3/engine.py:447 ../engine/python3/engine.py:966
+#: ../setup/python2/main.py:433 ../setup/python3/main.py:438
msgid "Segment mode"
msgstr ""
-#: ../engine/python2/engine.py:456 ../engine/python3/engine.py:457
+#: ../engine/python2/engine.py:452 ../engine/python3/engine.py:453
msgid "Switch conversion mode"
msgstr ""
-#: ../engine/python2/engine.py:466 ../engine/python3/engine.py:467
+#: ../engine/python2/engine.py:462 ../engine/python3/engine.py:463
#: ../setup/python2/setup.ui.h:15 ../setup/python3/setup.ui.h:15
msgid "Multiple segment"
msgstr ""
-#: ../engine/python2/engine.py:475 ../engine/python3/engine.py:476
+#: ../engine/python2/engine.py:471 ../engine/python3/engine.py:472
#: ../setup/python2/setup.ui.h:16 ../setup/python3/setup.ui.h:16
msgid "Single segment"
msgstr ""
-#: ../engine/python2/engine.py:484 ../engine/python3/engine.py:485
+#: ../engine/python2/engine.py:480 ../engine/python3/engine.py:481
#: ../setup/python2/setup.ui.h:17 ../setup/python3/setup.ui.h:17
msgid "Immediate conversion (multiple segment)"
msgstr ""
-#: ../engine/python2/engine.py:493 ../engine/python3/engine.py:494
+#: ../engine/python2/engine.py:489 ../engine/python3/engine.py:490
#: ../setup/python2/setup.ui.h:18 ../setup/python3/setup.ui.h:18
msgid "Immediate conversion (single segment)"
msgstr ""
-#: ../engine/python2/engine.py:526 ../engine/python2/engine.py:997
-#: ../engine/python3/engine.py:527 ../engine/python3/engine.py:992
-#: ../setup/python2/main.py:410 ../setup/python3/main.py:415
+#: ../engine/python2/engine.py:522 ../engine/python2/engine.py:1033
+#: ../engine/python3/engine.py:523 ../engine/python3/engine.py:1028
+#: ../setup/python2/main.py:436 ../setup/python3/main.py:441
msgid "Dictionary mode"
msgstr ""
-#: ../engine/python2/engine.py:532 ../engine/python3/engine.py:533
+#: ../engine/python2/engine.py:528 ../engine/python3/engine.py:529
msgid "Switch dictionary"
msgstr ""
-#: ../engine/python2/engine.py:615 ../engine/python3/engine.py:615
-#: ../setup/python2/main.py:413 ../setup/python3/main.py:418
+#: ../engine/python2/engine.py:618 ../engine/python3/engine.py:618
+#: ../setup/python2/main.py:439 ../setup/python3/main.py:444
msgid "Dictionary - Anthy"
msgstr ""
#. Translators: "Dic" means 'dictionary', One kanji may be good.
-#: ../engine/python2/engine.py:621 ../engine/python3/engine.py:620
+#: ../engine/python2/engine.py:624 ../engine/python3/engine.py:623
msgid "Dic"
msgstr ""
-#: ../engine/python2/engine.py:628 ../engine/python3/engine.py:627
+#: ../engine/python2/engine.py:631 ../engine/python3/engine.py:630
msgid "Configure dictionaries"
msgstr ""
-#: ../engine/python2/engine.py:638 ../engine/python3/engine.py:637
+#: ../engine/python2/engine.py:641 ../engine/python3/engine.py:640
msgid "Edit dictionaries"
msgstr ""
-#: ../engine/python2/engine.py:640 ../engine/python3/engine.py:639
+#: ../engine/python2/engine.py:643 ../engine/python3/engine.py:642
msgid "Launch the dictionary tool"
msgstr ""
-#: ../engine/python2/engine.py:647 ../engine/python3/engine.py:646
+#: ../engine/python2/engine.py:650 ../engine/python3/engine.py:649
msgid "Add words"
msgstr ""
-#: ../engine/python2/engine.py:649 ../engine/python3/engine.py:648
+#: ../engine/python2/engine.py:652 ../engine/python3/engine.py:651
msgid "Add words to the dictionary"
msgstr ""
-#: ../setup/python2/anthyprefs.py.in:1105 ../setup/python2/setup.ui.h:36
-#: ../setup/python3/anthyprefs.py.in:1098 ../setup/python3/setup.ui.h:36
+#: ../setup/python2/anthyprefs.py:336 ../setup/python2/setup.ui.h:36
+#: ../setup/python3/anthyprefs.py:329 ../setup/python3/setup.ui.h:36
msgid "General"
msgstr ""
-#: ../setup/python2/anthyprefs.py.in:1116
-#: ../setup/python3/anthyprefs.py.in:1109
+#: ../setup/python2/anthyprefs.py:337 ../setup/python3/anthyprefs.py:330
msgid "Zip Code Conversion"
msgstr ""
-#: ../setup/python2/anthyprefs.py.in:1127
-#: ../setup/python3/anthyprefs.py.in:1120
+#: ../setup/python2/anthyprefs.py:338 ../setup/python3/anthyprefs.py:331
msgid "Symbol"
msgstr ""
-#: ../setup/python2/anthyprefs.py.in:1138
-#: ../setup/python3/anthyprefs.py.in:1131
+#: ../setup/python2/anthyprefs.py:339 ../setup/python3/anthyprefs.py:332
msgid "Old Character Style"
msgstr ""
-#: ../setup/python2/anthyprefs.py.in:1148
-#: ../setup/python3/anthyprefs.py.in:1141
+#: ../setup/python2/anthyprefs.py:340 ../setup/python3/anthyprefs.py:333
msgid "Era"
msgstr ""
-#: ../setup/python2/anthyprefs.py.in:1158
-#: ../setup/python3/anthyprefs.py.in:1151
+#: ../setup/python2/anthyprefs.py:341 ../setup/python3/anthyprefs.py:334
msgid "Emoji"
msgstr ""
@@ -240,280 +235,262 @@ msgid "Set up IBus Anthy engine"
msgstr ""
#. self.__run_message_dialog needs self.__builder.
-#: ../setup/python2/main.py:133 ../setup/python3/main.py:136
+#: ../setup/python2/main.py:137 ../setup/python3/main.py:140
msgid "ibus is not running."
msgstr ""
-#: ../setup/python2/main.py:188 ../setup/python3/main.py:191
+#: ../setup/python2/main.py:199 ../setup/python3/main.py:202
msgid "Menu label"
msgstr ""
-#: ../setup/python2/main.py:207 ../setup/python3/main.py:210
+#: ../setup/python2/main.py:220 ../setup/python3/main.py:223
msgid "Command"
msgstr ""
-#: ../setup/python2/main.py:211 ../setup/python3/main.py:214
+#: ../setup/python2/main.py:224 ../setup/python3/main.py:227
msgid "Shortcut"
msgstr ""
-#: ../setup/python2/main.py:256 ../setup/python3/main.py:259
+#: ../setup/python2/main.py:269 ../setup/python3/main.py:272
msgid "Description"
msgstr ""
#. Translators: "Embd" is an abbreviation of "embedded".
-#: ../setup/python2/main.py:264 ../setup/python3/main.py:267
+#: ../setup/python2/main.py:277 ../setup/python3/main.py:280
msgid "Embd"
msgstr ""
#. Translators: "Sgl" is an abbreviation of "single".
-#: ../setup/python2/main.py:272 ../setup/python3/main.py:275
+#: ../setup/python2/main.py:285 ../setup/python3/main.py:288
msgid "Sgl"
msgstr ""
-#: ../setup/python2/main.py:447 ../setup/python2/main.py:483
-#: ../setup/python3/main.py:452 ../setup/python3/main.py:488
+#: ../setup/python2/main.py:464 ../setup/python2/main.py:491
+#: ../setup/python3/main.py:468 ../setup/python3/main.py:494
msgid "Input Chars"
msgstr ""
-#: ../setup/python2/main.py:449 ../setup/python2/main.py:485
-#: ../setup/python3/main.py:454 ../setup/python3/main.py:490
+#: ../setup/python2/main.py:466 ../setup/python2/main.py:493
+#: ../setup/python3/main.py:470 ../setup/python3/main.py:496
msgid "Output Chars"
msgstr ""
-#: ../setup/python2/main.py:531 ../setup/python3/main.py:536
+#: ../setup/python2/main.py:526 ../setup/python3/main.py:526
msgid "Input"
msgstr ""
-#: ../setup/python2/main.py:533 ../setup/python3/main.py:538
+#: ../setup/python2/main.py:528 ../setup/python3/main.py:528
msgid "Single"
msgstr ""
-#: ../setup/python2/main.py:535 ../setup/python3/main.py:540
+#: ../setup/python2/main.py:530 ../setup/python3/main.py:530
msgid "Left"
msgstr ""
-#: ../setup/python2/main.py:537 ../setup/python3/main.py:542
+#: ../setup/python2/main.py:532 ../setup/python3/main.py:532
msgid "Right"
msgstr ""
-#: ../setup/python2/main.py:619 ../setup/python3/main.py:624
+#: ../setup/python2/main.py:614 ../setup/python3/main.py:614
msgid "Customize Romaji Key Table"
msgstr ""
-#: ../setup/python2/main.py:620 ../setup/python2/setup.ui.h:54
-#: ../setup/python3/main.py:625 ../setup/python3/setup.ui.h:54
+#: ../setup/python2/main.py:615 ../setup/python2/setup.ui.h:54
+#: ../setup/python3/main.py:615 ../setup/python3/setup.ui.h:54
msgid "_Romaji Key Table:"
msgstr ""
-#: ../setup/python2/main.py:621 ../setup/python2/main.py:627
-#: ../setup/python3/main.py:626 ../setup/python3/main.py:632
+#: ../setup/python2/main.py:616 ../setup/python2/main.py:622
+#: ../setup/python3/main.py:616 ../setup/python3/main.py:622
msgid "_Output Chars"
msgstr ""
-#: ../setup/python2/main.py:622 ../setup/python2/main.py:1122
-#: ../setup/python2/main.py:1270 ../setup/python2/setup.ui.h:27
-#: ../setup/python3/main.py:627 ../setup/python3/main.py:1116
-#: ../setup/python3/main.py:1264 ../setup/python3/setup.ui.h:27
+#: ../setup/python2/main.py:617 ../setup/python2/main.py:1093
+#: ../setup/python2/main.py:1197 ../setup/python2/setup.ui.h:27
+#: ../setup/python3/main.py:617 ../setup/python3/main.py:1082
+#: ../setup/python3/main.py:1186 ../setup/python3/setup.ui.h:27
msgid "Default"
msgstr ""
-#: ../setup/python2/main.py:625 ../setup/python3/main.py:630
+#: ../setup/python2/main.py:620 ../setup/python3/main.py:620
msgid "Customize Kana Key Table"
msgstr ""
-#: ../setup/python2/main.py:626 ../setup/python2/setup.ui.h:56
-#: ../setup/python3/main.py:631 ../setup/python3/setup.ui.h:56
+#: ../setup/python2/main.py:621 ../setup/python2/setup.ui.h:56
+#: ../setup/python3/main.py:621 ../setup/python3/setup.ui.h:56
msgid "_Kana Key Table:"
msgstr ""
-#: ../setup/python2/main.py:628 ../setup/python3/main.py:633
+#: ../setup/python2/main.py:623 ../setup/python3/main.py:623
msgid "Japanese Keyboard Layout"
msgstr ""
-#: ../setup/python2/main.py:629 ../setup/python3/main.py:634
+#: ../setup/python2/main.py:624 ../setup/python3/main.py:624
msgid "U.S. Keyboard Layout"
msgstr ""
-#: ../setup/python2/main.py:632 ../setup/python3/main.py:637
+#: ../setup/python2/main.py:627 ../setup/python3/main.py:627
msgid "Customize Thumb Shift Key Table"
msgstr ""
-#: ../setup/python2/main.py:633 ../setup/python3/main.py:638
+#: ../setup/python2/main.py:628 ../setup/python3/main.py:628
msgid "_Thumb Shift Key Table:"
msgstr ""
-#: ../setup/python2/main.py:634 ../setup/python3/main.py:639
+#: ../setup/python2/main.py:629 ../setup/python3/main.py:629
msgid "Single _Output Chars"
msgstr ""
-#: ../setup/python2/main.py:635 ../setup/python3/main.py:640
+#: ../setup/python2/main.py:630 ../setup/python3/main.py:630
msgid "Base"
msgstr ""
-#: ../setup/python2/main.py:636 ../setup/python3/main.py:641
+#: ../setup/python2/main.py:631 ../setup/python3/main.py:631
msgid "NICOLA-J key extension"
msgstr ""
-#: ../setup/python2/main.py:637 ../setup/python3/main.py:642
+#: ../setup/python2/main.py:632 ../setup/python3/main.py:632
msgid "NICOLA-A key extension"
msgstr ""
-#: ../setup/python2/main.py:638 ../setup/python3/main.py:643
+#: ../setup/python2/main.py:633 ../setup/python3/main.py:633
msgid "NICOLA-F key extension"
msgstr ""
-#: ../setup/python2/main.py:639 ../setup/python3/main.py:644
+#: ../setup/python2/main.py:634 ../setup/python3/main.py:634
msgid "FMV KB231-J key extension"
msgstr ""
-#: ../setup/python2/main.py:640 ../setup/python3/main.py:645
+#: ../setup/python2/main.py:635 ../setup/python3/main.py:635
msgid "FMV KB231-A key extension"
msgstr ""
-#: ../setup/python2/main.py:641 ../setup/python3/main.py:646
+#: ../setup/python2/main.py:636 ../setup/python3/main.py:636
msgid "FMV KB231-F key extension"
msgstr ""
-#: ../setup/python2/main.py:642 ../setup/python3/main.py:647
+#: ../setup/python2/main.py:637 ../setup/python3/main.py:637
msgid "FMV KB611-J key extension"
msgstr ""
-#: ../setup/python2/main.py:643 ../setup/python3/main.py:648
+#: ../setup/python2/main.py:638 ../setup/python3/main.py:638
msgid "FMV KB611-A key extension"
msgstr ""
-#: ../setup/python2/main.py:644 ../setup/python3/main.py:649
+#: ../setup/python2/main.py:639 ../setup/python3/main.py:639
msgid "FMV KB611-F key extension"
msgstr ""
-#: ../setup/python2/main.py:788 ../setup/python3/main.py:793
+#: ../setup/python2/main.py:775 ../setup/python3/main.py:775
msgid "Your choosed file has already been added: "
msgstr ""
-#: ../setup/python2/main.py:792 ../setup/python3/main.py:797
+#: ../setup/python2/main.py:779 ../setup/python3/main.py:779
msgid "The file you have chosen does not exist: "
msgstr ""
-#: ../setup/python2/main.py:796 ../setup/python3/main.py:801
+#: ../setup/python2/main.py:783 ../setup/python3/main.py:783
msgid "Your choosed file is a directory: "
msgstr ""
-#: ../setup/python2/main.py:800 ../setup/python3/main.py:805
+#: ../setup/python2/main.py:787 ../setup/python3/main.py:787
msgid "You cannot add dictionaries in the anthy private directory: "
msgstr ""
-#: ../setup/python2/main.py:807 ../setup/python3/main.py:812
+#: ../setup/python2/main.py:796 ../setup/python3/main.py:796
msgid "Your file path is not good: "
msgstr ""
-#: ../setup/python2/main.py:986 ../setup/python3/main.py:989
+#: ../setup/python2/main.py:957 ../setup/python3/main.py:955
msgid "The engine xml file does not exist: "
msgstr ""
-#: ../setup/python2/main.py:1102 ../setup/python3/main.py:1096
+#: ../setup/python2/main.py:1073 ../setup/python3/main.py:1062
msgid ""
"Anthy keyboard layout is changed. Please restart ibus to reload the layout."
msgstr ""
-#: ../setup/python2/main.py:1231 ../setup/python3/main.py:1225
-msgid "Confirmation"
-msgstr ""
-
-#: ../setup/python2/main.py:1233 ../setup/python3/main.py:1227
-msgid "You are about to close the setup dialog, is that OK?"
-msgstr ""
-
-#: ../setup/python2/main.py:1248 ../setup/python3/main.py:1242
-msgid "Notice!"
-msgstr ""
-
-#: ../setup/python2/main.py:1250 ../setup/python3/main.py:1244
-msgid ""
-"You are about to close the setup dialog without saving your changes, is that "
-"OK?"
-msgstr ""
-
-#: ../setup/python2/main.py:1371 ../setup/python3/main.py:1365
+#: ../setup/python2/main.py:1285 ../setup/python3/main.py:1274
msgid "Please specify Input Chars"
msgstr ""
-#: ../setup/python2/main.py:1374 ../setup/python3/main.py:1368
+#: ../setup/python2/main.py:1288 ../setup/python3/main.py:1277
msgid "Please specify Output Chars"
msgstr ""
-#: ../setup/python2/main.py:1377 ../setup/python3/main.py:1371
+#: ../setup/python2/main.py:1291 ../setup/python3/main.py:1280
msgid "Please specify Left Thumb Shift Chars"
msgstr ""
-#: ../setup/python2/main.py:1380 ../setup/python3/main.py:1374
+#: ../setup/python2/main.py:1294 ../setup/python3/main.py:1283
msgid "Please specify Right Thumb Shift Chars"
msgstr ""
-#: ../setup/python2/main.py:1393 ../setup/python2/main.py:1437
-#: ../setup/python3/main.py:1387 ../setup/python3/main.py:1431
+#: ../setup/python2/main.py:1307 ../setup/python2/main.py:1341
+#: ../setup/python3/main.py:1296 ../setup/python3/main.py:1330
msgid "Your custom key is not assigned in any sections. Maybe a bug."
msgstr ""
-#: ../setup/python2/main.py:1503 ../setup/python2/main.py:1590
-#: ../setup/python3/main.py:1497 ../setup/python3/main.py:1584
+#: ../setup/python2/main.py:1396 ../setup/python2/main.py:1485
+#: ../setup/python3/main.py:1385 ../setup/python3/main.py:1474
msgid "Your file does not exist: "
msgstr ""
-#: ../setup/python2/main.py:1513 ../setup/python3/main.py:1507
+#: ../setup/python2/main.py:1406 ../setup/python3/main.py:1395
msgid "Open Dictionary File"
msgstr ""
-#: ../setup/python2/main.py:1516 ../setup/python2/main.py:1522
-#: ../setup/python2/setup.ui.h:90 ../setup/python3/main.py:1510
-#: ../setup/python3/main.py:1516 ../setup/python3/setup.ui.h:90
+#: ../setup/python2/main.py:1409 ../setup/python2/main.py:1415
+#: ../setup/python2/setup.ui.h:97 ../setup/python3/main.py:1398
+#: ../setup/python3/main.py:1404 ../setup/python3/setup.ui.h:97
msgid "_Cancel"
msgstr ""
-#: ../setup/python2/main.py:1517 ../setup/python3/main.py:1511
+#: ../setup/python2/main.py:1410 ../setup/python3/main.py:1399
msgid "_Open"
msgstr ""
-#: ../setup/python2/main.py:1520 ../setup/python3/main.py:1514
+#: ../setup/python2/main.py:1413 ../setup/python3/main.py:1402
msgid "Edit Dictionary File"
msgstr ""
-#: ../setup/python2/main.py:1523 ../setup/python2/main.py:1618
-#: ../setup/python2/setup.ui.h:91 ../setup/python3/main.py:1517
-#: ../setup/python3/main.py:1612 ../setup/python3/setup.ui.h:91
+#: ../setup/python2/main.py:1416 ../setup/python2/main.py:1505
+#: ../setup/python2/setup.ui.h:98 ../setup/python3/main.py:1405
+#: ../setup/python3/main.py:1494 ../setup/python3/setup.ui.h:98
msgid "_OK"
msgstr ""
-#: ../setup/python2/main.py:1534 ../setup/python3/main.py:1528
+#: ../setup/python2/main.py:1427 ../setup/python3/main.py:1416
msgid "Your choosed file is not correct."
msgstr ""
-#: ../setup/python2/main.py:1563 ../setup/python3/main.py:1557
+#: ../setup/python2/main.py:1457 ../setup/python3/main.py:1446
msgid "You cannot delete the system dictionary."
msgstr ""
-#: ../setup/python2/main.py:1586 ../setup/python3/main.py:1580
+#: ../setup/python2/main.py:1481 ../setup/python3/main.py:1470
msgid "Your file is not good."
msgstr ""
-#: ../setup/python2/main.py:1616 ../setup/python3/main.py:1610
+#: ../setup/python2/main.py:1503 ../setup/python3/main.py:1492
msgid "View Dictionary File"
msgstr ""
-#: ../setup/python2/main.py:1787 ../setup/python3/main.py:1781
+#: ../setup/python2/main.py:1664 ../setup/python3/main.py:1653
msgid "Please press a key (or a key combination)"
msgstr ""
-#: ../setup/python2/main.py:1788 ../setup/python3/main.py:1782
+#: ../setup/python2/main.py:1665 ../setup/python3/main.py:1654
msgid "The dialog will be closed when the key is released"
msgstr ""
-#: ../setup/python2/main.py:1808 ../setup/python2/main.py:1829
-#: ../setup/python3/main.py:1802 ../setup/python3/main.py:1823
+#: ../setup/python2/main.py:1685 ../setup/python2/main.py:1706
+#: ../setup/python3/main.py:1674 ../setup/python3/main.py:1695
msgid "Invalid keysym"
msgstr ""
-#: ../setup/python2/main.py:1809 ../setup/python2/main.py:1830
-#: ../setup/python3/main.py:1803 ../setup/python3/main.py:1824
+#: ../setup/python2/main.py:1686 ../setup/python2/main.py:1707
+#: ../setup/python3/main.py:1675 ../setup/python3/main.py:1696
msgid "This keysym is not valid"
msgstr ""
@@ -815,34 +792,34 @@ msgid "About"
msgstr ""
#: ../setup/python2/setup.ui.h:89 ../setup/python3/setup.ui.h:89
-msgid "_Apply"
+msgid "_Close"
msgstr ""
-#: ../setup/python2/setup.ui.h:92 ../setup/python3/setup.ui.h:92
+#: ../setup/python2/setup.ui.h:90 ../setup/python3/setup.ui.h:90
msgid "Edit Shortcut"
msgstr ""
-#: ../setup/python2/setup.ui.h:93 ../setup/python3/setup.ui.h:93
+#: ../setup/python2/setup.ui.h:91 ../setup/python3/setup.ui.h:91
msgid "Key Code:"
msgstr ""
-#: ../setup/python2/setup.ui.h:94 ../setup/python3/setup.ui.h:94
+#: ../setup/python2/setup.ui.h:92 ../setup/python3/setup.ui.h:92
msgid "Modifier:"
msgstr ""
-#: ../setup/python2/setup.ui.h:95 ../setup/python3/setup.ui.h:95
+#: ../setup/python2/setup.ui.h:93 ../setup/python3/setup.ui.h:93
msgid "A_lternate"
msgstr ""
-#: ../setup/python2/setup.ui.h:96 ../setup/python3/setup.ui.h:96
+#: ../setup/python2/setup.ui.h:94 ../setup/python3/setup.ui.h:94
msgid "Co_ntrol"
msgstr ""
-#: ../setup/python2/setup.ui.h:97 ../setup/python3/setup.ui.h:97
+#: ../setup/python2/setup.ui.h:95 ../setup/python3/setup.ui.h:95
msgid "_Shift"
msgstr ""
-#: ../setup/python2/setup.ui.h:98 ../setup/python3/setup.ui.h:98
+#: ../setup/python2/setup.ui.h:96 ../setup/python3/setup.ui.h:96
msgid "_Refresh"
msgstr ""
@@ -867,33 +844,29 @@ msgid "_Remove"
msgstr ""
#: ../setup/python2/setup.ui.h:104 ../setup/python3/setup.ui.h:104
-msgid "_Close"
-msgstr ""
-
-#: ../setup/python2/setup.ui.h:105 ../setup/python3/setup.ui.h:105
msgid "_Short Label:"
msgstr ""
-#: ../setup/python2/setup.ui.h:106 ../setup/python3/setup.ui.h:106
+#: ../setup/python2/setup.ui.h:105 ../setup/python3/setup.ui.h:105
msgid "_Description:"
msgstr ""
-#: ../setup/python2/setup.ui.h:107 ../setup/python3/setup.ui.h:107
+#: ../setup/python2/setup.ui.h:106 ../setup/python3/setup.ui.h:106
msgid "_Use your dictionary alone with switching dictionaries"
msgstr ""
-#: ../setup/python2/setup.ui.h:108 ../setup/python3/setup.ui.h:108
+#: ../setup/python2/setup.ui.h:107 ../setup/python3/setup.ui.h:107
msgid "_Embed your dictionary in the system dictionary"
msgstr ""
-#: ../setup/python2/setup.ui.h:109 ../setup/python3/setup.ui.h:109
+#: ../setup/python2/setup.ui.h:108 ../setup/python3/setup.ui.h:108
msgid "Enable the _reverse conversion"
msgstr ""
-#: ../setup/python2/setup.ui.h:110 ../setup/python3/setup.ui.h:110
+#: ../setup/python2/setup.ui.h:109 ../setup/python3/setup.ui.h:109
msgid "The Anthy engine for the IBus input platform"
msgstr ""
-#: ../setup/python2/setup.ui.h:111 ../setup/python3/setup.ui.h:111
+#: ../setup/python2/setup.ui.h:110 ../setup/python3/setup.ui.h:110
msgid "translator_credits"
msgstr ""
diff --git a/setup/python2/Makefile.am b/setup/python2/Makefile.am
index 948f0a8..4e072e9 100644
--- a/setup/python2/Makefile.am
+++ b/setup/python2/Makefile.am
@@ -4,8 +4,8 @@
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +37,6 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
BUILT_SOURCES = \
_config.py \
- anthyprefs.py \
$(NULL)
libexec_SCRIPTS = ibus-setup-anthy
@@ -82,15 +81,6 @@ ibus-setup-anthy: ibus-setup-anthy.in
-e "s|\@PYTHON\@|$(PYTHON)|g" \
$< > $@
-anthyprefs.py: anthyprefs.py.in
- sed -e "s|\@ANTHY_ZIPCODE_FILE\@|$(ANTHY_ZIPCODE_FILE)|g" \
- -e "s|\@KASUMI_EXEC_FILE\@|$(KASUMI_EXEC_FILE)|g" \
- -e "s|\@KASUMI_ICON_FILE\@|$(KASUMI_ICON_FILE)|g" \
- -e "s|\@ON_OFF_KEYS\@|$(ON_OFF_KEYS)|g" \
- -e "s|\@VERSION\@|$(VERSION)|g" \
- -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" \
- $< > $@
-
_config.py: _config.py.in
sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" \
-e "s|\@libexecdir\@|$(libexecdir)|g" \
@@ -98,6 +88,7 @@ _config.py: _config.py.in
-e "s|\@LAYOUT\@|$(LAYOUT)|g" \
-e "s|\@SYMBOL_CHAR_INT\@|$(SYMBOL_CHAR_INT)|g" \
-e "s|\@ICON_PREFERENCE\@|$(ICON_PREFERENCE)|g" \
+ -e "s|\@VERSION\@|$(VERSION)|g" \
$< > $@
# Need a time lag between .py and .py.in files to build .py files
diff --git a/setup/python2/anthyprefs.py b/setup/python2/anthyprefs.py
new file mode 100644
index 0000000..5e3bade
--- /dev/null
+++ b/setup/python2/anthyprefs.py
@@ -0,0 +1,342 @@
+# -*- coding: utf-8 -*-
+# vim:set noet ts=4:
+#
+# ibus-anthy - The Anthy engine for IBus
+#
+# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
+# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import sys
+
+import _config as config
+from prefs import Prefs
+
+N_ = lambda a : a
+
+__all__ = ['AnthyPrefs']
+
+
+class AnthyPrefs(Prefs):
+ _char_to_config_key = None
+
+ def __init__(self):
+ super(AnthyPrefs, self).__init__()
+
+ def get_japanese_ordered_list(self):
+ return _japanese_ordered_list
+
+ def get_version(self):
+ return config.VERSION
+
+ # Convert gsettings key to typing sequences
+ # E.g. 'largea-bracketleft' to 'A['
+ def typing_from_config_key(self, gkeys):
+ retval = ''
+ for key in gkeys.split('-'):
+ if key in _supported_gsettings_key_chars:
+ retval += key
+ continue
+ try:
+ ch = _config_key_to_char[key]
+ except KeyError:
+ print >> sys.stderr, 'Not supported key in gsettings', gkeys
+ retval = ''
+ break
+ retval += ch
+ return retval
+
+ # Convert typing sequences to gsettings key.
+ # E.g. 'A[' to 'largea-bracketleft'
+ def typing_to_config_key(self, typing):
+ retval = ''
+ if self._char_to_config_key == None:
+ self._char_to_config_key = {}
+ for _key, _ch in _config_key_to_char.items():
+ self._char_to_config_key[_ch] = _key
+ for ch in typing:
+ try:
+ # U+A5 needs to be UTF-8 since gconf values are
+ # disk saved values.
+ ch = ch.encode('utf-8')
+ except:
+ print >> sys.stderr, \
+ 'Failed to encode UTF-8:', ch
+ if ch in _supported_gsettings_key_chars:
+ if retval != '':
+ retval += '-'
+ retval += ch
+ continue
+ try:
+ key = self._char_to_config_key[ch]
+ except KeyError:
+ print >> sys.stderr, 'Not supported key in gsettings', typing
+ retval = ''
+ break
+ if retval != '':
+ retval += '-'
+ retval += key
+ return retval
+
+ def get_value(self, section, key):
+ not_sorted = super(AnthyPrefs, self).get_value(section, key)
+ if section == 'shortcut' and type(not_sorted) == dict:
+ retval = dict.fromkeys(_cmd_keys, [])
+ retval.update(not_sorted)
+ return retval
+ return not_sorted
+
+
+# Sad! dict.keys() doesn't return the saved order.
+# locale.strcoll() also just returns the Unicode code point.
+# Unicode order is wrong in Japanese large 'a' and small 'a'.
+# The workaround is to save the order here...
+_japanese_ordered_list = [
+ 'あ', 'い', 'う', 'え', 'お',
+ 'ぁ', 'ぃ', 'ぅ', 'ぇ', 'ぉ',
+ 'いぇ',
+ 'うぁ', 'うぃ', 'うぅ', 'うぇ', 'うぉ',
+ 'うゃ', 'うゅ', 'うょ',
+ 'か', 'き', 'く', 'け', 'こ',
+ 'ゕ', 'ゖ', 'ヵ', 'ヶ',
+ 'が', 'ぎ', 'ぐ', 'げ', 'ご',
+ 'きゃ', 'きぃ', 'きゅ', 'きぇ', 'きょ',
+ 'くぁ', 'くぃ', 'くぅ', 'くぇ', 'くぉ',
+ 'ぎゃ', 'ぎぃ', 'ぎゅ', 'ぎぇ', 'ぎょ',
+ 'ぐぁ', 'ぐぃ', 'ぐぅ', 'ぐぇ', 'ぐぉ',
+ 'さ', 'し', 'す', 'せ', 'そ',
+ 'ざ', 'じ', 'ず', 'ぜ', 'ぞ',
+ 'しゃ', 'しぃ', 'しゅ', 'しぇ', 'しょ',
+ 'じゃ', 'じぃ', 'じゅ', 'じぇ', 'じょ',
+ 'すぅぃ', 'すぇ',
+ 'ずぇ',
+ 'た', 'ち', 'つ', 'て', 'と',
+ 'だ', 'ぢ', 'づ', 'で', 'ど',
+ 'っ',
+ 'ちゃ', 'ちぃ', 'ちゅ', 'ちぇ', 'ちょ',
+ 'ぢぃ', 'ぢぇ',
+ 'ぢゃ', 'ぢゅ', 'ぢょ',
+ 'つぁ', 'つぃ', 'つぇ', 'つぉ',
+ 'つゃ', 'つぃぇ', 'つゅ', 'つょ',
+ 'づぁ', 'づぃ', 'づぇ', 'づぉ',
+ 'づゃ', 'づぃぇ', 'づゅ', 'づょ',
+ 'てぃ', 'てぇ',
+ 'てゃ', 'てゅ', 'てょ',
+ 'とぅ',
+ 'でぃ', 'でぇ',
+ 'でゃ', 'でゅ', 'でょ',
+ 'どぅ',
+ 'な', 'に', 'ぬ', 'ね', 'の',
+ 'にぃ', 'にぇ',
+ 'にゃ', 'にゅ', 'にょ',
+ 'は', 'ひ', 'ふ', 'へ', 'ほ',
+ 'ば', 'び', 'ぶ', 'べ', 'ぼ',
+ 'ぱ', 'ぴ', 'ぷ', 'ぺ', 'ぽ',
+ 'ひぃ', 'ひぇ',
+ 'ひゃ', 'ひゅ', 'ひょ',
+ 'びぃ', 'びぇ',
+ 'びゃ', 'びゅ', 'びょ',
+ 'ぴぃ', 'ぴぇ',
+ 'ぴゃ', 'ぴゅ', 'ぴょ',
+ 'ふぁ', 'ふぃ', 'ふぇ', 'ふぉ',
+ 'ふゃ', 'ふゅ', 'ふょ',
+ 'ぶぁ', 'ぶぇ', 'ぶぉ',
+ 'ぷぁ', 'ぷぇ', 'ぷぉ',
+ 'ま', 'み', 'む', 'め', 'も',
+ 'みぃ', 'みぇ',
+ 'みゃ', 'みゅ', 'みょ',
+ 'や', 'ゆ', 'よ',
+ 'ゃ', 'ゅ', 'ょ',
+ 'ら', 'り', 'る', 'れ', 'ろ',
+ 'りぃ', 'りぇ',
+ 'りゃ', 'りゅ', 'りょ',
+ 'わ', 'を', 'ん',
+ 'ゎ',
+ 'ゐ', 'ゑ',
+ 'ー',
+ 'ヴぁ', 'ヴぃ', 'ヴ', 'ヴぇ', 'ヴぉ',
+ 'ヴゃ', 'ヴぃぇ', 'ヴゅ', 'ヴょ',
+]
+
+# http://git.gnome.org/browse/glib/tree/gio/glib-compile-schemas.c#n765
+# gsettings supports keys named by "abcdefghijklmnopqrstuvwxyz0123456789-"
+# and ibus-anthy uses '-' as the delimiter.
+_supported_gsettings_key_chars = "abcdefghijklmnopqrstuvwxyz0123456789"
+
+_config_key_to_char = {
+ # no modifiers keys
+ 'minus' : '-',
+ 'asciicircum' : '^',
+ 'at' : '@',
+ 'bracketleft' : '[',
+ 'semicolon' : ';',
+ 'colon' : ':',
+ 'bracketright' : ']',
+ 'comma' : ',',
+ 'period' : '.',
+ 'slash' : '/',
+ 'backslash' : '\\',
+
+ # shift modifiered keys
+ 'exclam' : '!',
+ 'quotedbl' : '"',
+ 'numbersign' : '#',
+ 'dollar' : '$',
+ 'percent' : '%',
+ 'ampersand' : '&',
+ 'apostrophe' : '\'',
+ 'parenleft' : '(',
+ 'parenright' : ')',
+ 'asciitilde' : '~',
+ 'equal' : '=',
+ 'bar' : '|',
+
+ 'largeq' : 'Q',
+ 'largew' : 'W',
+ 'largee' : 'E',
+ 'larger' : 'R',
+ 'larget' : 'T',
+ 'largey' : 'Y',
+ 'largeu' : 'U',
+ 'largei' : 'I',
+ 'largeo' : 'O',
+ 'largep' : 'P',
+ 'grave' : '`',
+
+ 'braceleft' : '{',
+
+ 'largea' : 'A',
+ 'larges' : 'S',
+ 'larged' : 'D',
+ 'largef' : 'F',
+ 'largeg' : 'G',
+ 'largeh' : 'H',
+ 'largej' : 'J',
+ 'largek' : 'K',
+ 'largel' : 'L',
+ 'plus' : '+',
+ 'asterisk' : '*',
+
+ 'braceright' : '}',
+
+ 'largez' : 'Z',
+ 'largex' : 'X',
+ 'largec' : 'C',
+ 'largev' : 'V',
+ 'largeb' : 'B',
+ 'largen' : 'N',
+ 'largem' : 'M',
+ 'less' : '<',
+ 'greater' : '>',
+
+ 'question' : '?',
+ 'underscore' : '_',
+
+ 'yen' : '¥',
+}
+
+_cmd_keys = [
+ 'on_off',
+ 'circle_input_mode',
+ 'circle_kana_mode',
+ 'circle_typing_method',
+ 'circle_dict_method',
+ 'latin_mode',
+ 'wide_latin_mode',
+ 'hiragana_mode',
+ 'katakana_mode',
+ 'half_katakana_mode',
+# 'cancel_pseudo_ascii_mode_key',
+
+ 'hiragana_for_latin_with_shift',
+
+ 'insert_space',
+ 'insert_alternate_space',
+ 'insert_half_space',
+ 'insert_wide_space',
+ 'backspace',
+ 'delete',
+ 'commit',
+ 'convert',
+ 'predict',
+ 'cancel',
+ 'cancel_all',
+ 'reconvert',
+# 'do_nothing',
+
+ 'select_first_candidate',
+ 'select_last_candidate',
+ 'select_next_candidate',
+ 'select_prev_candidate',
+ 'candidates_page_up',
+ 'candidates_page_down',
+
+ 'move_caret_first',
+ 'move_caret_last',
+ 'move_caret_forward',
+ 'move_caret_backward',
+
+ 'select_first_segment',
+ 'select_last_segment',
+ 'select_next_segment',
+ 'select_prev_segment',
+ 'shrink_segment',
+ 'expand_segment',
+ 'commit_first_segment',
+ 'commit_selected_segment',
+
+ 'select_candidates_1',
+ 'select_candidates_2',
+ 'select_candidates_3',
+ 'select_candidates_4',
+ 'select_candidates_5',
+ 'select_candidates_6',
+ 'select_candidates_7',
+ 'select_candidates_8',
+ 'select_candidates_9',
+ 'select_candidates_0',
+
+ 'convert_to_char_type_forward',
+ 'convert_to_char_type_backward',
+ 'convert_to_hiragana',
+ 'convert_to_katakana',
+ 'convert_to_half',
+ 'convert_to_half_katakana',
+ 'convert_to_wide_latin',
+ 'convert_to_latin',
+ 'convert_to_hiragana_all',
+ 'convert_to_katakana_all',
+ 'convert_to_half_all',
+ 'convert_to_half_katakana_all',
+ 'convert_to_wide_latin_all',
+ 'convert_to_latin_all',
+
+ 'dict_admin',
+ 'add_word',
+
+ 'start_setup',
+]
+
+_dummy_translatable_strings = [
+ N_('General'),
+ N_('Zip Code Conversion'),
+ N_('Symbol'),
+ N_('Old Character Style'),
+ N_('Era'),
+ N_('Emoji'),
+]
diff --git a/setup/python2/anthyprefs.py.in b/setup/python2/anthyprefs.py.in
deleted file mode 100644
index f232879..0000000
--- a/setup/python2/anthyprefs.py.in
+++ /dev/null
@@ -1,1368 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim:set noet ts=4:
-#
-# ibus-anthy - The Anthy engine for IBus
-#
-# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2015 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2015 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-import sys
-
-from prefs import Prefs
-
-N_ = lambda a : a
-
-__all__ = ['AnthyPrefs']
-
-
-class AnthyPrefs(Prefs):
- _prefix = 'engine/anthy'
- _char_to_config_key = None
-
- def __init__(self, bus=None, config=None):
- super(AnthyPrefs, self).__init__(bus, config)
- if _config != None:
- self.default = _config
- self.set_no_key_warning(True)
- self.fetch_all()
- self.set_no_key_warning(False)
-
- def __update_key (self, section, old_key, new_key):
- file = __file__
- if __file__.find('/') >= 0:
- file = __file__[__file__.rindex('/') + 1:]
- 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
- return self.default[section].keys()
-
- def get_japanese_ordered_list(self):
- return _japanese_ordered_list
-
- def get_version(self):
- return '@VERSION@'
-
- # Convert typing sequences to gsettings key.
- # E.g. 'largea-bracketleft' to 'A['
- def typing_from_config_key(self, gkeys):
- retval = ''
- for key in gkeys.split('-'):
- if key in _supported_gsettings_key_chars:
- retval += key
- continue
- try:
- ch = _config_key_to_char[key]
- except KeyError:
- print >> sys.stderr, 'Not supported key in gsettings', gkeys
- retval = ''
- break
- retval += ch
- return retval
-
- # Convert typing sequences to gsettings key.
- # E.g. 'A[' to 'largea-bracketleft'
- def typing_to_config_key(self, typing):
- retval = ''
- if self._char_to_config_key == None:
- self._char_to_config_key = {}
- for _key, _ch in _config_key_to_char.items():
- self._char_to_config_key[_ch] = _key
- for ch in typing:
- try:
- # U+A5 needs to be UTF-8 since gconf values are
- # disk saved values.
- ch = ch.encode('utf-8')
- except:
- print >> sys.stderr, \
- 'Failed to encode UTF-8:', ch
- if ch in _supported_gsettings_key_chars:
- if retval != '':
- retval += '-'
- retval += ch
- continue
- try:
- key = self._char_to_config_key[ch]
- except KeyError:
- print >> sys.stderr, 'Not supported key in gsettings', typing
- retval = ''
- break
- if retval != '':
- retval += '-'
- retval += key
- return retval
-
-# Sad! dict.keys() doesn't return the saved order.
-# locale.strcoll() also just returns the Unicode code point.
-# Unicode order is wrong in Japanese large 'a' and small 'a'.
-# The workaround is to save the order here...
-_japanese_ordered_list = [
- 'あ', 'い', 'う', 'え', 'お',
- 'ぁ', 'ぃ', 'ぅ', 'ぇ', 'ぉ',
- 'いぇ',
- 'うぁ', 'うぃ', 'うぅ', 'うぇ', 'うぉ',
- 'うゃ', 'うゅ', 'うょ',
- 'か', 'き', 'く', 'け', 'こ',
- 'ゕ', 'ゖ', 'ヵ', 'ヶ',
- 'が', 'ぎ', 'ぐ', 'げ', 'ご',
- 'きゃ', 'きぃ', 'きゅ', 'きぇ', 'きょ',
- 'くぁ', 'くぃ', 'くぅ', 'くぇ', 'くぉ',
- 'ぎゃ', 'ぎぃ', 'ぎゅ', 'ぎぇ', 'ぎょ',
- 'ぐぁ', 'ぐぃ', 'ぐぅ', 'ぐぇ', 'ぐぉ',
- 'さ', 'し', 'す', 'せ', 'そ',
- 'ざ', 'じ', 'ず', 'ぜ', 'ぞ',
- 'しゃ', 'しぃ', 'しゅ', 'しぇ', 'しょ',
- 'じゃ', 'じぃ', 'じゅ', 'じぇ', 'じょ',
- 'すぅぃ', 'すぇ',
- 'ずぇ',
- 'た', 'ち', 'つ', 'て', 'と',
- 'だ', 'ぢ', 'づ', 'で', 'ど',
- 'っ',
- 'ちゃ', 'ちぃ', 'ちゅ', 'ちぇ', 'ちょ',
- 'ぢぃ', 'ぢぇ',
- 'ぢゃ', 'ぢゅ', 'ぢょ',
- 'つぁ', 'つぃ', 'つぇ', 'つぉ',
- 'つゃ', 'つぃぇ', 'つゅ', 'つょ',
- 'づぁ', 'づぃ', 'づぇ', 'づぉ',
- 'づゃ', 'づぃぇ', 'づゅ', 'づょ',
- 'てぃ', 'てぇ',
- 'てゃ', 'てゅ', 'てょ',
- 'とぅ',
- 'でぃ', 'でぇ',
- 'でゃ', 'でゅ', 'でょ',
- 'どぅ',
- 'な', 'に', 'ぬ', 'ね', 'の',
- 'にぃ', 'にぇ',
- 'にゃ', 'にゅ', 'にょ',
- 'は', 'ひ', 'ふ', 'へ', 'ほ',
- 'ば', 'び', 'ぶ', 'べ', 'ぼ',
- 'ぱ', 'ぴ', 'ぷ', 'ぺ', 'ぽ',
- 'ひぃ', 'ひぇ',
- 'ひゃ', 'ひゅ', 'ひょ',
- 'びぃ', 'びぇ',
- 'びゃ', 'びゅ', 'びょ',
- 'ぴぃ', 'ぴぇ',
- 'ぴゃ', 'ぴゅ', 'ぴょ',
- 'ふぁ', 'ふぃ', 'ふぇ', 'ふぉ',
- 'ふゃ', 'ふゅ', 'ふょ',
- 'ぶぁ', 'ぶぇ', 'ぶぉ',
- 'ぷぁ', 'ぷぇ', 'ぷぉ',
- 'ま', 'み', 'む', 'め', 'も',
- 'みぃ', 'みぇ',
- 'みゃ', 'みゅ', 'みょ',
- 'や', 'ゆ', 'よ',
- 'ゃ', 'ゅ', 'ょ',
- 'ら', 'り', 'る', 'れ', 'ろ',
- 'りぃ', 'りぇ',
- 'りゃ', 'りゅ', 'りょ',
- 'わ', 'を', 'ん',
- 'ゎ',
- 'ゐ', 'ゑ',
- 'ー',
- 'ヴぁ', 'ヴぃ', 'ヴ', 'ヴぇ', 'ヴぉ',
- 'ヴゃ', 'ヴぃぇ', 'ヴゅ', 'ヴょ',
-]
-
-# http://git.gnome.org/browse/glib/tree/gio/glib-compile-schemas.c#n765
-# gsettings supports keys named by "abcdefghijklmnopqrstuvwxyz0123456789-"
-# and ibus-anthy uses '-' as the delimiter.
-_supported_gsettings_key_chars = "abcdefghijklmnopqrstuvwxyz0123456789"
-
-_config_key_to_char = {
- # no modifiers keys
- 'minus' : '-',
- 'asciicircum' : '^',
- 'at' : '@',
- 'bracketleft' : '[',
- 'semicolon' : ';',
- 'colon' : ':',
- 'bracketright' : ']',
- 'comma' : ',',
- 'period' : '.',
- 'slash' : '/',
- 'backslash' : '\\',
-
- # shift modifiered keys
- 'exclam' : '!',
- 'quotedbl' : '"',
- 'numbersign' : '#',
- 'dollar' : '$',
- 'percent' : '%',
- 'ampersand' : '&',
- 'apostrophe' : '\'',
- 'parenleft' : '(',
- 'parenright' : ')',
- 'asciitilde' : '~',
- 'equal' : '=',
- 'bar' : '|',
-
- 'largeq' : 'Q',
- 'largew' : 'W',
- 'largee' : 'E',
- 'larger' : 'R',
- 'larget' : 'T',
- 'largey' : 'Y',
- 'largeu' : 'U',
- 'largei' : 'I',
- 'largeo' : 'O',
- 'largep' : 'P',
- 'grave' : '`',
-
- 'braceleft' : '{',
-
- 'largea' : 'A',
- 'larges' : 'S',
- 'larged' : 'D',
- 'largef' : 'F',
- 'largeg' : 'G',
- 'largeh' : 'H',
- 'largej' : 'J',
- 'largek' : 'K',
- 'largel' : 'L',
- 'plus' : '+',
- 'asterisk' : '*',
-
- 'braceright' : '}',
-
- 'largez' : 'Z',
- 'largex' : 'X',
- 'largec' : 'C',
- 'largev' : 'V',
- 'largeb' : 'B',
- 'largen' : 'N',
- 'largem' : 'M',
- 'less' : '<',
- 'greater' : '>',
-
- 'question' : '?',
- 'underscore' : '_',
-
- 'yen' : '¥',
-}
-
-_cmd_keys = [
- 'on_off',
- 'circle_input_mode',
- 'circle_kana_mode',
- 'circle_typing_method',
- 'circle_dict_method',
- 'latin_mode',
- 'wide_latin_mode',
- 'hiragana_mode',
- 'katakana_mode',
- 'half_katakana_mode',
-# 'cancel_pseudo_ascii_mode_key',
-
- 'hiragana_for_latin_with_shift',
-
- 'insert_space',
- 'insert_alternate_space',
- 'insert_half_space',
- 'insert_wide_space',
- 'backspace',
- 'delete',
- 'commit',
- 'convert',
- 'predict',
- 'cancel',
- 'cancel_all',
- 'reconvert',
-# 'do_nothing',
-
- 'select_first_candidate',
- 'select_last_candidate',
- 'select_next_candidate',
- 'select_prev_candidate',
- 'candidates_page_up',
- 'candidates_page_down',
-
- 'move_caret_first',
- 'move_caret_last',
- 'move_caret_forward',
- 'move_caret_backward',
-
- 'select_first_segment',
- 'select_last_segment',
- 'select_next_segment',
- 'select_prev_segment',
- 'shrink_segment',
- 'expand_segment',
- 'commit_first_segment',
- 'commit_selected_segment',
-
- 'select_candidates_1',
- 'select_candidates_2',
- 'select_candidates_3',
- 'select_candidates_4',
- 'select_candidates_5',
- 'select_candidates_6',
- 'select_candidates_7',
- 'select_candidates_8',
- 'select_candidates_9',
- 'select_candidates_0',
-
- 'convert_to_char_type_forward',
- 'convert_to_char_type_backward',
- 'convert_to_hiragana',
- 'convert_to_katakana',
- 'convert_to_half',
- 'convert_to_half_katakana',
- 'convert_to_wide_latin',
- 'convert_to_latin',
- 'convert_to_hiragana_all',
- 'convert_to_katakana_all',
- 'convert_to_half_all',
- 'convert_to_half_katakana_all',
- 'convert_to_wide_latin_all',
- 'convert_to_latin_all',
-
- 'dict_admin',
- 'add_word',
-
- 'start_setup',
-]
-
-_config = {
- 'common': {
- 'input_mode': 0,
- 'typing_method': 0,
- 'conversion_segment_mode': 0,
-
- 'show-input-mode': True,
- 'show-typing-method': False,
- 'show-segment-mode': False,
- 'show-dict-mode': True,
- 'show-dict-config': False,
- 'show-preferences': True,
-
- 'period_style': 0,
- 'symbol_style': 1,
- 'ten_key_mode': 1,
- 'behavior_on_focus_out': 0,
- 'behavior_on_period': 0,
- 'trigger_periods': ',.、。,.',
-
- 'page_size': 10,
- 'half_width_symbol': False,
- 'half_width_number': False,
- 'half_width_space': False,
- 'latin_with_shift': True,
-
- 'shortcut_type': 'default',
-
- 'dict_admin_command': ['@KASUMI_EXEC_FILE@', 'kasumi'],
- 'add_word_command': ['@KASUMI_EXEC_FILE@', 'kasumi', '-a'],
- 'dict_config_icon': '@KASUMI_ICON_FILE@',
- 'keyboard_layouts': [
- 'default', 'jp', 'us',
- # XKB options requires ibus 1.5.
- 'jp[ctrl:swapcaps]', 'us[ctrl:swapcaps]',
- 'jp[ctrl:swapcaps,compose:rctrl]',
- 'us[ctrl:swapcaps,compose:rctrl]',
- 'jp[japan:kana_lock]',
- 'jp[japan:nicola_f_bs]',
- 'jp[japan:nicola_f_bs,ctrl:swapcaps]',
- 'jp[japan:hztg_escape]',
- 'jp[japan:hztg_escape,ctrl:swapcaps]',
- ],
- },
-
- 'romaji_typing_rule': {
- 'method': 'default',
- # The newkeys list is saved for every romaji_typing_rule/$method
- # so that prefs.get_value_direct() is not used.
- # prefs.fetch_section() doesn't get the keys if they exist
- # in gconf only.
- 'newkeys': [],
- },
-
- ##0 MS-IME
- # http://www.filibeto.org/sun/lib/solaris10-docs/E19253-01/819-7844/appe-1-4/index.html
- ##1 ATOK
- # http://www.filibeto.org/sun/lib/solaris10-docs/E19253-01/819-7844/appe-1-3/index.html
- ##2 Gairaigo http://ja.wikipedia.org/wiki/%E5%A4%96%E6%9D%A5%E8%AA%9E
- ##3 ANSI/BSI Suggestions http://en.wikipedia.org/wiki/Katakana
- ##4 Historical kana http://en.wikipedia.org/wiki/Romanization_of_Japanese
- # Maybe we need a compatibility between MS-IME and ibus-anthy.
- 'romaji_typing_rule/default': {
- 'minus' : 'ー',
- 'a' : 'あ',
- 'i' : 'い',
- 'u' : 'う',
- 'e' : 'え',
- 'o' : 'お',
- 'x-a' : 'ぁ',
- 'x-i' : 'ぃ',
- 'x-u' : 'ぅ',
- 'x-e' : 'ぇ',
- 'x-o' : 'ぉ',
- 'l-a' : 'ぁ',
- 'l-i' : 'ぃ',
- 'l-u' : 'ぅ',
- 'l-e' : 'ぇ',
- 'l-o' : 'ぉ',
- 'w-h-a' : 'うぁ',
- 'w-h-i' : 'うぃ',
- 'w-h-e' : 'うぇ',
- 'w-h-o' : 'うぉ',
- 'w-y-a' : 'うゃ', ##2
- 'w-y-u' : 'うゅ', ##2
- 'w-y-o' : 'うょ', ##2
- 'v-a' : 'ヴぁ',
- 'v-i' : 'ヴぃ',
- 'v-u' : 'ヴ',
- 'v-e' : 'ヴぇ',
- 'v-o' : 'ヴぉ',
- 'v-y-a' : 'ヴゃ', ##2
- 'v-y-u' : 'ヴゅ', ##2
- 'v-y-e' : 'ヴぃぇ', ##2
- 'v-y-o' : 'ヴょ', ##2
- 'k-a' : 'か',
- 'k-i' : 'き',
- 'k-u' : 'く',
- 'k-e' : 'け',
- 'k-o' : 'こ',
- 'l-k-a' : 'ヵ',
- 'l-k-e' : 'ヶ',
-# 'x-k-a' : 'ゕ',
- 'x-k-a' : 'ヵ',
-# 'x-k-e' : 'ゖ',
- 'x-k-e' : 'ヶ',
- 'g-a' : 'が',
- 'g-i' : 'ぎ',
- 'g-u' : 'ぐ',
- 'g-e' : 'げ',
- 'g-o' : 'ご',
- 'k-y-a' : 'きゃ',
- 'k-y-i' : 'きぃ',
- 'k-y-u' : 'きゅ',
- 'k-y-e' : 'きぇ',
- 'k-y-o' : 'きょ',
- 'k-w-a' : 'くぁ',
- 'k-w-i' : 'くぃ', ##2
- 'k-w-u' : 'くぅ', ##2
- 'k-w-e' : 'くぇ', ##2
- 'k-w-o' : 'くぉ', ##2
- 'g-y-a' : 'ぎゃ',
- 'g-y-i' : 'ぎぃ',
- 'g-y-u' : 'ぎゅ',
- 'g-y-e' : 'ぎぇ',
- 'g-y-o' : 'ぎょ',
- 'g-w-a' : 'ぐぁ',
- 'g-w-i' : 'ぐぃ', ##2
- 'g-w-u' : 'ぐぅ', ##2
- 'g-w-e' : 'ぐぇ', ##2
- 'g-w-o' : 'ぐぉ', ##2
- 's-a' : 'さ',
- 's-i' : 'し',
- 's-u' : 'す',
- 's-e' : 'せ',
- 's-o' : 'そ',
- 'z-a' : 'ざ',
- 'z-i' : 'じ',
- 'z-u' : 'ず',
- 'z-e' : 'ぜ',
- 'z-o' : 'ぞ',
- 's-y-a' : 'しゃ',
- 's-y-i' : 'しぃ',
- 's-y-u' : 'しゅ',
- 's-y-e' : 'しぇ',
- 's-y-o' : 'しょ',
- 's-h-a' : 'しゃ',
- 's-h-i' : 'し',
- 's-h-u' : 'しゅ',
- 's-h-e' : 'しぇ',
- 's-h-o' : 'しょ',
- 'z-y-a' : 'じゃ',
- 'z-y-i' : 'じぃ',
- 'z-y-u' : 'じゅ',
- 'z-y-e' : 'じぇ',
- 'z-y-o' : 'じょ',
- 'j-a' : 'じゃ',
- 'j-y-a' : 'じゃ',
- 'j-i' : 'じ',
- 'j-y-i' : 'じぃ',
- 'j-u' : 'じゅ',
- 'j-y-u' : 'じゅ',
- 'j-e' : 'じぇ',
- 'j-y-e' : 'じぇ',
- 'j-o' : 'じょ',
- 'j-y-o' : 'じょ',
- 's-w-i' : 'すぅぃ', ##2
- 's-w-e' : 'すぇ', ##2
- 'z-w-e' : 'ずぇ', ##2
- 't-a' : 'た',
- 't-i' : 'ち',
- 't-u' : 'つ',
- 't-s-u' : 'つ',
- 't-e' : 'て',
- 't-o' : 'と',
- 'd-a' : 'だ',
- 'd-i' : 'ぢ',
- 'd-u' : 'づ',
- 'd-e' : 'で',
- 'd-o' : 'ど',
- 'x-t-u' : 'っ',
- 'x-t-s-u' : 'っ',
- 'l-t-u' : 'っ',
- 'l-t-s-u' : 'っ',
- 't-y-a' : 'ちゃ',
- 't-y-i' : 'ちぃ',
- 't-y-u' : 'ちゅ',
- 't-y-e' : 'ちぇ',
- 't-y-o' : 'ちょ',
- 'c-y-a' : 'ちゃ',
- 'c-y-i' : 'ちぃ',
- 'c-y-u' : 'ちゅ',
- 'c-y-e' : 'ちぇ',
- 'c-y-o' : 'ちょ',
- 'c-h-a' : 'ちゃ',
- 'c-h-i' : 'ち',
- 'c-h-u' : 'ちゅ',
- 'c-h-e' : 'ちぇ',
- 'c-h-o' : 'ちょ',
- 'd-y-a' : 'ぢゃ',
- 'd-y-i' : 'ぢぃ',
- 'd-y-u' : 'ぢゅ',
- 'd-y-e' : 'ぢぇ',
- 'd-y-o' : 'ぢょ',
- 't-s-a' : 'つぁ',
- 't-s-i' : 'つぃ',
- 't-s-e' : 'つぇ',
- 't-s-o' : 'つぉ',
- 't-s-y-a' : 'つゃ', ##3
- 't-s-y-u' : 'つゅ', ##3
- 't-s-y-e' : 'つぃぇ', ##3
- 't-s-y-o' : 'つょ', ##3
- 'd-z-a' : 'づぁ', ##3
- 'd-z-i' : 'づぃ', ##3
- 'd-z-u' : 'づ', ##4
- 'd-z-e' : 'づぇ', ##3
- 'd-z-o' : 'づぉ', ##3
- 'd-z-y-a' : 'づゃ', ##3
- 'd-z-y-u' : 'づゅ', ##3
- 'd-z-y-e' : 'づぃぇ', ##3
- 'd-z-y-o' : 'づょ', ##3
- 't-h-a' : 'てゃ',
- 't-h-i' : 'てぃ',
- 't-h-u' : 'てゅ',
- 't-h-e' : 'てぇ',
- 't-h-o' : 'てょ',
- 't-w-u' : 'とぅ',
- 'd-h-a' : 'でゃ',
- 'd-h-i' : 'でぃ',
- 'd-h-u' : 'でゅ',
- 'd-h-e' : 'でぇ',
- 'd-h-o' : 'でょ',
- 'd-w-u' : 'どぅ',
- 'n-a' : 'な',
- 'n-i' : 'に',
- 'n-u' : 'ぬ',
- 'n-e' : 'ね',
- 'n-o' : 'の',
- 'n-y-a' : 'にゃ',
- 'n-y-i' : 'にぃ',
- 'n-y-u' : 'にゅ',
- 'n-y-e' : 'にぇ',
- 'n-y-o' : 'にょ',
- 'h-a' : 'は',
- 'h-i' : 'ひ',
- 'h-u' : 'ふ',
- 'h-e' : 'へ',
- 'h-o' : 'ほ',
- 'b-a' : 'ば',
- 'b-i' : 'び',
- 'b-u' : 'ぶ',
- 'b-e' : 'べ',
- 'b-o' : 'ぼ',
- 'p-a' : 'ぱ',
- 'p-i' : 'ぴ',
- 'p-u' : 'ぷ',
- 'p-e' : 'ぺ',
- 'p-o' : 'ぽ',
- 'h-y-a' : 'ひゃ',
- 'h-y-i' : 'ひぃ',
- 'h-y-u' : 'ひゅ',
- 'h-y-e' : 'ひぇ',
- 'h-y-o' : 'ひょ',
- 'b-y-a' : 'びゃ',
- 'b-y-i' : 'びぃ',
- 'b-y-u' : 'びゅ',
- 'b-y-e' : 'びぇ',
- 'b-y-o' : 'びょ',
- 'p-y-a' : 'ぴゃ',
- 'p-y-i' : 'ぴぃ',
- 'p-y-u' : 'ぴゅ',
- 'p-y-e' : 'ぴぇ',
- 'p-y-o' : 'ぴょ',
- 'f-a' : 'ふぁ',
- 'f-i' : 'ふぃ',
- 'f-u' : 'ふ',
- 'f-e' : 'ふぇ',
- 'f-o' : 'ふぉ',
- 'f-y-a' : 'ふゃ',
- 'f-y-i' : 'ふぃ',
- 'f-y-u' : 'ふゅ',
- 'f-y-e' : 'ふぇ',
- 'f-y-o' : 'ふょ',
- 'b-w-a' : 'ぶぁ', ##2
- 'b-w-e' : 'ぶぇ', ##2
- 'b-w-o' : 'ぶぉ', ##2
- 'p-w-a' : 'ぷぁ', ##2
- 'p-w-e' : 'ぷぇ', ##2
- 'p-w-o' : 'ぷぉ', ##2
- 'm-a' : 'ま',
- 'm-i' : 'み',
- 'm-u' : 'む',
- 'm-e' : 'め',
- 'm-o' : 'も',
- 'm-y-a' : 'みゃ',
- 'm-y-i' : 'みぃ',
- 'm-y-u' : 'みゅ',
- 'm-y-e' : 'みぇ',
- 'm-y-o' : 'みょ',
- 'y-a' : 'や',
- 'y-i' : 'い',
- 'y-u' : 'ゆ',
- 'y-e' : 'いぇ',
- 'y-o' : 'よ',
- 'l-y-a' : 'ゃ',
- 'l-y-i' : 'ぃ',
- 'l-y-u' : 'ゅ',
- 'l-y-e' : 'ぇ',
- 'l-y-o' : 'ょ',
- 'x-y-a' : 'ゃ',
- 'x-y-i' : 'ぃ',
- 'x-y-u' : 'ゅ',
- 'x-y-e' : 'ぇ',
- 'x-y-o' : 'ょ',
- 'r-a' : 'ら',
- 'r-i' : 'り',
- 'r-u' : 'る',
- 'r-e' : 'れ',
- 'r-o' : 'ろ',
- 'r-y-a' : 'りゃ',
- 'r-y-i' : 'りぃ',
- 'r-y-u' : 'りゅ',
- 'r-y-e' : 'りぇ',
- 'r-y-o' : 'りょ',
- 'w-a' : 'わ',
- 'w-i' : 'うぃ',
- 'w-u' : 'う',
- 'w-e' : 'うぇ',
- 'w-o' : 'を',
- 'l-w-a' : 'ゎ',
- 'x-w-a' : 'ゎ',
- 'n-apostrophe' : 'ん',
- 'n-n' : 'ん',
- 'w-y-i' : 'ゐ',
- 'w-y-e' : 'ゑ',
- },
-
- 'kana_typing_rule': {
- 'method': 'jp',
- 'newkeys': [],
- },
-
- 'kana_typing_rule/jp': {
- # no modifiers keys
- '1' : 'ぬ',
- '2' : 'ふ',
- '3' : 'あ',
- '4' : 'う',
- '5' : 'え',
- '6' : 'お',
- '7' : 'や',
- '8' : 'ゆ',
- '9' : 'よ',
- '0' : 'わ',
- 'minus' : 'ほ',
- 'asciicircum' : 'へ',
-
- 'q' : 'た',
- 'w' : 'て',
- 'e' : 'い',
- 'r' : 'す',
- 't' : 'か',
- 'y' : 'ん',
- 'u' : 'な',
- 'i' : 'に',
- 'o' : 'ら',
- 'p' : 'せ',
- 'at' : '゛',
- 'bracketleft' : '゜',
-
- 'a' : 'ち',
- 's' : 'と',
- 'd' : 'し',
- 'f' : 'は',
- 'g' : 'き',
- 'h' : 'く',
- 'j' : 'ま',
- 'k' : 'の',
- 'l' : 'り',
- 'semicolon' : 'れ',
- 'colon' : 'け',
- 'bracketright' : 'む',
-
- 'z' : 'つ',
- 'x' : 'さ',
- 'c' : 'そ',
- 'v' : 'ひ',
- 'b' : 'こ',
- 'n' : 'み',
- 'm' : 'も',
- 'comma' : 'ね',
- 'period' : 'る',
- 'slash' : 'め',
- # 'backslash' : 'ー',
- 'backslash' : 'ろ',
-
- # shift modifiered keys
- 'exclam' : 'ぬ',
- 'quotedbl' : 'ふ',
- 'numbersign' : 'ぁ',
- 'dollar' : 'ぅ',
- 'percent' : 'ぇ',
- 'ampersand' : 'ぉ',
- 'apostrophe' : 'ゃ',
- 'parenleft' : 'ゅ',
- 'parenright' : 'ょ',
- 'asciitilde' : 'を',
- 'equal' : 'ゑ',
- 'bar' : 'ー',
-
- 'largeq' : 'た',
- 'largew' : 'て',
- 'largee' : 'ぃ',
- 'larger' : 'す',
- 'larget' : 'ヵ',
- 'largey' : 'ん',
- 'largeu' : 'な',
- 'largei' : 'に',
- 'largeo' : 'ら',
- 'largep' : 'せ',
- 'grave' : '゛',
-
- 'braceleft' : '「',
-
- 'largea' : 'ち',
- 'larges' : 'と',
- 'larged' : 'し',
- 'largef' : 'ゎ',
- 'largeg' : 'き',
- 'largeh' : 'く',
- 'largej' : 'ま',
- 'largek' : 'の',
- 'largel' : 'り',
- 'plus' : 'れ',
- 'asterisk' : 'ヶ',
-
- 'braceright' : '」',
-
- 'largez' : 'っ',
- 'largex' : 'さ',
- 'largec' : 'そ',
- 'largev' : 'ゐ',
- 'largeb' : 'こ',
- 'largen' : 'み',
- 'largem' : 'も',
- 'less' : '、',
- 'greater' : '。',
-
- 'question' : '・',
- 'underscore' : 'ろ',
-
- 'yen' : 'ー',
- },
-
- 'kana_typing_rule/us': {
- # no modifiers keys
- 'grave' : 'ろ',
- '1' : 'ぬ',
- '2' : 'ふ',
- '3' : 'あ',
- '4' : 'う',
- '5' : 'え',
- '6' : 'お',
- '7' : 'や',
- '8' : 'ゆ',
- '9' : 'よ',
- '0' : 'わ',
- 'minus' : 'ほ',
- 'equal' : 'へ',
-
- 'q' : 'た',
- 'w' : 'て',
- 'e' : 'い',
- 'r' : 'す',
- 't' : 'か',
- 'y' : 'ん',
- 'u' : 'な',
- 'i' : 'に',
- 'o' : 'ら',
- 'p' : 'せ',
- 'bracketleft' : '゛',
- 'bracketright' : '゜',
- # 'backslash' : 'ー',
- 'backslash' : 'む',
-
- 'a' : 'ち',
- 's' : 'と',
- 'd' : 'し',
- 'f' : 'は',
- 'g' : 'き',
- 'h' : 'く',
- 'j' : 'ま',
- 'k' : 'の',
- 'l' : 'り',
- 'semicolon' : 'れ',
- 'apostrophe' : 'け',
-
- 'z' : 'つ',
- 'x' : 'さ',
- 'c' : 'そ',
- 'v' : 'ひ',
- 'b' : 'こ',
- 'n' : 'み',
- 'm' : 'も',
- 'comma' : 'ね',
- 'period' : 'る',
- 'slash' : 'め',
-
- # shift modifiered keys
- 'asciitilde' : 'ろ',
- 'exclam' : 'ぬ',
- 'at' : 'ふ',
- 'numbersign' : 'ぁ',
- 'dollar' : 'ぅ',
- 'percent' : 'ぇ',
- 'asciicircum' : 'ぉ',
- 'ampersand' : 'ゃ',
- 'asterisk' : 'ゅ',
- 'parenleft' : 'ょ',
- 'parenright' : 'を',
- 'underscore' : 'ー',
- 'plus' : 'ゑ',
-
- 'largeq' : 'た',
- 'largew' : 'て',
- 'largee' : 'ぃ',
- 'larger' : 'す',
- 'larget' : 'ヵ',
- 'largey' : 'ん',
- 'largeu' : 'な',
- 'largei' : 'に',
- 'largeo' : 'ら',
- 'largep' : 'せ',
- 'braceleft' : '「',
-
- 'braceright' : '」',
-
- 'bar' : 'む',
-
- 'largea' : 'ち',
- 'larges' : 'と',
- 'larged' : 'し',
- 'largef' : 'ゎ',
- 'largeg' : 'き',
- 'largeh' : 'く',
- 'largej' : 'ま',
- 'largek' : 'の',
- 'largel' : 'り',
- 'colon' : 'れ',
- 'quotedbl' : 'ヶ',
-
- 'largez' : 'っ',
- 'largex' : 'さ',
- 'largec' : 'そ',
- 'largev' : 'ゐ',
- 'largeb' : 'こ',
- 'largen' : 'み',
- 'largem' : 'も',
- 'less' : '、',
- 'greater' : '。',
-
- 'question' : '・',
- },
- 'thumb': {
- 'keyboard_layout_mode': True,
- 'keyboard_layout': 0,
- 'fmv_extension': 2,
- 'handakuten': False,
- 'rs': 'Henkan',
- 'ls': 'Muhenkan',
- 't1': 100,
- 't2': 75,
- },
-
- 'thumb_typing_rule': {
- 'method': 'base',
- 'newkeys': [],
- 'nicola_j_table_newkeys': [],
- 'nicola_a_table_newkeys': [],
- 'nicola_f_table_newkeys': [],
- 'kb231_j_fmv_table_newkeys': [],
- 'kb231_a_fmv_table_newkeys': [],
- 'kb231_f_fmv_table_newkeys': [],
- 'kb611_j_fmv_table_newkeys': [],
- 'kb611_a_fmv_table_newkeys': [],
- 'kb611_f_fmv_table_newkeys': [],
- },
-
- 'thumb_typing_rule/base': {
- 'q' : [u'。', u'', u'ぁ'],
- 'w' : [u'か', u'が', u'え'],
- 'e' : [u'た', u'だ', u'り'],
- 'r' : [u'こ', u'ご', u'ゃ'],
- 't' : [u'さ', u'ざ', u'れ'],
-
- 'y' : [u'ら', u'よ', u'ぱ'],
- 'u' : [u'ち', u'に', u'ぢ'],
- 'i' : [u'く', u'る', u'ぐ'],
- 'o' : [u'つ', u'ま', u'づ'],
- 'p' : [u',', u'ぇ', u'ぴ'],
- 'at' : [u'、', u'', u''],
- 'bracketleft' : [u'゛', u'゜', u''],
-
- 'a' : [u'う', u'', u'を'],
- 's' : [u'し', u'じ', u'あ'],
- 'd' : [u'て', u'で', u'な'],
- 'f' : [u'け', u'げ', u'ゅ'],
- 'g' : [u'せ', u'ぜ', u'も'],
-
- 'h' : [u'は', u'み', u'ば'],
- 'j' : [u'と', u'お', u'ど'],
- 'k' : [u'き', u'の', u'ぎ'],
- 'l' : [u'い', u'ょ', u'ぽ'],
- 'semicolon' : [u'ん', u'っ', u''],
-
- 'z' : [u'.', u'', u'ぅ'],
- 'x' : [u'ひ', u'び', u'ー'],
- 'c' : [u'す', u'ず', u'ろ'],
- 'v' : [u'ふ', u'ぶ', u'や'],
- 'b' : [u'へ', u'べ', u'ぃ'],
-
- 'n' : [u'め', u'ぬ', u'ぷ'],
- 'm' : [u'そ', u'ゆ', u'ぞ'],
- 'comma' : [u'ね', u'む', u'ぺ'],
- 'period' : [u'ほ', u'わ', u'ぼ'],
- 'slash' : [u'・', u'ぉ', u''],
-
- '1' : [u'1', u'', u'?'],
- '2' : [u'2', u'', u'/'],
- '4' : [u'4', u'', u'「'],
- '5' : [u'5', u'', u'」'],
-
- '6' : [u'6', u'[', u''],
- '7' : [u'7', u']', u''],
- '8' : [u'8', u'(', u''],
- '9' : [u'9', u')', u''],
- 'backslash' : [u'¥', u'', u''],
- },
-
- 'thumb_typing_rule/nicola_j_table': {
- 'colon' : [u':', u'', u''],
- 'at' : [u'、', u'', u''],
- 'bracketleft' : [u'゛', u'゜', u''],
- 'bracketright' : [u'」', u'', u''],
- '8' : [u'8', u'(', u''],
- '9' : [u'9', u')', u''],
- '0' : [u'0', u'', u''],
- },
-
- 'thumb_typing_rule/nicola_a_table': {
- 'colon' : [u':', u'', u''],
- 'at' : [u'@', u'', u''],
- 'bracketleft' : [u'、', u'', u''],
- 'bracketright' : [u'゛', u'゜', u''],
- '8' : [u'8', u'', u''],
- '9' : [u'9', u'(', u''],
- '0' : [u'0', u')', u''],
- },
-
- 'thumb_typing_rule/nicola_f_table': {
- 'colon' : [u'、', u'', u''],
- 'at' : [u'@', u'', u''],
- 'bracketleft' : [u'゛', u'゜', u''],
- 'bracketright' : [u'」', u'', u''],
- '8' : [u'8', u'(', u''],
- '9' : [u'9', u')', u''],
- '0' : [u'0', u'', u''],
- },
-
- 'thumb_typing_rule/kb231_j_fmv_table': {
- '3' : [u'3', u'', u'~'],
- '0' : [u'0', u'『', u''],
- 'minus' : [u'-', u'』', u''],
- 'equal' : [u'=', u'', u''],
- },
-
- 'thumb_typing_rule/kb231_a_fmv_table': {
- '3' : [u'3', u'', u'~'],
- '0' : [u'0', u')', u''],
- 'minus' : [u'-', u'『', u''],
- 'equal' : [u'=', u'』', u''],
- },
-
- 'thumb_typing_rule/kb231_f_fmv_table': {
- '3' : [u'3', u'', u'~'],
- '0' : [u'0', u'『', u''],
- 'minus' : [u'-', u'』', u''],
- 'equal' : [u'=', u'', u''],
- },
-
- 'thumb_typing_rule/kb611_j_fmv_table': {
- 'grave' : [u'‘', u'', u''],
- 'asciicircum' : [u'々', u'£', u''],
- 'colon' : [u':', u'', u''],
- 'at' : [u'、', u'¢', u''],
- 'bracketleft' : [u'゛', u'゜', u''],
- # keysyms are same and keycodes depend on the platforms.
- #'¥' : [u'¥', u'¬', u''],
- 'backslash' : [u'¥', u'¦', u''],
- },
-
- 'thumb_typing_rule/kb611_a_fmv_table': {
- 'grave' : [u'々', u'', u'£'],
- 'colon' : [u':', u'', u''],
- 'at' : [u'@', u'', u''],
- 'bracketleft' : [u'、', u'¢', u''],
- #'¥' : [u'¥', u'¬', u''],
- 'backslash' : [u'¥', u'¦', u''],
- },
-
- 'thumb_typing_rule/kb611_f_fmv_table': {
- 'grave' : [u'‘', u'', u''],
- 'asciicircum' : [u'々', u'£', u''],
- 'colon' : [u'、', u'¢', u''],
- 'at' : [u'@', u'', u''],
- 'bracketleft' : [u'゛', u'゜', u''],
- #'¥' : [u'¥', u'¬', u''],
- 'backslash' : [u'¥', u'¦', u''],
- },
-
- 'dict': {
- 'zipcode': ['@pkgdatadir@/dicts/zipcode.t'],
- 'symbol': ['@pkgdatadir@/dicts/symbol.t'],
- 'oldchar': ['@pkgdatadir@/dicts/oldchar.t'],
- 'era': ['@pkgdatadir@/dicts/era.t'],
- 'emoji': ['@pkgdatadir@/dicts/emoji.t'],
- 'files': [
- '@pkgdatadir@/dicts/zipcode.t',
- '@pkgdatadir@/dicts/symbol.t',
- '@pkgdatadir@/dicts/oldchar.t',
- '@pkgdatadir@/dicts/era.t',
- '@pkgdatadir@/dicts/emoji.t',
- ],
- },
-
- 'dict/file/default': {
- 'embed': False,
- 'single': True,
- 'icon': None,
- 'short_label': None,
- 'long_label': None,
- 'preview_lines': 30,
- 'reverse': False,
- 'is_system': False,
- 'encoding': 'utf-8',
- },
-
- 'dict/file/embedded': {
- 'embed': True,
- 'single': True,
- 'icon': None,
- 'short_label': '般',
- 'long_label': N_("General"),
- 'preview_lines': 0,
- 'reverse': False,
- 'is_system': True,
- },
-
- 'dict/file/zipcode': {
- 'embed': False,
- 'single': True,
- 'icon': None,
- 'short_label': '〒',
- 'long_label': N_("Zip Code Conversion"),
- 'preview_lines': -1,
- 'reverse': False,
- 'is_system': True,
- },
-
- 'dict/file/symbol': {
- 'embed': True,
- 'single': False,
- 'icon': None,
- 'short_label': '記',
- 'long_label': N_("Symbol"),
- 'preview_lines': -1,
- 'reverse': False,
- 'is_system': True,
- },
-
- 'dict/file/oldchar': {
- 'embed': False,
- 'single': True,
- 'icon': None,
- 'short_label': '旧',
- 'long_label': N_("Old Character Style"),
- 'preview_lines': -1,
- 'reverse': False,
- 'is_system': True,
- },
- 'dict/file/era': {
- 'embed': False,
- 'single': True,
- 'icon': None,
- 'short_label': '年',
- 'long_label': N_("Era"),
- 'preview_lines': -1,
- 'reverse': False,
- 'is_system': True,
- },
- 'dict/file/emoji': {
- 'embed': False,
- 'single': True,
- 'icon': None,
- 'short_label': '😊',
- 'long_label': N_("Emoji"),
- 'preview_lines': -1,
- 'reverse': False,
- 'is_system': True,
- },
-}
-
-_shortcut_default = {
- 'on_off': [@ON_OFF_KEYS@],
- 'circle_input_mode': ['Ctrl+comma', 'Ctrl+less'],
- # Removed Hiragana_Katakana key in circle_kana_mode for latin_with_shift.
- 'circle_kana_mode': ['Ctrl+period', 'Ctrl+greater'],
-# 'cancel_pseudo_ascii_mode_key': ['Escape'],
- 'circle_typing_method': ['Alt+Romaji', 'Ctrl+slash'],
- 'circle_dict_method': ['Alt+Henkan'],
-
- 'insert_space': ['space'],
- 'insert_alternate_space': ['Shift+space'],
- 'backspace': ['BackSpace', 'Ctrl+H'],
- 'delete': ['Delete', 'Ctrl+D'],
- 'commit': ['Return', 'KP_Enter', 'Ctrl+J', 'Ctrl+M'],
- 'convert': ['space', 'KP_Space', 'Henkan'],
- 'predict': ['Tab', 'ISO_Left_Tab'],
- 'cancel': ['Escape', 'Ctrl+G'],
- 'reconvert': ['Shift+Henkan'],
-
- 'move_caret_first': ['Ctrl+A', 'Home'],
- 'move_caret_last': ['Ctrl+E', 'End'],
- 'move_caret_forward': ['Right', 'Ctrl+F'],
- 'move_caret_backward': ['Left', 'Ctrl+B'],
-
- 'select_first_segment': ['Ctrl+A', 'Home'],
- 'select_last_segment': ['Ctrl+E', 'End'],
- 'select_next_segment': ['Right', 'Ctrl+F'],
- 'select_prev_segment': ['Left', 'Ctrl+B'],
- 'shrink_segment': ['Shift+Left', 'Ctrl+I'],
- 'expand_segment': ['Shift+Right', 'Ctrl+O'],
- 'commit_first_segment': ['Shift+Down'],
- 'commit_selected_segment': ['Ctrl+Down'],
-
- 'select_first_candidate': ['Home'],
- 'select_last_candidate': ['End'],
- 'select_next_candidate': ['space', 'KP_Space', 'Tab', 'ISO_Left_Tab', 'Henkan', 'Down', 'KP_Add', 'Ctrl+N'],
- 'select_prev_candidate': ['Shift+Tab', 'Shift+ISO_Left_Tab', 'Up', 'KP_Subtract', 'Ctrl+P'],
- 'candidates_page_up': ['Page_Up'],
- 'candidates_page_down': ['Page_Down', 'KP_Tab'],
-
- 'select_candidates_1': ['1'],
- 'select_candidates_2': ['2'],
- 'select_candidates_3': ['3'],
- 'select_candidates_4': ['4'],
- 'select_candidates_5': ['5'],
- 'select_candidates_6': ['6'],
- 'select_candidates_7': ['7'],
- 'select_candidates_8': ['8'],
- 'select_candidates_9': ['9'],
- 'select_candidates_0': ['0'],
-
- 'convert_to_char_type_forward': ['Muhenkan'],
- 'convert_to_hiragana': ['F6'],
- 'convert_to_katakana': ['F7'],
- 'convert_to_half': ['F8'],
- 'convert_to_half_katakana': ['Shift+F8'],
- 'convert_to_wide_latin': ['F9'],
- 'convert_to_latin': ['F10'],
- 'convert_to_hiragana_all': ['Shift+F6'],
- 'convert_to_katakana_all': ['Shift+F7'],
- 'convert_to_wide_latin_all': ['Shift+F9'],
- 'convert_to_latin_all': ['Shift+F10'],
-
- 'dict_admin': ['F11'],
- 'add_word': ['F12'],
-
- 'hiragana_for_latin_with_shift': ['Hiragana_Katakana'],
-}
-
-_config['shortcut/default'] = dict.fromkeys(_cmd_keys, [])
-_config['shortcut/default'].update(_shortcut_default)
-
-_shortcut_atok = {
- 'on_off': ['Henkan', 'Eisu_toggle', 'Zenkaku_Hankaku'],
- 'circle_input_mode': ['F10'],
- 'hiragana_mode': ['Hiragana_Katakana'],
- 'katakana_mode': ['Shift+Hiragana_Katakana'],
- 'circle_typing_method': ['Romaji', 'Alt+Romaji'],
- 'circle_dict_method': ['Alt+Henkan'],
- 'convert': ['space', 'Henkan', 'Shift+space', 'Shift+Henkan'],
- 'predict': ['Tab'],
- 'cancel': ['Escape', 'BackSpace', 'Ctrl+H', 'Ctrl+bracketleft'],
- 'commit': ['Return', 'Ctrl+M'],
- 'reconvert': ['Shift+Henkan'],
-
- 'insert_space': ['space'],
- 'insert_alternate_space': ['Shift+space'],
- 'backspace': ['BackSpace', 'Ctrl+H'],
- 'delete': ['Delete', 'Ctrl+G'],
-
- 'move_caret_backward': ['Left', 'Ctrl+K'],
- 'move_caret_forward': ['Right', 'Ctrl+L'],
- 'move_caret_first': ['Ctrl+Left'],
- 'move_caret_last': ['Ctrl+Right'],
-
- 'select_prev_segment': ['Shift+Left'],
- 'select_next_segment': ['Shift+Right'],
- 'select_first_segment': ['Ctrl+Left'],
- 'select_last_segment': ['Ctrl+Right'],
- 'expand_segment': ['Right', 'Ctrl+L'],
- 'shrink_segment': ['Left', 'Ctrl+K'],
- 'commit_selected_segment': ['Down', 'Ctrl+N'],
-
- 'candidates_page_up': ['Shift+Henkan', 'Page_Up'],
- 'candidates_page_down': ['Henkan', 'Page_Down'],
- 'select_next_candidate': ['space', 'Tab', 'Henkan', 'Shift+space', 'Shift+Henkan'],
- 'select_prev_candidate': ['Up'],
-
- 'select_candidates_1': ['1'],
- 'select_candidates_2': ['2'],
- 'select_candidates_3': ['3'],
- 'select_candidates_4': ['4'],
- 'select_candidates_5': ['5'],
- 'select_candidates_6': ['6'],
- 'select_candidates_7': ['7'],
- 'select_candidates_8': ['8'],
- 'select_candidates_9': ['9'],
- 'select_candidates_0': ['0'],
-
- 'convert_to_hiragana': ['F6', 'Ctrl+U'],
- 'convert_to_katakana': ['F7', 'Ctrl+I'],
- 'convert_to_half': ['F8', 'Ctrl+O'],
- 'convert_to_half_katakana': ['Shift+F8'],
- 'convert_to_wide_latin': ['F9', 'Ctrl+P'],
- 'convert_to_latin': ['F10', 'Ctrl+at'],
- 'convert_to_hiragana_all': ['Shift+F6'],
- 'convert_to_katakana_all': ['Shift+F7'],
- 'convert_to_wide_latin_all': ['Shift+F9'],
- 'convert_to_latin_all': ['Shift+F10'],
-
- 'dict_admin': ['F11'],
- 'add_word': ['Ctrl+F7'],
-
- 'hiragana_for_latin_with_shift': ['Ctrl+J'],
-}
-
-_config['shortcut/atok'] = dict.fromkeys(_cmd_keys, [])
-_config['shortcut/atok'].update(_shortcut_atok)
-
-_shortcut_wnn = {
- 'on_off': ['Shift+space'],
- 'convert': ['space'],
- 'predict': ['Ctrl+Q'],
- 'cancel': ['Escape', 'Ctrl+G', 'Alt+Down', 'Muhenkan'],
- 'commit': ['Ctrl+L', 'Ctrl+M', 'Ctrl+J', 'Return'],
- 'insert_space': ['space'],
- 'backspace': ['Ctrl+H', 'BackSpace'],
- 'delete': ['Ctrl+D', 'Delete'],
- 'circle_dict_method': ['Alt+Henkan'],
-
- 'move_caret_backward': ['Ctrl+B', 'Left'],
- 'move_caret_forward': ['Ctrl+F', 'Right'],
- 'move_caret_first': ['Ctrl+A', 'Alt+Left'],
- 'move_caret_last': ['Ctrl+E', 'Alt+Right'],
-
- 'select_prev_segment': ['Ctrl+B', 'Left'],
- 'select_next_segment': ['Ctrl+F', 'Right'],
- 'select_first_segment': ['Ctrl+A', 'Alt+Left'],
- 'select_last_segment': ['Ctrl+E', 'Alt+Right'],
- 'expand_segment': ['Ctrl+O', 'F14'],
- 'shrink_segment': ['Ctrl+I', 'F13'],
-
- 'candidates_page_up': ['Tab'],
- 'candidates_page_down': ['Shift+Tab'],
- 'select_next_candidate': ['space', 'Ctrl+Q', 'Ctrl+P', 'Down'],
- 'select_prev_candidate': ['Ctrl+N', 'Up'],
-
- 'select_candidates_1': ['1'],
- 'select_candidates_2': ['2'],
- 'select_candidates_3': ['3'],
- 'select_candidates_4': ['4'],
- 'select_candidates_5': ['5'],
- 'select_candidates_6': ['6'],
- 'select_candidates_7': ['7'],
- 'select_candidates_8': ['8'],
- 'select_candidates_9': ['9'],
- 'select_candidates_0': ['0'],
-
- 'convert_to_hiragana': ['F6'],
- 'convert_to_katakana': ['F7'],
- 'convert_to_half': ['F8'],
- 'convert_to_wide_latin': ['F9'],
- 'convert_to_latin': ['F10'],
- 'convert_to_hiragana_all': ['Shift+F6'],
- 'convert_to_katakana_all': ['Shift+F7'],
- 'convert_to_half_all': ['Shift+F8'],
- 'convert_to_wide_latin_all': ['Shift+F9'],
- 'convert_to_latin_all': ['Shift+F10'],
-
- 'dict_admin': ['F11'],
- 'add_word': ['F12'],
-
- 'hiragana_for_latin_with_shift': ['Hiragana_Katakana'],
-}
-
-_config['shortcut/wnn'] = dict.fromkeys(_cmd_keys, [])
-_config['shortcut/wnn'].update(_shortcut_wnn)
-
diff --git a/setup/python2/main.py b/setup/python2/main.py
index c49a9cc..1fb5a67 100644
--- a/setup/python2/main.py
+++ b/setup/python2/main.py
@@ -4,8 +4,8 @@
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ import gettext
from gettext import dgettext
from gi import require_version as gi_require_version
+gi_require_version('Gio', '2.0')
gi_require_version('GLib', '2.0')
gi_require_version('Gtk', '3.0')
gi_require_version('Gdk', '3.0')
@@ -36,6 +37,7 @@ gi_require_version('GdkX11', '3.0')
gi_require_version('Pango', '1.0')
gi_require_version('IBus', '1.0')
+from gi.repository import Gio
from gi.repository import GLib
# set_prgname before importing other modules to show the name in warning
@@ -73,16 +75,7 @@ class AnthySetup(object):
gettext.bindtextdomain(DOMAINNAME, config.LOCALEDIR)
gettext.bind_textdomain_codeset(DOMAINNAME, 'UTF-8')
- # IBus.Bus() calls ibus_bus_new().
- # Gtk.Builder().add_from_file() also calls ibus_bus_new_async()
- # via ibus_im_context_new().
- # Then if IBus.Bus() is called after Gtk.Builder().add_from_file(),
- # the connection delay would be happened without an async
- # finish function.
- ibus_address = IBus.get_address()
- bus = None
- if ibus_address != None:
- bus = IBus.Bus(connect_async='True')
+ self.__prefs = AnthyPrefs()
builder_file = path.join(path.dirname(__file__), 'setup.ui')
self.__builder = builder = Gtk.Builder()
@@ -126,27 +119,15 @@ class AnthySetup(object):
toplevel.connect('notify::window', set_transient)
toplevel.show()
+ self.__init_bus_connected()
- if ibus_address == None:
- builder.connect_signals(self)
- # self.__run_message_dialog needs self.__builder.
- self.__run_message_dialog(_("ibus is not running."),
- Gtk.MessageType.ERROR)
- return
-
- if bus.is_connected():
- self.__init_bus_connected(bus)
- else:
- bus.connect('connected', self.__init_bus_connected)
-
- def __init_bus_connected(self, bus):
- self.__config = bus.get_config()
+ def __init_bus_connected(self):
builder = self.__builder
+ prefs = self.__prefs
self.__thumb_kb_layout_mode = None
self.__thumb_kb_layout = None
self.__japanese_ordered_dict = {}
- self.prefs = prefs = AnthyPrefs(None, self.__config)
# glade 'icon_name' property has a custom scaling and it seems
# to be difficult to show the complicated small icon in metacity.
@@ -161,17 +142,25 @@ class AnthySetup(object):
icon_path = 'ibus-anthy'
builder.get_object('main').set_icon_name(icon_path)
- for name in ['input_mode', 'typing_method', 'conversion_segment_mode',
- 'period_style', 'symbol_style', 'ten_key_mode',
- 'behavior_on_focus_out', 'behavior_on_period',
- 'half_width_symbol', 'half_width_number', 'half_width_space',
- 'latin_with_shift',
- 'thumb:keyboard_layout_mode', 'thumb:keyboard_layout',
- 'thumb:fmv_extension', 'thumb:handakuten']:
+ for name in ['input-mode', 'typing-method', 'conversion-segment-mode',
+ 'period-style', 'symbol-style', 'ten-key-mode',
+ 'behavior-on-focus-out', 'behavior-on-period',
+ 'half-width-symbol', 'half-width-number', 'half-width-space',
+ 'latin-with-shift',
+ 'thumb:keyboard-layout-mode', 'thumb:keyboard-layout',
+ 'thumb:fmv-extension', 'thumb:handakuten']:
section, key = self.__get_section_key(name)
- builder.get_object(name).set_active(prefs.get_value(section, key))
+ prefs.bind(section, key,
+ builder.get_object(name),
+ 'active',
+ Gio.SettingsBindFlags.DEFAULT)
+
+ prefs.bind('thumb', 'keyboard-layout-mode',
+ builder.get_object('thumb:keyboard-layout'),
+ 'sensitive',
+ Gio.SettingsBindFlags.INVERT_BOOLEAN)
- tv = builder.get_object('menu_visible:treeview')
+ tv = builder.get_object('menu-visible:treeview')
ls = Gtk.ListStore(str, bool, str)
tv.set_model(ls)
@@ -196,12 +185,14 @@ class AnthySetup(object):
self.__append_menus_in_model()
l = ['default', 'atok', 'wnn']
- s_type = prefs.get_value('common', 'shortcut_type')
+ s_type = prefs.get_value('common', 'shortcut-type')
s_type = s_type if s_type in l else 'default'
- builder.get_object('shortcut_type').set_active(l.index(s_type))
+ builder.get_object('shortcut-type').set_active(l.index(s_type))
- builder.get_object('page_size').set_value(prefs.get_value('common',
- 'page_size'))
+ prefs.bind('common', 'page-size',
+ builder.get_object('page-size').get_adjustment(),
+ 'value',
+ Gio.SettingsBindFlags.DEFAULT)
tv = builder.get_object('shortcut')
tv.append_column(Gtk.TreeViewColumn(_("Command"),
@@ -213,17 +204,17 @@ class AnthySetup(object):
tv.get_selection().connect_after('changed',
self.on_selection_changed, 0)
ls = Gtk.ListStore(str, str)
- sec = 'shortcut/' + s_type
- for k in self.prefs.keys(sec):
- ls.append([k, l_to_s(self.prefs.get_value(sec, k))])
+ shortcuts = self.__prefs.get_value('shortcut', s_type)
+ for k in shortcuts.keys():
+ ls.append([k, l_to_s(shortcuts[k])])
tv.set_model(ls)
self.__keymap = None
GLib.idle_add(self.__update_keymap_label,
priority = GLib.PRIORITY_LOW)
- self.__thumb_kb_layout_mode = builder.get_object('thumb:keyboard_layout_mode')
- self.__thumb_kb_layout = builder.get_object('thumb:keyboard_layout')
+ self.__thumb_kb_layout_mode = builder.get_object('thumb:keyboard-layout-mode')
+ self.__thumb_kb_layout = builder.get_object('thumb:keyboard-layout')
self.__set_thumb_kb_label()
for name in ['thumb:ls', 'thumb:rs']:
@@ -236,13 +227,13 @@ class AnthySetup(object):
self.on_selection_changed, 1)
tv.set_model(Gtk.ListStore(str))
- key = 'dict_admin_command'
+ key = 'dict-admin-command'
cli = self.__get_dict_cli_from_list(prefs.get_value('common', key))
- name = 'dict:entry_edit_dict_command'
+ name = 'dict:entry-edit-dict-command'
builder.get_object(name).set_text(cli)
- key = 'add_word_command'
+ key = 'add-word-command'
cli = self.__get_dict_cli_from_list(prefs.get_value('common', key))
- name = 'dict:entry_add_word_command'
+ name = 'dict:entry-add-word-command'
builder.get_object(name).set_text(cli)
tv = builder.get_object('dict:view')
@@ -298,7 +289,7 @@ class AnthySetup(object):
def __init_japanese_sort(self):
japanese_ordered_dict = {}
- japanese_ordered_list = self.prefs.get_japanese_ordered_list()
+ japanese_ordered_list = self.__prefs.get_japanese_ordered_list()
for index, c in enumerate(japanese_ordered_list):
japanese_ordered_dict[c] = index
self.__japanese_ordered_dict = japanese_ordered_dict;
@@ -306,7 +297,7 @@ class AnthySetup(object):
def __init_about_vbox(self, icon_path):
about_dialog = self.__builder.get_object('about_dialog')
about_vbox = self.__builder.get_object('about_vbox')
- about_dialog.set_version(self.prefs.get_version())
+ about_dialog.set_version(self.__prefs.get_version())
if icon_path != None:
if icon_path[0] == '/':
image = Gtk.Image.new_from_file(icon_path)
@@ -356,6 +347,20 @@ class AnthySetup(object):
dlg.run()
dlg.destroy()
+ def _get_shortcut_sec(self):
+ l = ['default', 'atok', 'wnn']
+ iter = self.__builder.get_object('shortcut-type').get_active_iter()
+ model = self.__builder.get_object('shortcut-type').get_model()
+ s_type = model[iter][0].lower()
+ return 'shortcut/' + (s_type if s_type in l else 'default')
+
+ def __get_shortcut_group(self):
+ l = ['default', 'atok', 'wnn']
+ iter = self.__builder.get_object('shortcut-type').get_active_iter()
+ model = self.__builder.get_object('shortcut-type').get_model()
+ s_type = model[iter][0].lower()
+ return s_type if s_type in l else 'default'
+
def __japanese_tuple_sort(self, a, b):
if a[1] == b[1]:
return cmp(a[0], b[0])
@@ -376,26 +381,25 @@ class AnthySetup(object):
return cmp(a[0], b[0])
def __renderer_toggled_cb(self, renderer, path, model):
- prefs = self.prefs
+ prefs = self.__prefs
enabled = not model[path][1]
model[path][1] = enabled
key = model[path][0]
prefs.set_value('common', key, enabled)
- self.__builder.get_object('btn_apply').set_sensitive(True)
def __toggle_menu_visible_cell_cb(self, column, renderer, model, iter, id):
- l = self.__builder.get_object('menu_visible:treeview').get_model()
+ l = self.__builder.get_object('menu-visible:treeview').get_model()
active = l.get_value(iter, id)
renderer.set_property('active', active)
def __text_menu_visible_cell_cb(self, column, renderer, model, iter, id):
- l = self.__builder.get_object('menu_visible:treeview').get_model()
+ l = self.__builder.get_object('menu-visible:treeview').get_model()
text = l.get_value(iter, id)
renderer.set_property('text', text)
def __append_menus_in_model(self):
- prefs = self.prefs
- l = self.__builder.get_object('menu_visible:treeview').get_model()
+ prefs = self.__prefs
+ l = self.__builder.get_object('menu-visible:treeview').get_model()
l.append(['show-input-mode',
prefs.get_value('common', 'show-input-mode'),
_("Input mode")])
@@ -416,30 +420,20 @@ class AnthySetup(object):
_("Preferences - Anthy")])
def __get_romaji_treeview_custom_key_table(self, method):
- prefs = self.prefs
+ prefs = self.__prefs
rule = {}
ls = Gtk.ListStore(str, str, str)
tv = self.__builder.get_object('treeview_custom_key_table')
- section_base = 'romaji_typing_rule'
- section = section_base + '/' + prefs.str(method)
- for key in prefs.keys(section):
- key = prefs.str(key)
- value = prefs.get_value(section, key)
+ section = 'romaji-typing-rule'
+ keymap = prefs.get_value(section, 'list')[method]
+ for key in keymap.keys():
+ value = keymap[key]
ch = prefs.typing_from_config_key(key)
if ch == '':
continue
# config.set_value(key, None) is not supported.
if value != None and value != '':
- rule[ch] = prefs.str(value)
- for key in prefs.get_value(section_base, 'newkeys'):
- key = prefs.str(key)
- value = self.prefs.get_value_direct(section, key)
- ch = prefs.typing_from_config_key(key)
- if ch == '':
- continue
- # config.set_value(key, None) is not supported.
- if value != None and value != '':
- rule[ch] = prefs.str(value)
+ rule[ch] = value
for key, value in sorted(rule.items(), \
cmp = self.__japanese_tuple_sort):
ls.append(['romaji', key, value])
@@ -452,30 +446,20 @@ class AnthySetup(object):
return tv
def __get_kana_treeview_custom_key_table(self, method):
- prefs = self.prefs
+ prefs = self.__prefs
rule = {}
ls = Gtk.ListStore(str, str, str)
tv = self.__builder.get_object('treeview_custom_key_table')
- section_base = 'kana_typing_rule'
- section = section_base + '/' + prefs.str(method)
- for key in prefs.keys(section):
- key = prefs.str(key)
- value = prefs.get_value(section, key)
+ section = 'kana-typing-rule'
+ keymap = prefs.get_value(section, 'list')[method]
+ for key in keymap.keys():
+ value = keymap[key]
ch = prefs.typing_from_config_key(key)
if ch == '':
continue
# config.set_value(key, None) is not supported.
if value != None and value != '':
- rule[ch] = prefs.str(value)
- for key in prefs.get_value(section_base, 'newkeys'):
- key = prefs.str(key)
- value = self.prefs.get_value_direct(section, key)
- ch = prefs.typing_from_config_key(key)
- if ch == '':
- continue
- # config.set_value(key, None) is not supported.
- if value != None and value != '':
- rule[ch] = prefs.str(value)
+ rule[ch] = value
for key, value in sorted(rule.items(), \
cmp = self.__japanese_tuple_sort):
ls.append(['kana', key, value])
@@ -488,30 +472,14 @@ class AnthySetup(object):
return tv
def __get_thumb_treeview_custom_key_table(self, method):
- prefs = self.prefs
+ prefs = self.__prefs
rule = {}
ls = Gtk.ListStore(str, str, str, str, str)
tv = self.__builder.get_object('treeview_custom_key_table')
- section_base = 'thumb_typing_rule'
- section = section_base + '/' + prefs.str(method)
- for key in prefs.keys(section):
- key = prefs.str(key)
- value = prefs.get_value(section, key)
- ch = prefs.typing_from_config_key(key)
- if ch == '':
- continue
- # config.set_value(key, None) is not supported.
- if value != None and len(value) == 3 and \
- ((value[0] != None and value[0] != '') or \
- (value[1] != None and value[1] != '') or \
- (value[2] != None and value[2] != '')):
- rule[ch] = {}
- rule[ch][0] = prefs.str(value[0])
- rule[ch][1] = prefs.str(value[1])
- rule[ch][2] = prefs.str(value[2])
- for key in prefs.get_value(section_base, 'newkeys'):
- key = prefs.str(key)
- value = self.prefs.get_value_direct(section, key)
+ section = 'thumb-typing-rule'
+ keymap = prefs.get_value(section, 'list')[method]
+ for key in keymap.keys():
+ value = keymap[key]
ch = prefs.typing_from_config_key(key)
if ch == '':
continue
@@ -521,9 +489,9 @@ class AnthySetup(object):
(value[1] != None and value[1] != '') or \
(value[2] != None and value[2] != '')):
rule[ch] = {}
- rule[ch][0] = prefs.str(value[0])
- rule[ch][1] = prefs.str(value[1])
- rule[ch][2] = prefs.str(value[2])
+ rule[ch][0] = value[0]
+ rule[ch][1] = value[1]
+ rule[ch][2] = value[2]
for key, value in sorted(rule.items(), \
cmp = self.__japanese_thumb_sort):
ls.append(['thumb', key, value[0], value[2], value[1]])
@@ -609,7 +577,7 @@ class AnthySetup(object):
combobox.disconnect_by_func(self.on_cb_custom_key_table_changed)
def __run_dialog_custom_key_table(self, widget, mode):
- prefs = self.prefs
+ prefs = self.__prefs
dlg = self.__builder.get_object('dialog_custom_key_table')
dlg.set_transient_for(widget.get_toplevel())
label = self.__builder.get_object('label_custom_key_table')
@@ -633,15 +601,15 @@ class AnthySetup(object):
label.set_label(_("_Thumb Shift Key Table:"))
label_output.set_label(_("Single _Output Chars"))
list_labels = [['base', _("Base")],
- ['nicola_j_table', _("NICOLA-J key extension")],
- ['nicola_a_table', _("NICOLA-A key extension")],
- ['nicola_f_table', _("NICOLA-F key extension")],
- ['kb231_j_fmv_table', _("FMV KB231-J key extension")],
- ['kb231_a_fmv_table', _("FMV KB231-A key extension")],
- ['kb231_f_fmv_table', _("FMV KB231-F key extension")],
- ['kb611_j_fmv_table', _("FMV KB611-J key extension")],
- ['kb611_a_fmv_table', _("FMV KB611-A key extension")],
- ['kb611_f_fmv_table', _("FMV KB611-F key extension")],
+ ['nicola-j-table', _("NICOLA-J key extension")],
+ ['nicola-a-table', _("NICOLA-A key extension")],
+ ['nicola-f-table', _("NICOLA-F key extension")],
+ ['kb231-j-fmv-table', _("FMV KB231-J key extension")],
+ ['kb231-a-fmv-table', _("FMV KB231-A key extension")],
+ ['kb231-f-fmv-table', _("FMV KB231-F key extension")],
+ ['kb611-j-fmv-table', _("FMV KB611-J key extension")],
+ ['kb611-a-fmv-table', _("FMV KB611-A key extension")],
+ ['kb611-f-fmv-table', _("FMV KB611-F key extension")],
]
self.__show_dialog_custom_key_table_extention(mode)
ls = Gtk.ListStore(str, str)
@@ -655,17 +623,17 @@ class AnthySetup(object):
tv = None
if mode == 'romaji':
- method = prefs.get_value('romaji_typing_rule', 'method')
+ method = prefs.get_value('romaji-typing-rule', 'method')
if method == None:
method = 'default'
tv = self.__get_romaji_treeview_custom_key_table(method)
if mode == 'kana':
- method = prefs.get_value('kana_typing_rule', 'method')
+ method = prefs.get_value('kana-typing-rule', 'method')
if method == None:
method = 'jp'
tv = self.__get_kana_treeview_custom_key_table(method)
if mode == 'thumb':
- method = prefs.get_value('thumb_typing_rule', 'method')
+ method = prefs.get_value('thumb-typing-rule', 'method')
if method == None:
method = 'base'
tv = self.__get_thumb_treeview_custom_key_table(method)
@@ -675,10 +643,15 @@ class AnthySetup(object):
id = 0
# thumb uses all tables so the default is always 0.
if mode != 'thumb':
+ id = -1
for index, labels in enumerate(list_labels):
if labels[0] == method:
id = index
break
+ if id == -1:
+ ls.append([method, method])
+ combobox.set_model(ls)
+ id = len(list_labels)
combobox.set_active(id)
combobox.connect('changed', self.on_cb_custom_key_table_changed, mode)
@@ -693,7 +666,7 @@ class AnthySetup(object):
return
section, key = self.__get_section_key(
Gtk.Buildable.get_name(self.__thumb_kb_layout_mode))
- layout_mode = self.prefs.get_value(section, key)
+ layout_mode = self.__prefs.get_value(section, key)
if layout_mode:
self.__thumb_kb_layout.set_sensitive(False)
else:
@@ -730,60 +703,52 @@ class AnthySetup(object):
return id
def __get_dict_file_from_id(self, selected_id):
- files = self.prefs.get_value('dict', 'files')
- retval = None
-
- for file in files:
- id = self.__get_quoted_id(file)
- # The selected_id is already quoted.
- if selected_id == id:
- retval = file
- break
- return retval
+ files = self.__prefs.get_value('dict', 'files')
+ return files.get(selected_id, None)
def __is_system_dict_file_from_id(self, selected_id):
- prefs = self.prefs
- section = 'dict/file/' + selected_id
- key = 'is_system'
-
- if key not in prefs.keys(section):
- return False
- return prefs.get_value(section, key)
+ prefs = self.__prefs
+ dict_item = prefs.get_value('dict', 'list')[selected_id]
+ return dict_item.is_system
- def __append_dict_id_in_model(self, id, is_gettext):
- prefs = self.prefs
+ def __append_dict_id_in_model(self, id):
+ prefs = self.__prefs
section = 'dict/file/' + id
- # user value is dbus.String
- prefs.set_value(section, 'short_label',
- prefs.str(prefs.get_value(section, 'short_label')))
- prefs.set_value(section, 'long_label',
- prefs.str(prefs.get_value(section, 'long_label')))
- short_label = prefs.get_value(section, 'short_label')
- long_label = prefs.get_value(section, 'long_label')
- embed = prefs.get_value(section, 'embed')
- single = prefs.get_value(section, 'single')
- reverse = prefs.get_value(section, 'reverse')
- if is_gettext:
+ dicts = prefs.get_value('dict', 'list')
+ dict_item = dicts[id]
+ short_label = dict_item.short_label
+ long_label = dict_item.long_label
+ embed = dict_item.embed
+ single = dict_item.single
+ reverse = dict_item.reverse
+ if dict_item.is_system:
long_label = _(long_label)
l = self.__builder.get_object('dict:view').get_model()
l.append([id, short_label, long_label, embed, single, reverse])
def __append_dicts_in_model(self):
- prefs = self.prefs
- for file in prefs.get_value('dict', 'files'):
- if not path.exists(file):
+ prefs = self.__prefs
+ order = prefs.get_value('dict', 'order')
+ dict_files = prefs.get_value('dict', 'files')
+ if len(order) == 0:
+ order = list(dict_files.keys())
+ for id in order:
+ if id == 'embedded':
continue
- id = self.__get_quoted_id(file)
- section = 'dict/file/' + id
- if section not in prefs.sections():
- self.__fetch_dict_values(section)
- is_system_dict = self.__is_system_dict_file_from_id(id)
- self.__append_dict_id_in_model(id, is_system_dict)
+ files = dict_files[id]
+ for file in files:
+ if not path.exists(file):
+ continue
+ self.__append_dict_id_in_model(id)
def __append_user_dict_from_dialog(self, file, id, new):
- files = self.prefs.get_value('dict', 'files')
+ files_dict = self.__prefs.get_value('dict', 'files')
if new:
+ files = []
+ for v in files_dict.values():
+ for f in v:
+ files.append(f)
if file in files:
self.__run_message_dialog(_("Your choosed file has already been added: ") + file,
Gtk.MessageType.ERROR)
@@ -800,6 +765,8 @@ class AnthySetup(object):
self.__run_message_dialog(_("You cannot add dictionaries in the anthy private directory: " + file),
Gtk.MessageType.ERROR)
return
+ else:
+ file = files_dict[id][0]
if new:
id = self.__get_quoted_id(file)
@@ -817,15 +784,23 @@ class AnthySetup(object):
long_label = self.__builder.get_object('dict:long_entry').get_text()
if new:
- files.append(file)
- self.prefs.set_value('dict', 'files', files)
-
+ order = self.__prefs.get_value('dict', 'order')
+ if len(order) == 0:
+ order = list(self.__prefs.get_value('dict', 'files').keys())
+ order.append(id)
+ self.__prefs.set_value('dict', 'order', order)
+ self.__prefs.set_list_item('dict', 'files', id, [file])
+
+ filename = file
+ if filename.find('/') >=0:
+ filename = filename[filename.rindex('/') + 1:]
+ if filename.find('.') >=0:
+ filname = filename[:filename.rindex('.')]
if short_label == None or short_label == '':
- short_label = id[0]
+ short_label = filename[0]
if long_label == None or long_label == '':
- long_label = id
+ long_label = filename
self.__update_dict_values(new, id, short_label, long_label, embed, single, reverse)
- self.__builder.get_object('btn_apply').set_sensitive(True)
files = []
def __init_dict_chooser_dialog(self):
@@ -851,18 +826,16 @@ class AnthySetup(object):
if selected_id == None:
return None
- is_system_dict = self.__is_system_dict_file_from_id(selected_id)
-
- prefs = self.prefs
- section = 'dict/file/' + selected_id
- short_label = prefs.get_value(section, 'short_label')
- long_label = prefs.get_value(section, 'long_label')
- embed = prefs.get_value(section, 'embed')
- single = prefs.get_value(section, 'single')
- reverse = prefs.get_value(section, 'reverse')
+ dict_item = self.__prefs.get_value('dict', 'list')[selected_id]
+ short_label = dict_item.short_label
+ long_label = dict_item.long_label
+ embed = dict_item.embed
+ single = dict_item.single
+ reverse = dict_item.reverse
+ is_system_dict = dict_item.is_system
- if len(prefs.unicode(short_label)) > 1:
- short_label = prefs.unicode(short_label)[0].encode('utf-8')
+ if len(self.__prefs.unicode(short_label)) > 1:
+ short_label = self.__prefs.unicode(short_label)[0].encode('utf-8')
self.__builder.get_object('dict:single').set_active(single)
self.__builder.get_object('dict:embed').set_active(embed)
self.__builder.get_object('dict:reverse').set_active(reverse)
@@ -880,56 +853,32 @@ class AnthySetup(object):
return selected_id
- def __fetch_dict_values(self, section):
- prefs = self.prefs
- prefs.set_new_section(section)
- prefs.set_new_key(section, 'short_label')
- prefs.fetch_item(section, 'short_label')
- # user value is dbus.String
- prefs.set_value(section, 'short_label',
- prefs.str(prefs.get_value(section, 'short_label')))
- prefs.set_new_key(section, 'long_label')
- prefs.fetch_item(section, 'long_label')
- prefs.set_value(section, 'long_label',
- prefs.str(prefs.get_value(section, 'long_label')))
- prefs.set_new_key(section, 'embed')
- prefs.fetch_item(section, 'embed')
- prefs.set_new_key(section, 'single')
- prefs.fetch_item(section, 'single')
- prefs.set_new_key(section, 'reverse')
- prefs.fetch_item(section, 'reverse')
-
def __update_dict_values(self, new, id, short_label, long_label, embed, single, reverse):
- prefs = self.prefs
- section = 'dict/file/' + id
- if section not in prefs.sections():
- prefs.set_new_section(section)
-
- is_system_dict = self.__is_system_dict_file_from_id(id)
- if is_system_dict:
- if 'short_label' in prefs.keys(section):
- short_label = prefs.get_value(section, 'short_label')
- if 'long_label' in prefs.keys(section):
- long_label = prefs.get_value(section, 'long_label')
+ prefs = self.__prefs
if new:
+ dict_item = prefs.get_value('dict', 'template')
+ dict_item.id = id
+ dict_item.short_label = short_label
+ dict_item.long_label = long_label
+ dict_item.embed = embed
+ dict_item.single = single
+ dict_item.reverse = reverse
l = self.__builder.get_object('dict:view').get_model()
l.append([id, short_label, long_label, embed, single, reverse])
else:
+ dict_item = prefs.get_value('dict', 'list')[id]
+ if not dict_item.is_system:
+ dict_item.short_label = short_label
+ dict_item.long_label = long_label
+ dict_item.embed = embed
+ dict_item.single = single
+ dict_item.reverse = reverse
l, i = self.__builder.get_object('dict:view').get_selection().get_selected()
if i :
l[i] = [id, short_label, long_label, embed, single, reverse]
- key = 'short_label'
- prefs.set_value(section, key, short_label)
- key = 'long_label'
- prefs.set_value(section, key, long_label)
- key = 'embed'
- prefs.set_value(section, key, embed)
- key = 'single'
- prefs.set_value(section, key, single)
- key = 'reverse'
- prefs.set_value(section, key, reverse)
+ prefs.set_list_item('dict', 'list', id, dict_item)
def __text_cell_data_cb(self, column, renderer, model, iter, id):
l = self.__builder.get_object('dict:view').get_model()
@@ -1104,13 +1053,13 @@ class AnthySetup(object):
def __update_keymap_label(self):
self.__resync_engine_file()
- prefs = self.prefs
+ prefs = self.__prefs
keymap = self.__get_keymap()
if keymap == None:
return
if keymap == '':
keymap = 'default'
- keymap_list = prefs.get_value('common', 'keyboard_layouts')
+ keymap_list = prefs.get_value('common', 'keyboard-layouts')
if keymap != None and not keymap in keymap_list:
keymap_list.append(keymap)
index = -1
@@ -1130,11 +1079,6 @@ class AnthySetup(object):
self.on_cb_keymap_changed,
0)
- def __save_preferences(self):
- self.prefs.commit_all()
- if self.__keymap != None:
- self.__save_keymap()
-
def __search_and_mark(self, buffer, text, start, end, onetime, forward):
if forward:
match = start.forward_search(text, 0, end)
@@ -1217,51 +1161,12 @@ class AnthySetup(object):
button = self.__builder.get_object('button_remove_custom_key')
button.set_sensitive(True)
- def on_main_delete(self, widget, event):
- self.on_btn_cancel_clicked(widget)
+ def on_main_quit(self, widget, event):
+ Gtk.main_quit()
return True
- def on_btn_ok_clicked(self, widget):
- if self.__builder.get_object('btn_apply').get_state() == \
- Gtk.StateType.INSENSITIVE:
- Gtk.main_quit()
- return True
- dlg = self.__builder.get_object('quit_check')
- dlg.set_transient_for(widget.get_toplevel())
- dlg.set_markup('<big><b>%s</b></big>' % _("Confirmation"))
- dlg.format_secondary_text(
- _("You are about to close the setup dialog, is that OK?"))
- id = dlg.run()
- dlg.hide()
- if id == Gtk.ResponseType.YES:
- self.__save_preferences()
- Gtk.main_quit()
- return True
-
- def on_btn_cancel_clicked(self, widget):
- if self.__builder.get_object('btn_apply').get_state() == \
- Gtk.StateType.INSENSITIVE:
- Gtk.main_quit()
- return True
- dlg = self.__builder.get_object('quit_check_without_save')
- dlg.set_transient_for(widget.get_toplevel())
- dlg.set_markup('<big><b>%s</b></big>' % _("Notice!"))
- dlg.format_secondary_text(
- _("You are about to close the setup dialog without saving your changes, is that OK?"))
- id = dlg.run()
- dlg.hide()
- if id == Gtk.ResponseType.YES:
- Gtk.main_quit()
- return True
-
- def on_btn_apply_clicked(self, widget):
- self.__save_preferences()
- widget.set_sensitive(False)
-
- def on_cb_changed(self, widget):
- section, key = self.__get_section_key(Gtk.Buildable.get_name(widget))
- self.prefs.set_value(section, key, widget.get_active())
- self.__builder.get_object('btn_apply').set_sensitive(True)
+ def on_btn_close_clicked(self, widget):
+ Gtk.main_quit()
def on_cb_keymap_changed(self, widget, id):
it = widget.get_active()
@@ -1272,10 +1177,11 @@ class AnthySetup(object):
if self.__keymap == keymap:
return
self.__keymap = keymap
- self.__builder.get_object('btn_apply').set_sensitive(True)
+ self.__save_keymap()
+ self.__keymap = None
def on_cb_custom_key_table_changed(self, widget, user_data):
- prefs = self.prefs
+ prefs = self.__prefs
tv = self.__builder.get_object('treeview_custom_key_table')
mode = user_data
id = widget.get_active()
@@ -1289,27 +1195,12 @@ class AnthySetup(object):
if mode == 'romaji':
tv = self.__get_romaji_treeview_custom_key_table(method)
elif mode == 'kana':
- prefs.set_value('kana_typing_rule', 'method', method)
- self.__builder.get_object('btn_apply').set_sensitive(True)
+ prefs.set_value('kana-typing-rule', 'method', method)
tv = self.__get_kana_treeview_custom_key_table(method)
elif mode == 'thumb':
# thumb uses all tables so do not save the method.
tv = self.__get_thumb_treeview_custom_key_table(method)
- def on_sb_changed(self, widget):
- section, key = self.__get_section_key(Gtk.Buildable.get_name(widget))
- self.prefs.set_value(section, key, widget.get_value_as_int())
- self.__builder.get_object('btn_apply').set_sensitive(True)
-
- def on_ck_toggled(self, widget):
- section, key = self.__get_section_key(Gtk.Buildable.get_name(widget))
- self.prefs.set_value(section, key, widget.get_active())
- self.__builder.get_object('btn_apply').set_sensitive(True)
- if self.__thumb_kb_layout_mode and \
- Gtk.Buildable.get_name(widget) == \
- Gtk.Buildable.get_name(self.__thumb_kb_layout_mode):
- self.__set_thumb_kb_label()
-
def on_btn_edit_clicked(self, widget):
ls, it = self.__builder.get_object('shortcut').get_selection().get_selected()
m = self.__builder.get_object('es:treeview').get_model()
@@ -1326,19 +1217,20 @@ class AnthySetup(object):
if id == Gtk.ResponseType.OK:
new = l_to_s([m[i][0] for i in range(len(m))])
if new != ls.get(it, 1)[0]:
- sec = self._get_shortcut_sec()
- self.prefs.set_value(sec, ls.get(it, 0)[0], s_to_l(new))
+ group = self.__get_shortcut_group()
+ self.__prefs.set_list_item('shortcut', group,
+ ls.get(it, 0)[0], s_to_l(new))
ls.set(it, 1, new)
- self.__builder.get_object('btn_apply').set_sensitive(True)
def on_btn_default_clicked(self, widget):
ls, it = self.__builder.get_object('shortcut').get_selection().get_selected()
- sec = self._get_shortcut_sec()
- new = l_to_s(self.prefs.default[sec][ls.get(it, 0)[0]])
+ group = self.__get_shortcut_group()
+ shortcuts = self.__prefs.get_default_value('shortcut', group)
+ new = l_to_s(shortcuts[ls.get(it, 0)[0]])
if new != ls.get(it, 1)[0]:
- self.prefs.set_value(sec, ls.get(it, 0)[0], s_to_l(new))
+ self.__prefs.set_list_item('shortcut', group,
+ ls.get(it, 0)[0], s_to_l(new))
ls.set(it, 1, new)
- self.__builder.get_object('btn_apply').set_sensitive(True)
def on_btn_romaji_custom_table_clicked(self, widget):
self.__run_dialog_custom_key_table(widget, 'romaji')
@@ -1350,7 +1242,7 @@ class AnthySetup(object):
self.__run_dialog_custom_key_table(widget, 'thumb')
def on_btn_add_custom_key(self, widget, user_data):
- prefs = self.prefs
+ prefs = self.__prefs
input = self.__builder.get_object('entry_input_custom_key')
output = self.__builder.get_object('entry_output_custom_key')
left = self.__builder.get_object('entry_left_thumb_shift_custom_key')
@@ -1381,43 +1273,33 @@ class AnthySetup(object):
return
if type == 'romaji':
- section_base = 'romaji_typing_rule'
+ section = 'romaji-typing-rule'
model.append([type, key, value])
elif type == 'kana':
- section_base = 'kana_typing_rule'
+ section = 'kana-typing-rule'
model.append([type, key, value])
elif type == 'thumb':
- section_base = 'thumb_typing_rule'
+ section = 'thumb-typing-rule'
model.append([type, key, value, left_text, right_text])
- if section_base == None:
+ if section == None:
self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug."))
return
gkey = prefs.typing_to_config_key(key)
if gkey == '':
return
key = gkey
- section = section_base + '/' + method
- if key not in prefs.keys(section):
- # ibus does not support gconf_client_all_entries().
- # prefs.fetch_section() doesn't get the keys if they exist
- # in gconf only.
- # Use newkeys for that way.
- newkeys = prefs.get_value(section_base, 'newkeys')
- if key not in newkeys:
- newkeys.append(key)
- prefs.set_value(section_base, 'newkeys', newkeys)
if type != 'thumb':
- prefs.set_value(section, key, value)
+ prefs.set_list_item(section, 'list', (method, key), value)
else:
- prefs.set_value(section, key, [value, right_text, left_text])
+ prefs.set_list_item(section, 'list',
+ (method, key), [value, right_text, left_text])
left.set_text('')
right.set_text('')
input.set_text('')
output.set_text('')
- self.__builder.get_object('btn_apply').set_sensitive(True)
def on_btn_remove_custom_key(self, widget, user_data):
- prefs = self.prefs
+ prefs = self.__prefs
combobox = self.__builder.get_object('combobox_custom_key_table')
id = combobox.get_active()
model_combobox = combobox.get_model()
@@ -1428,31 +1310,21 @@ class AnthySetup(object):
key = l[i][1]
section_base = None
if type == 'romaji':
- section_base = 'romaji_typing_rule'
+ section = 'romaji-typing-rule'
elif type == 'kana':
- section_base = 'kana_typing_rule'
+ section = 'kana-typing-rule'
elif type == 'thumb':
- section_base = 'thumb_typing_rule'
- if section_base == None:
+ section = 'thumb-typing-rule'
+ if section == None:
self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug."))
return
- section = section_base + '/' + method
- newkeys = prefs.get_value(section_base, 'newkeys')
gkey = prefs.typing_to_config_key(key)
if gkey == '':
return
key = gkey
- if key in newkeys:
- newkeys.remove(key)
- prefs.set_value(section_base, 'newkeys', newkeys)
- # config.set_value(key, None) is not supported.
- if type != 'thumb':
- prefs.set_value(section, key, '')
- else:
- prefs.set_value(section, key, ['', '', ''])
+ prefs.delete_list_item(section, 'list', (method, key))
l.remove(i)
widget.set_sensitive(False)
- self.__builder.get_object('btn_apply').set_sensitive(True)
def on_btn_thumb_key_clicked(self, widget):
if Gtk.Buildable.get_name(widget) == 'thumb:button_ls':
@@ -1487,18 +1359,17 @@ class AnthySetup(object):
new = l[i][0]
if new != text:
section, key = self.__get_section_key(entry)
- self.prefs.set_value(section, key, new)
+ self.__prefs.set_value(section, key, new)
self.__builder.get_object(entry).set_text(new)
- self.__builder.get_object('btn_apply').set_sensitive(True)
def on_btn_dict_command_clicked(self, widget):
if Gtk.Buildable.get_name(widget) == 'dict:btn_edit_dict_command':
- key = 'dict_admin_command'
+ key = 'dict-admin-command'
elif Gtk.Buildable.get_name(widget) == 'dict:btn_add_word_command':
- key = 'add_word_command'
+ key = 'add-word-command'
else:
return
- command = self.prefs.get_value('common', key)
+ command = self.__prefs.get_value('common', key)
if not path.exists(command[0]):
self.__run_message_dialog(_("Your file does not exist: ") + command[0],
Gtk.MessageType.ERROR)
@@ -1559,17 +1430,19 @@ class AnthySetup(object):
if selected_id == None:
return
- if self.__is_system_dict_file_from_id(selected_id):
+ dict_item = self.__prefs.get_value('dict', 'list')[selected_id]
+ if dict_item.is_system:
self.__run_message_dialog(_("You cannot delete the system dictionary."),
Gtk.MessageType.ERROR)
return
file = self.__get_dict_file_from_id(selected_id)
if file != None:
- files = self.prefs.get_value('dict', 'files')
- files.remove(file)
- self.prefs.set_value('dict', 'files', files)
- self.__builder.get_object('btn_apply').set_sensitive(True)
+ order = self.__prefs.get_value('dict', 'order')
+ order.remove(selected_id)
+ order = self.__prefs.set_value('dict', 'order', order)
+ self.__prefs.delete_list_item('dict', 'files', selected_id)
+ self.__prefs.delete_list_item('dict', 'list', selected_id)
l.remove(i)
return
@@ -1586,27 +1459,19 @@ class AnthySetup(object):
self.__run_message_dialog(_("Your file is not good."),
Gtk.MessageType.ERROR)
return
- if not path.exists(dict_file):
+ if not path.exists(dict_file[0]):
self.__run_message_dialog(_("Your file does not exist: ") + dict_file,
Gtk.MessageType.ERROR)
return
- if dict_file == None:
- return
-
# The selected id is already quoted.
- section = 'dict/file/' + selected_id
- if 'preview_lines' not in self.prefs.keys(section):
- section = 'dict/file/default'
- nline = self.prefs.get_value(section, 'preview_lines')
-
- section = 'dict/file/' + selected_id
- if 'encoding' not in self.prefs.keys(section):
- section = 'dict/file/default'
- encoding = self.prefs.get_value(section, 'encoding')
+ dicts = self.__prefs.get_value('dict', 'list')
+ dict_item = dicts[selected_id]
+ nline = dict_item.preview_lines
+ encoding = dict_item.encoding
lines = '';
- for i, line in enumerate(file(dict_file)):
+ for i, line in enumerate(file(dict_file[0])):
if nline >= 0 and i >= nline:
break;
lines = lines + line
@@ -1651,7 +1516,6 @@ class AnthySetup(object):
dlg.destroy()
def on_btn_dict_order_clicked(self, widget):
- dict_file = None
l, it = self.__builder.get_object('dict:view').get_selection().get_selected()
if not it:
@@ -1672,45 +1536,35 @@ class AnthySetup(object):
if next_it:
l.swap(it, next_it)
- dict_file = self.__get_dict_file_from_id(selected_id)
- files = self.prefs.get_value('dict', 'files')
+ order = self.__prefs.get_value('dict', 'order')
+ if len(order) == 0:
+ order = list(self.__prefs.get_value('dict', 'files').keys())
+ i = order.index(selected_id)
- if dict_file == None:
- return
-
- i = files.index(dict_file)
if Gtk.Buildable.get_name(widget) == 'dict:btn_up':
if i <= 0:
return
next_i = i - 1
elif Gtk.Buildable.get_name(widget) == 'dict:btn_down':
- if i + 1 >= len(dict_file):
+ if i + 1 >= len(order):
return
next_i = i + 1
- f = files[i]
- files[i] = files[next_i]
- files[next_i] = f
- self.prefs.set_value('dict', 'files', files)
- self.__builder.get_object('btn_apply').set_sensitive(True)
-
- def _get_shortcut_sec(self):
- l = ['default', 'atok', 'wnn']
- iter = self.__builder.get_object('shortcut_type').get_active_iter()
- model = self.__builder.get_object('shortcut_type').get_model()
- s_type = model[iter][0].lower()
- return 'shortcut/' + (s_type if s_type in l else 'default')
+ f = order[i]
+ order[i] = order[next_i]
+ order[next_i] = f
+ self.__prefs.set_value('dict', 'order', order)
def on_shortcut_type_changed(self, widget):
ls = self.__builder.get_object('shortcut').get_model()
ls.clear()
- sec = self._get_shortcut_sec()
- for k in self.prefs.keys(sec):
- ls.append([k, l_to_s(self.prefs.get_value(sec, k))])
+ group = self.__get_shortcut_group()
+ shortcuts = self.__prefs.get_value('shortcut', group)
+ for k in shortcuts.keys():
+ ls.append([k, l_to_s(shortcuts[k])])
section, key = self.__get_section_key(Gtk.Buildable.get_name(widget))
- self.prefs.set_value(section, key, sec[len('shortcut/'):])
- self.__builder.get_object('btn_apply').set_sensitive(True)
+ self.__prefs.set_value(section, key, group)
def on_shortcut_key_release_event(self, widget, event):
if event.hardware_keycode in [36, 65]:
@@ -1755,7 +1609,9 @@ class AnthySetup(object):
if not widget.get_text():
return
list = widget.get_text().split()
- if list[0][0] == '/':
+ if len(list) == 0:
+ return
+ elif list[0][0] == '/':
if len(list) == 1:
list.append(list[0][list[0].rfind('/') + 1:])
else:
@@ -1766,14 +1622,13 @@ class AnthySetup(object):
else:
list.insert(0, '/usr/bin/' + list[0])
list[1] = list[1][list[1].rfind('/') + 1:]
- if Gtk.Buildable.get_name(widget) == 'dict:entry_edit_dict_command':
- key = 'dict_admin_command'
- elif Gtk.Buildable.get_name(widget) == 'dict:entry_add_word_command':
- key = 'add_word_command'
+ if Gtk.Buildable.get_name(widget) == 'dict:entry-edit-dict-command':
+ key = 'dict-admin-command'
+ elif Gtk.Buildable.get_name(widget) == 'dict:entry-add-word-command':
+ key = 'add-word-command'
else:
return
- self.prefs.set_value('common', key, list)
- self.__builder.get_object('btn_apply').set_sensitive(True)
+ self.__prefs.set_value('common', key, list)
def on_es_entry_changed(self, widget):
if not widget.get_text():
diff --git a/setup/python2/prefs.py b/setup/python2/prefs.py
index 520742e..5429f10 100644
--- a/setup/python2/prefs.py
+++ b/setup/python2/prefs.py
@@ -4,8 +4,8 @@
#
# Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2009 Hideaki ABE <abe.sendai@gmail.com>
-# Copyright (c) 2010-2016 Takao Fujiwara <takao.fujiwara1@gmail.com>
-# Copyright (c) 2007-2016 Red Hat, Inc.
+# Copyright (c) 2010-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,39 +24,101 @@
import sys
from gi import require_version as gi_require_version
+gi_require_version('Gio', '2.0')
gi_require_version('GLib', '2.0')
gi_require_version('IBus', '1.0')
+from gi.repository import Gio
from gi.repository import GLib
+from gi.repository import GObject
from gi.repository import IBus
-class Prefs(object):
- _prefix = 'engine/dummy'
-
- def __init__(self, bus=None, config=None):
- self.default = {}
- self.modified = {}
- self.new = {}
- self.__no_key_warning = False
-
- # self._config is used by AnthyPrefs .
- self._config = config if config else \
- bus.get_config() if bus else \
- IBus.Bus().get_config()
-
- # ibus_config_get_values enhances the performance.
- self.__has_config_get_values = False
-
- if self._config != None:
- self.__has_config_get_values = hasattr(self._config, 'get_values')
- else:
- self.printerr(
- 'ibus-config is not running or bus address is not correct.')
-
- def __log_handler(self, domain, level, message, data):
- if not data:
- return
- GLib.log_default_handler(domain, level, message, '')
+class DictItem():
+ def __init__(self,
+ id='',
+ short_label='',
+ long_label='',
+ icon='',
+ is_system=False,
+ preview_lines=-1,
+ embed=False,
+ single=True,
+ reverse=False,
+ encoding='utf-8'):
+ self.id = id
+ self.short_label = short_label
+ self.long_label = long_label
+ self.icon = icon
+ self.is_system = is_system
+ self.preview_lines = preview_lines
+ self.embed = embed
+ self.single = single
+ self.reverse = reverse
+ self.encoding = encoding
+
+ def __str__(self):
+ retval = ('id:', self.id,
+ 'short-label:', self.short_label,
+ 'long-label:', self.long_label,
+ 'icon:', self.icon,
+ 'is-system:', self.is_system,
+ 'preview-lines:', self.preview_lines,
+ 'embed:', self.embed,
+ 'single:', self.single,
+ 'reverse:', self.reverse,
+ 'encoding:', self.encoding)
+ return str(retval)
+
+ @classmethod
+ def serialize(cls, dict_item):
+ builder = GLib.VariantBuilder(GLib.VariantType('r'))
+ builder.add_value(GLib.Variant.new_string(dict_item.id))
+ builder.add_value(GLib.Variant.new_string(dict_item.short_label))
+ builder.add_value(GLib.Variant.new_string(dict_item.long_label))
+ builder.add_value(GLib.Variant.new_string(dict_item.icon))
+ builder.add_value(GLib.Variant.new_boolean(dict_item.is_system))
+ builder.add_value(GLib.Variant.new_int32(dict_item.preview_lines))
+ builder.add_value(GLib.Variant.new_boolean(dict_item.embed))
+ builder.add_value(GLib.Variant.new_boolean(dict_item.single))
+ builder.add_value(GLib.Variant.new_boolean(dict_item.reverse))
+ builder.add_value(GLib.Variant.new_string(dict_item.encoding))
+ return builder.end()
+
+class Prefs(GObject.GObject):
+ __gsignals__ = {
+ 'changed' : (
+ GObject.SignalFlags.RUN_FIRST,
+ None,
+ (str, str, GLib.Variant)),
+ }
+
+ def __init__(self):
+ super(Prefs, self).__init__()
+ self.__cache = {}
+ self.__settings = {}
+ self.__schema_prefix = 'org.freedesktop.ibus.engine.anthy.'
+ self.__schema_sections = ['common',
+ 'shortcut',
+ 'romaji-typing-rule',
+ 'kana-typing-rule',
+ 'thumb-typing-rule',
+ 'thumb',
+ 'dict']
+ for section in self.__schema_sections:
+ self.__settings[section] = Gio.Settings(
+ schema=self.__schema_prefix + section)
+ self.__settings[section].connect('changed',
+ self.__settings_on_changed)
+
+ def __settings_on_changed(self, settings, key):
+ section = settings.props.schema[len(self.__schema_prefix):]
+ variant_value = self.__settings[section].get_value(key)
+ variant_key = self.__cache.get(section)
+ if variant_key == None:
+ variant_key = {}
+ variant_key[key] = variant_value
+ self.__cache[section] = variant_key
+ self.emit('changed', section, key, variant_value)
def variant_to_value(self, variant):
if type(variant) != GLib.Variant:
@@ -68,7 +130,9 @@ class Prefs(object):
return variant.get_int32()
elif type_string == 'b':
return variant.get_boolean()
- elif type_string == 'as':
+ elif type_string == 'v':
+ return variant.unpack()
+ elif len(type_string) > 0 and type_string[0] == 'a':
# Use unpack() instead of dup_strv() in python.
# In the latest pygobject3 3.3.4 or later, g_variant_dup_strv
# returns the allocated strv but in the previous release,
@@ -79,174 +143,165 @@ class Prefs(object):
sys.abrt()
return variant
- def set_no_key_warning(self, no_key_warning):
- if no_key_warning and hasattr(IBus, 'unset_log_handler'):
- self.__no_key_warning = True
- else:
- self.__no_key_warning = False
-
- def keys(self, section):
- return self.default[section].keys()
-
- def sections(self):
- return self.default.keys()
-
- def set_new_section(self, section):
- self.default.setdefault(section, {})
+ def variant_from_value(self, value):
+ variant = None
+ if type(value) == str:
+ variant = GLib.Variant.new_string(value)
+ elif type(value) == int:
+ variant = GLib.Variant.new_int32(value)
+ elif type(value) == bool:
+ variant = GLib.Variant.new_boolean(value)
+ elif type(value) == list:
+ variant = GLib.Variant.new_strv(value)
+ if variant == None:
+ self.printerr('Unknown value type: %s' % type(value))
+ return variant
- def set_new_key(self, section, key):
- self.default[section].setdefault(key)
+ def get_variant(self, section, key):
+ variant_key = self.__cache.get(section)
+ if variant_key != None:
+ variant_value = variant_key.get(key)
+ if variant_value != None:
+ return variant_value
+ variant_value = self.__settings[section].get_value(key)
+ if variant_key == None:
+ variant_key = {}
+ variant_key[key] = variant_value
+ self.__cache[section] = variant_key
+ return variant_value
+
+ def get_default_variant(self, section, key):
+ return self.__settings[section].get_default_value(key)
+
+ def get_readable_value(self, section, key, variant):
+ value = self.variant_to_value(variant)
+ if section == 'dict' and key == 'list':
+ dicts = {}
+ for item in value:
+ dict_item = DictItem(*item)
+ dicts[dict_item.id] = dict_item
+ value = dicts
+ if section == 'dict' and key == 'template':
+ value = DictItem(*value)
+ return value
def get_value(self, section, key):
- try:
- return self.new[section][key]
- except:
- try:
- return self.modified[section][key]
- except:
- return self.default[section][key]
+ variant = self.get_variant(section, key)
+ return self.get_readable_value(section, key, variant)
- def get_value_direct(self, section, key, default=None):
- if self._config == None:
- return default
+ def get_default_value(self, section, key):
+ variant = self.get_default_variant(section, key)
+ return self.get_readable_value(section, key, variant)
- 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
+ def set_variant(self, section, key, variant):
+ self.__settings[section].set_value(key, variant)
+ self.__settings[section].apply()
def set_value(self, section, key, value):
- if section not in self.sections():
- self.set_new_section(section)
- if key not in self.keys(section):
- self.set_new_key(section, key)
- self.default[section][key]
- self.new.setdefault(section, {})[key] = value
-
- def fetch_all(self):
- for s in self.sections():
- self.fetch_section(s)
-
- def fetch_section(self, section):
- if self._config == None:
+ variant = self.variant_from_value(value)
+ if variant == None:
return
+ self.set_variant(section, key, variant)
- if not self.__has_config_get_values:
- for k in self.keys(section):
- self.fetch_item(section, k)
+ def set_list_item(self, section, key, item, values):
+ variant = self.get_variant(section, key)
+ if variant == None:
+ printerrr('%s:%s does not exist' % (section, key))
return
-
- s = '/'.join(
- [s for s in '/'.join([self._prefix, section]).split('/') if s])
- variant = self._config.get_values(s)
- for key in variant.keys():
- v = variant[key]
- self.modified.setdefault(section, {})[key] = v if v != [''] else []
- # FIXME: ibus-dconf converts the keys.
- if section == 'common':
- self.fetch_item(section, 'show-input-mode')
- self.fetch_item(section, 'show-typing-method')
- self.fetch_item(section, 'show-segment-mode')
- self.fetch_item(section, 'show-dict-mode')
- self.fetch_item(section, 'show-dict-config')
- self.fetch_item(section, 'show-preferences')
-
- def fetch_item(self, section, key, readonly=False):
- if self._config == None:
+ if section == 'shortcut':
+ variant_dict = GLib.VariantDict(variant)
+ array = []
+ for value in values:
+ array.append(GLib.Variant.new_string(value))
+ varray = GLib.Variant.new_array(GLib.VariantType('s'), array)
+ variant_dict.insert_value(item, varray)
+ # GVariantDict uses GHashTable internally and
+ # GVariantDict.end() does not support the order.
+ self.set_variant(section, key, variant_dict.end())
+ return
+ if section == 'romaji-typing-rule' or \
+ section == 'kana-typing-rule' or \
+ section == 'thumb-typing-rule':
+ (method, keymap_key) = item
+ variant_dict = GLib.VariantDict(variant)
+ keymap = variant_dict.lookup_value(method, None)
+ keymap_dict = GLib.VariantDict(keymap)
+ if section == 'thumb-typing-rule':
+ array = []
+ for value in values:
+ array.append(GLib.Variant.new_string(value))
+ vvalue = GLib.Variant.new_array(GLib.VariantType('s'), array)
+ else:
+ vvalue = GLib.Variant.new_string(values)
+ keymap_dict.insert_value(keymap_key, vvalue)
+ keymap = keymap_dict.end()
+ variant_dict.insert_value(method, keymap)
+ self.set_variant(section, key, variant_dict.end())
+ return
+ if section == 'dict' and key == 'files':
+ variant_dict = GLib.VariantDict(variant)
+ array = []
+ for value in values:
+ array.append(GLib.Variant.new_string(value))
+ varray = GLib.Variant.new_array(GLib.VariantType('s'), array)
+ variant_dict.insert_value(item, varray)
+ self.set_variant(section, key, variant_dict.end())
+ return
+ if section == 'dict' and key == 'list':
+ array = []
+ has_item = False
+ for v in variant:
+ dict_item = DictItem(*v)
+ if dict_item.id == values.id:
+ array.append(GLib.Variant.new_variant(
+ DictItem.serialize(values)))
+ has_item = True
+ else:
+ array.append(GLib.Variant.new_variant(
+ DictItem.serialize(dict_item)))
+ if not has_item:
+ array.append(GLib.Variant.new_variant(DictItem.serialize(values)))
+ varray = GLib.Variant.new_array(GLib.VariantType('v'), array)
+ self.set_variant(section, key, varray)
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
-
- def commit_all(self):
- for s in self.new.keys():
- self.commit_section(s)
-
- def commit_section(self, section):
- if section in self.new:
- for k in self.new[section].keys():
- self.commit_item(section, k)
-
- def commit_item(self, section, key):
- if section in self.new and key in self.new[section]:
- s = '/'.join(
- [s for s in '/'.join([self._prefix, section]).split('/') if s])
- v = self.new[section][key]
- if v == []:
- v = ['']
- variant = None
- if type(v) == str:
- variant = GLib.Variant.new_string(v)
- elif type(v) == int:
- variant = GLib.Variant.new_int32(v)
- elif type(v) == bool:
- variant = GLib.Variant.new_boolean(v)
- elif type(v) == list:
- variant = GLib.Variant.new_strv(v)
- if variant == None:
- self.printerr('Unknown value type:', type(v))
- sys.abrt()
- if self._config != None:
- self._config.set_value(s, key, variant)
- self.modified.setdefault(section, {})[key] = v
- del(self.new[section][key])
-
- def undo_all(self):
- self.new.clear()
-
- def undo_section(self, section):
- try:
- del(self.new[section])
- except:
- pass
-
- def undo_item(self, section, key):
- try:
- del(self.new[section][key])
- except:
- pass
-
- def set_default_all(self):
- for s in self.sections():
- self.set_default_section(s)
-
- def set_default_section(self, section):
- for k in self.keys(section):
- self.set_default_item(section, k)
+ def delete_list_item(self, section, key, item):
+ variant = self.get_variant(section, key)
+ if variant == None:
+ printerrr('%s:%s does not exist' % (section, key))
+ return
+ if section == 'romaji-typing-rule' or \
+ section == 'kana-typing-rule' or \
+ section == 'thumb-typing-rule':
+ (method, keymap_key) = item
+ variant_dict = GLib.VariantDict(variant)
+ keymap = variant_dict.lookup_value(method, None)
+ keymap_dict = GLib.VariantDict(keymap)
+ keymap_dict.remove(keymap_key)
+ keymap = keymap_dict.end()
+ variant_dict.insert_value(method, keymap)
+ self.set_variant(section, key, variant_dict.end())
+ return
+ if section == 'dict' and key == 'files':
+ variant_dict = GLib.VariantDict(variant)
+ variant_dict.remove(item)
+ self.set_variant(section, key, variant_dict.end())
+ return
+ if section == 'dict' and key == 'list':
+ array = []
+ for v in variant:
+ dict_item = DictItem(*v)
+ if dict_item.id == item:
+ continue
+ else:
+ array.append(GLib.Variant.new_variant(
+ DictItem.serialize(dict_item)))
+ varray = GLib.Variant.new_array(GLib.VariantType('v'), array)
+ self.set_variant(section, key, varray)
+ return
- def set_default_item(self, section, key):
- try:
- if key in self.modified[section] or key in self.new[section]:
- self.new[section][key] = self.default[section][key]
- except:
- pass
+ def bind(self, section, key, object, property, flags):
+ self.__settings[section].bind(key, object, property, flags)
# Convert DBus.String to str
# sys.getdefaultencoding() == 'utf-8' with pygtk2 but
diff --git a/setup/python2/setup.ui b/setup/python2/setup.ui
index f0acbc6..61d9325 100644
--- a/setup/python2/setup.ui
+++ b/setup/python2/setup.ui
@@ -196,7 +196,7 @@
<property name="visible">False</property>
<property name="title" translatable="yes">Setup - IBus-Anthy</property>
<property name="type_hint">dialog</property>
- <signal handler="on_main_delete" name="delete_event"/>
+ <signal handler="on_main_quit" name="delete_event"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
@@ -232,7 +232,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">_Input Mode:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">input_mode</property>
+ <property name="mnemonic_widget">input-mode</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -240,9 +240,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="input_mode">
+ <object class="GtkComboBox" id="input-mode">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model1</property>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
@@ -263,7 +262,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">_Typing Method:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">typing_method</property>
+ <property name="mnemonic_widget">typing-method</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -273,9 +272,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="typing_method">
+ <object class="GtkComboBox" id="typing-method">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model2</property>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
@@ -298,7 +296,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">Conversion _Mode:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">conversion_segment_mode</property>
+ <property name="mnemonic_widget">conversion-segment-mode</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -308,9 +306,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="conversion_segment_mode">
+ <object class="GtkComboBox" id="conversion-segment-mode">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model3</property>
<child>
<object class="GtkCellRendererText" id="renderer3"/>
@@ -366,7 +363,7 @@
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="menu_visible:treeview">
+ <object class="GtkTreeView" id="menu-visible:treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
@@ -430,7 +427,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">_Period Style:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">period_style</property>
+ <property name="mnemonic_widget">period-style</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -443,7 +440,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">Symbo_l Style:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">symbol_style</property>
+ <property name="mnemonic_widget">symbol-style</property>
</object>
<packing>
<property name="top_attach">1</property>
@@ -458,7 +455,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">Numpad _Key Type:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">ten_key_mode</property>
+ <property name="mnemonic_widget">ten-key-mode</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -468,9 +465,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="ten_key_mode">
+ <object class="GtkComboBox" id="ten-key-mode">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model4</property>
<child>
<object class="GtkCellRendererText" id="renderer4"/>
@@ -488,9 +484,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="symbol_style">
+ <object class="GtkComboBox" id="symbol-style">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model5</property>
<child>
<object class="GtkCellRendererText" id="renderer5"/>
@@ -508,9 +503,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="period_style">
+ <object class="GtkComboBox" id="period-style">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model6</property>
<child>
<object class="GtkCellRendererText" id="renderer6"/>
@@ -531,7 +525,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">_Behavior on Period:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">behavior_on_period</property>
+ <property name="mnemonic_widget">behavior-on-period</property>
</object>
<packing>
<property name="top_attach">3</property>
@@ -546,7 +540,7 @@
<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">behavior_on_focus_out</property>
+ <property name="mnemonic_widget">behavior-on-focus-out</property>
</object>
<packing>
<property name="top_attach">4</property>
@@ -556,9 +550,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="behavior_on_period">
+ <object class="GtkComboBox" id="behavior-on-period">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model7</property>
<child>
<object class="GtkCellRendererText" id="renderer7"/>
@@ -576,9 +569,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="behavior_on_focus_out">
+ <object class="GtkComboBox" id="behavior-on-focus-out">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model8</property>
<child>
<object class="GtkCellRendererText" id="renderer8"/>
@@ -636,7 +628,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">Candidate _Window Page Size:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">page_size</property>
+ <property name="mnemonic_widget">page-size</property>
</object>
<packing>
<property name="expand">False</property>
@@ -645,12 +637,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="page_size">
+ <object class="GtkSpinButton" id="page-size">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
<property name="climb_rate">0.97999999999999998</property>
- <signal handler="on_sb_changed" name="value_changed"/>
</object>
<packing>
<property name="expand">False</property>
@@ -664,14 +655,13 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="half_width_symbol">
+ <object class="GtkCheckButton" id="half-width-symbol">
<property name="label" translatable="yes">Convert _symbols with the one column width</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <signal handler="on_ck_toggled" name="toggled"/>
<accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
</object>
<packing>
@@ -681,14 +671,13 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="half_width_number">
+ <object class="GtkCheckButton" id="half-width-number">
<property name="label" translatable="yes">Convert _numbers with the one column width</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <signal handler="on_ck_toggled" name="toggled"/>
<accelerator key="N" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
</object>
<packing>
@@ -698,14 +687,13 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="half_width_space">
+ <object class="GtkCheckButton" id="half-width-space">
<property name="label" translatable="yes">Con_vert spaces with the one column width</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <signal handler="on_ck_toggled" name="toggled"/>
<accelerator key="v" modifiers="GDK_MOD1_MASK" signal="activate"/>
</object>
<packing>
@@ -715,14 +703,13 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="latin_with_shift">
+ <object class="GtkCheckButton" id="latin-with-shift">
<property name="label" translatable="yes">Swi_tch “Hiragana” and “Latin” with Shift key and Hiragana–Katakana key in preedit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <signal handler="on_ck_toggled" name="toggled"/>
<accelerator key="t" modifiers="GDK_MOD1_MASK" signal="activate"/>
</object>
<packing>
@@ -777,7 +764,7 @@
<property name="label" translatable="yes">_Shortcut Type:</property>
<property name="use_underline">True</property>
<property name="wrap_mode">word-char</property>
- <property name="mnemonic_widget">shortcut_type</property>
+ <property name="mnemonic_widget">shortcut-type</property>
</object>
<packing>
<property name="expand">False</property>
@@ -787,7 +774,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="shortcut_type">
+ <object class="GtkComboBox" id="shortcut-type">
<property name="visible">True</property>
<signal handler="on_shortcut_type_changed" name="changed"/>
<property name="model">model9</property>
@@ -1271,7 +1258,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="thumb:keyboard_layout_mode">
+ <object class="GtkCheckButton" id="thumb:keyboard-layout-mode">
<property name="label" translatable="yes">Adjust _input method layout to system keyboard layout</property>
<property name="tooltip_text" translatable="yes">Adjust IM layout to XKB layout</property>
<property name="visible">True</property>
@@ -1279,7 +1266,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <signal handler="on_ck_toggled" name="toggled"/>
<accelerator key="I" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
</object>
<packing>
@@ -1299,7 +1285,7 @@
<property name="xalign">0</property>
<property name="use_underline">True</property>
<property name="label" translatable="yes">Input _Method Layout:</property>
- <property name="mnemonic_widget">thumb:keyboard_layout</property>
+ <property name="mnemonic_widget">thumb:keyboard-layout</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1308,9 +1294,8 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="thumb:keyboard_layout">
+ <object class="GtkComboBox" id="thumb:keyboard-layout">
<property name="visible">True</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model51</property>
<child>
<object class="GtkCellRendererText" id="renderer10"/>
@@ -1378,7 +1363,7 @@
<property name="xalign">0</property>
<property name="use_underline">True</property>
<property name="label" translatable="yes">_Additional Key Arrangement:</property>
- <property name="mnemonic_widget">thumb:fmv_extension</property>
+ <property name="mnemonic_widget">thumb:fmv-extension</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1387,10 +1372,9 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="thumb:fmv_extension">
+ <object class="GtkComboBox" id="thumb:fmv-extension">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">'&#xFF5E;', '&#x300E;', '&#xA2;', '&#xA3;' and so on can be output with Thumb Shift key</property>
- <signal handler="on_cb_changed" name="changed"/>
<property name="model">model11</property>
<child>
<object class="GtkCellRendererText" id="renderer11"/>
@@ -1457,7 +1441,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <signal handler="on_ck_toggled" name="toggled"/>
<accelerator key="E" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
</object>
<packing>
@@ -1576,7 +1559,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">_Edit Dictionary Command:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">dict:entry_edit_dict_command</property>
+ <property name="mnemonic_widget">dict:entry-edit-dict-command</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -1587,7 +1570,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="dict:entry_edit_dict_command">
+ <object class="GtkEntry" id="dict:entry-edit-dict-command">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -1627,7 +1610,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">_Add Word Command:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">dict:entry_add_word_command</property>
+ <property name="mnemonic_widget">dict:entry-add-word-command</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -1640,7 +1623,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="dict:entry_add_word_command">
+ <object class="GtkEntry" id="dict:entry-add-word-command">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -1921,15 +1904,14 @@
<property name="orientation">horizontal</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="btn_apply">
- <property name="label" translatable="yes">_Apply</property>
+ <object class="GtkButton" id="btn_close">
+ <property name="label" translatable="yes">_Close</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <signal handler="on_btn_apply_clicked" name="clicked"/>
+ <signal handler="on_btn_close_clicked" name="clicked"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1937,38 +1919,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkButton" id="btn_cancel">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="use_underline">True</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <signal handler="on_btn_cancel_clicked" name="clicked"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="btn_ok">
- <property name="label" translatable="yes">_OK</property>
- <property name="use_underline">True</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <signal handler="on_btn_ok_clicked" name="clicked"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -1979,9 +1929,7 @@
</object>
</child>
<action-widgets>
- <action-widget response="-10">btn_apply</action-widget>
- <action-widget response="-6">btn_cancel</action-widget>
- <action-widget response="-5">btn_ok</action-widget>
+ <action-widget response="-5">btn_close</action-widget>
</action-widgets>
</object>
<object class="GtkDialog" id="edit_shortcut">
@@ -2762,8 +2710,8 @@
<property name="program-name">IBus-Anthy</property>
<property name="copyright">Copyright © 2007–2008 Peng Huang
Copyright © 2009 Hideaki ABE
-Copyright © 2009–2016 Takao Fujiwara
-Copyright © 2007–2016 Red Hat, Inc.</property>
+Copyright © 2009–2017 Takao Fujiwara
+Copyright © 2007–2017 Red Hat, Inc.</property>
<property name="comments" translatable="yes">The Anthy engine for the IBus input platform</property>
<property name="license">GPL</property>
<property name="website">https://github.com/ibus/ibus/wiki</property>
diff --git a/setup/python3/main.py b/setup/python3/main.py
index e43c458..5fd3040 100644
--- a/setup/python3/main.py
+++ b/setup/python3/main.py
@@ -80,17 +80,6 @@ class AnthySetup(object):
self.__prefs = AnthyPrefs()
- # IBus.Bus() calls ibus_bus_new().
- # Gtk.Builder().add_from_file() also calls ibus_bus_new_async()
- # via ibus_im_context_new().
- # Then if IBus.Bus() is called after Gtk.Builder().add_from_file(),
- # the connection delay would be happened without an async
- # finish function.
- ibus_address = IBus.get_address()
- bus = None
- if ibus_address != None:
- bus = IBus.Bus(connect_async='True')
-
builder_file = path.join(path.dirname(__file__), 'setup.ui')
self.__builder = builder = Gtk.Builder()
builder.set_translation_domain(DOMAINNAME)
@@ -133,20 +122,9 @@ class AnthySetup(object):
toplevel.connect('notify::window', set_transient)
toplevel.show()
+ self.__init_bus_connected()
- if ibus_address == None:
- builder.connect_signals(self)
- # self.__run_message_dialog needs self.__builder.
- self.__run_message_dialog(_("ibus is not running."),
- Gtk.MessageType.ERROR)
- return
-
- if bus.is_connected():
- self.__init_bus_connected(bus)
- else:
- bus.connect('connected', self.__init_bus_connected)
-
- def __init_bus_connected(self, bus):
+ def __init_bus_connected(self):
builder = self.__builder
prefs = self.__prefs
@@ -670,10 +648,15 @@ class AnthySetup(object):
id = 0
# thumb uses all tables so the default is always 0.
if mode != 'thumb':
+ id = -1
for index, labels in enumerate(list_labels):
if labels[0] == method:
id = index
break
+ if id == -1:
+ ls.append([method, method])
+ combobox.set_model(ls)
+ id = len(list_labels)
combobox.set_active(id)
combobox.connect('changed', self.on_cb_custom_key_table_changed, mode)
@@ -1465,7 +1448,6 @@ class AnthySetup(object):
if selected_id == None:
return
- print('test', selected_id)
dict_file = self.__get_dict_file_from_id(selected_id)
if dict_file == None:
self.__run_message_dialog(_("Your file is not good."),
@@ -1640,7 +1622,6 @@ class AnthySetup(object):
key = 'add-word-command'
else:
return
- print('test', key, list)
self.__prefs.set_value('common', key, list)
def on_es_entry_changed(self, widget):
diff --git a/setup/python3/prefs.py b/setup/python3/prefs.py
index 0509ecb..6deb32b 100644
--- a/setup/python3/prefs.py
+++ b/setup/python3/prefs.py
@@ -301,7 +301,26 @@ class Prefs(GObject.GObject):
return
def bind(self, section, key, object, property, flags):
- self.__settings[section].bind(key, object, property, flags)
+ self.__settings[section].bind(key, object, property, flags)
+
+ # Convert DBus.String to str
+ # sys.getdefaultencoding() == 'utf-8' with pygtk2 but
+ # sys.getdefaultencoding() == 'ascii' with gi gtk3
+ # so the simple str(unicode_string) causes an error and need to use
+ # unicode_string.encode('utf-8') instead.
+ def str(self, uni):
+ if uni == None:
+ return None
+ if type(uni) == str:
+ return uni
+ return str(uni)
+
+ # The simple unicode(string) causes an error and need to use
+ # unicode(string, 'utf-8') instead.
+ def unicode(self, string):
+ if string == None:
+ return None
+ return string
# If the parent process exited, the std io/out/error will be lost.
@staticmethod
diff --git a/tests/anthytest.py b/tests/anthytest.py
index 1d282f2..cceafce 100644
--- a/tests/anthytest.py
+++ b/tests/anthytest.py
@@ -28,7 +28,6 @@ if 'IBUS_ANTHY_SETUP_PATH' in os.environ:
if setup_path != None and setup_path != '':
sys.path.append(setup_path)
sys.path.append('/usr/share/ibus-anthy/engine')
-import engine
from anthycases import TestCases
@@ -92,10 +91,12 @@ class AnthyTest:
interface_name, signal_name, parameters,
user_data):
if signal_name == 'NameOwnerChanged':
- engine.Engine.CONFIG_RELOADED(self.__bus)
+ import engine
+ engine.Engine.CONFIG_RELOADED()
def __create_engine_cb(self, factory, engine_name):
if engine_name == 'testanthy':
+ import engine
self.__id += 1
self.__engine = engine.Engine(self.__bus, '%s/%d' % (self.ENGINE_PATH, self.__id))
self.__engine.connect('focus-in', self.__engine_focus_in)
@@ -266,6 +267,11 @@ def print_help(out, v = 0):
print('-f, --force Run this program forcibly with .anthy.',
file=out)
print('-h, --help show this message.', file=out)
+ print('\nenvironment variables:', file=out)
+ print('IBUS_ANTHY_ENGINE_PATH Indicates the path which includes ' \
+ 'engine.py. the default is /usr/share/ibus-anthy/engine', file=out)
+ print('IBUS_ANTHY_SETUP_PATH Indicates the path which includes ' \
+ 'prefs.py. the default is /usr/share/ibus-anthy/setup', file=out)
sys.exit(v)
def get_userhome():
@@ -278,8 +284,8 @@ def get_userhome():
return userhome
def main():
- shortopt = 'ef'
- longopt = ['exit', 'force']
+ shortopt = 'efh'
+ longopt = ['exit', 'force', 'help']
force_run = False
try:
opts, args = getopt.getopt(sys.argv[1:], shortopt, longopt)
@@ -292,6 +298,8 @@ def main():
DONE_EXIT = True
elif o in ('-f', '--force'):
force_run = True
+ elif o in ('-h', '--help'):
+ print_help(sys.stderr)
else:
print('Unknown argument: %s' % o, file=sys.stderr)
print_help(sys.stderr, 1)