summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2012-10-26 10:22:44 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2012-10-26 10:22:44 +0900
commit4183ae6407274e6b6e70623aaa531f55f1c6b130 (patch)
treecf5cf68d2a26085a9cafd9736d838000dd4bc44b
parentaa669840d3084489f5e9613c184600565dff9825 (diff)
downloadibus-anthy-4183ae6407274e6b6e70623aaa531f55f1c6b130.tar.gz
Fixed kana table customizations. (#1403)
-rw-r--r--engine/engine.py4
-rw-r--r--engine/jastring.py42
-rw-r--r--engine/kana.py66
-rw-r--r--engine/tables.py196
-rw-r--r--setup/anthyprefs.py.in540
-rw-r--r--setup/main.py20
6 files changed, 541 insertions, 327 deletions
diff --git a/engine/engine.py b/engine/engine.py
index d6f17ab..ed4c117 100644
--- a/engine/engine.py
+++ b/engine/engine.py
@@ -1567,7 +1567,7 @@ class Engine(IBus.EngineSimple):
cls.__keybind = cls._mk_keybind()
- jastring.JaString._prefs = cls.__prefs
+ jastring.JaString.SET_PREFS(cls.__prefs)
@classmethod
def CONFIG_VALUE_CHANGED(cls, bus, section, name, variant):
@@ -1614,6 +1614,8 @@ class Engine(IBus.EngineSimple):
if base_sec not in cls.__prefs.sections():
cls._fetch_dict_values(base_sec)
cls.__prefs.set_value(base_sec, name, value)
+ elif base_sec.startswith('kana_typing_rule'):
+ jastring.JaString.RESET(cls.__prefs, base_sec, name, value)
elif base_sec:
cls.__prefs.set_value(base_sec, name, value)
else:
diff --git a/engine/jastring.py b/engine/jastring.py
index 84a5173..1b4ca02 100644
--- a/engine/jastring.py
+++ b/engine/jastring.py
@@ -49,21 +49,35 @@ TYPING_MODE_KANA, \
TYPING_MODE_THUMB_SHIFT = range(3)
class JaString:
+ _prefs = None
+
def __init__(self, mode=TYPING_MODE_ROMAJI):
- self.__mode = mode
- self.reset()
- romaji.RomajiSegment._init_romaji_typing_rule(self._prefs)
- kana.KanaSegment._init_kana_typing_rule(self._prefs)
- thumb.ThumbShiftSegment._init_thumb_typing_rule(self._prefs)
-
- def reset(self):
- self.__cursor = 0
- self.__segments = list()
- self.__shift = False
-
- def set_mode(self, mode):
- self.__mode = mode
- self.reset()
+ self._init_mode(mode)
+
+ @classmethod
+ def _init_mode(cls, mode):
+ cls.__mode = mode
+ cls.__cursor = 0
+ cls.__segments = list()
+ cls.__shift = False
+ if mode == TYPING_MODE_ROMAJI:
+ romaji.RomajiSegment._init_romaji_typing_rule(cls._prefs)
+ elif mode == TYPING_MODE_KANA:
+ kana.KanaSegment._init_kana_typing_rule(cls._prefs)
+ elif mode == TYPING_MODE_THUMB_SHIFT:
+ thumb.ThumbShiftSegment._init_thumb_typing_rule(cls._prefs)
+
+ @classmethod
+ def SET_PREFS(cls, prefs):
+ cls._prefs = prefs
+
+ @classmethod
+ def RESET(cls, prefs, section, name, value):
+ cls._prefs = prefs
+ if section.startswith('kana_typing_rule'):
+ mode = TYPING_MODE_KANA
+ kana.KanaSegment.RESET(prefs, section, name, value)
+ cls._init_mode(mode)
def set_shift(self, shift):
self.__shift = shift
diff --git a/engine/kana.py b/engine/kana.py
index 4dfce0c..01da82d 100644
--- a/engine/kana.py
+++ b/engine/kana.py
@@ -30,9 +30,9 @@ _UNFINISHED_HIRAGANA = set(u'かきくけこさしすせそたちつてとはひ
class KanaSegment(segment.Segment):
_prefs = None
- _kana_typing_rule_method = 'jp'
_kana_typing_rule_section = None
-
+ _kana_voiced_consonant_rule = None
+
def __init__(self, enchars=u'', jachars=u''):
if not jachars:
jachars = self.__get_kana_typing_rule(enchars, u'')
@@ -44,14 +44,62 @@ class KanaSegment(segment.Segment):
if prefs == None:
cls._kana_typing_rule_section = None
return
- method = prefs.get_value('kana_typing_rule', 'method')
+ if cls._kana_typing_rule_section == None:
+ cls._init_kana_typing_method()
+ if cls._kana_voiced_consonant_rule == None and \
+ cls._kana_typing_rule_section != 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')
if method == None:
method = 'jp'
- cls._kana_typing_rule_method = method
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
+ @classmethod
+ def _init_kana_voiced_consonant_rule(cls):
+ prefs = cls._prefs
+ # Create kana_voiced_consonant_rule dynamically.
+ # E.g. 't' + '@' on jp kbd becomes Hiragana GA
+ # 't' + '[' on us kbd becomes Hiragana GA
+ # 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)
+ key = prefs.typing_from_config_key(gkey)
+ if key == '':
+ continue
+ if value == unichr(0x309b).encode('utf-8'):
+ for no_voiced, voiced in \
+ kana_voiced_consonant_no_rule.items():
+ rule = no_voiced + key.decode('utf-8')
+ cls._kana_voiced_consonant_rule[rule] = voiced
+ if value == unichr(0x309c).encode('utf-8'):
+ for no_voiced, voiced in \
+ kana_semi_voiced_consonant_no_rule.items():
+ rule = no_voiced + key.decode('utf-8')
+ cls._kana_voiced_consonant_rule[rule] = voiced
+
+ @classmethod
+ def RESET(cls, prefs, section, name, 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.
+ cls._kana_voiced_consonant_rule = None
+
def __get_kana_typing_rule(self, enchars, retval=None):
prefs = self._prefs
value = None
@@ -64,6 +112,10 @@ class KanaSegment(segment.Segment):
except:
print >> sys.stderr, \
'Failed to encode UTF-8:', enchars
+ 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:
@@ -88,10 +140,8 @@ class KanaSegment(segment.Segment):
return []
if self._jachars:
text = self._jachars + enchar
- if self._kana_typing_rule_method == 'us':
- jachars = kana_voiced_consonant_us_rule.get(text, None)
- else:
- jachars = kana_voiced_consonant_rule.get(text, None)
+ if self._kana_voiced_consonant_rule != None:
+ jachars = self._kana_voiced_consonant_rule.get(text, None)
if jachars:
self._enchars = self._enchars + enchar
self._jachars = jachars
diff --git a/engine/tables.py b/engine/tables.py
index 93f4084..f093eb1 100644
--- a/engine/tables.py
+++ b/engine/tables.py
@@ -481,102 +481,114 @@ kana_typing_rule_static = {
u'¥' : u'ー',
}
-kana_voiced_consonant_rule = {
- u'か@' : u'が',
- u'き@' : u'ぎ',
- u'く@' : u'ぐ',
- u'け@' : u'げ',
- u'こ@' : u'ご',
- u'さ@' : u'ざ',
- u'し@' : u'じ',
- u'す@' : u'ず',
- u'せ@' : u'ぜ',
- u'そ@' : u'ぞ',
- u'た@' : u'だ',
- u'ち@' : u'ぢ',
- u'つ@' : u'づ',
- u'て@' : u'で',
- u'と@' : u'ど',
- u'は@' : u'ば',
- u'ひ@' : u'び',
- u'ふ@' : u'ぶ',
- u'へ@' : u'べ',
- u'ほ@' : u'ぼ',
- u'か`' : u'が',
- u'き`' : u'ぎ',
- u'く`' : u'ぐ',
- u'け`' : u'げ',
- u'こ`' : u'ご',
- u'さ`' : u'ざ',
- u'し`' : u'じ',
- u'す`' : u'ず',
- u'せ`' : u'ぜ',
- u'そ`' : u'ぞ',
- u'た`' : u'だ',
- u'ち`' : u'ぢ',
- u'つ`' : u'づ',
- u'て`' : u'で',
- u'と`' : u'ど',
- u'は`' : u'ば',
- u'ひ`' : u'び',
- u'ふ`' : u'ぶ',
- u'へ`' : u'べ',
- u'ほ`' : u'ぼ',
- u'は[' : u'ぱ',
- u'ひ[' : u'ぴ',
- u'ふ[' : u'ぷ',
- u'へ[' : u'ぺ',
- u'ほ[' : u'ぽ',
+kana_voiced_consonant_no_rule = {
+ u'か' : u'が',
+ u'き' : u'ぎ',
+ u'く' : u'ぐ',
+ u'け' : u'げ',
+ u'こ' : u'ご',
+ u'さ' : u'ざ',
+ u'し' : u'じ',
+ u'す' : u'ず',
+ u'せ' : u'ぜ',
+ u'そ' : u'ぞ',
+ u'た' : u'だ',
+ u'ち' : u'ぢ',
+ u'つ' : u'づ',
+ u'て' : u'で',
+ u'と' : u'ど',
+ u'は' : u'ば',
+ u'ひ' : u'び',
+ u'ふ' : u'ぶ',
+ u'へ' : u'べ',
}
-kana_voiced_consonant_us_rule = {
- u'か[' : u'が',
- u'き[' : u'ぎ',
- u'く[' : u'ぐ',
- u'け[' : u'げ',
- u'こ[' : u'ご',
- u'さ[' : u'ざ',
- u'し[' : u'じ',
- u'す[' : u'ず',
- u'せ[' : u'ぜ',
- u'そ[' : u'ぞ',
- u'た[' : u'だ',
- u'ち[' : u'ぢ',
- u'つ[' : u'づ',
- u'て[' : u'で',
- u'と[' : u'ど',
- u'は[' : u'ば',
- u'ひ[' : u'び',
- u'ふ[' : u'ぶ',
- u'へ[' : u'べ',
- u'ほ[' : u'ぼ',
- u'か{' : u'が',
- u'き{' : u'ぎ',
- u'く{' : u'ぐ',
- u'け{' : u'げ',
- u'こ{' : u'ご',
- u'さ{' : u'ざ',
- u'し{' : u'じ',
- u'す{' : u'ず',
- u'せ{' : u'ぜ',
- u'そ{' : u'ぞ',
- u'た{' : u'だ',
- u'ち{' : u'ぢ',
- u'つ{' : u'づ',
- u'て{' : u'で',
- u'と{' : u'ど',
- u'は{' : u'ば',
- u'ひ{' : u'び',
- u'ふ{' : u'ぶ',
- u'へ{' : u'べ',
- u'ほ{' : u'ぼ',
- u'は]' : u'ぱ',
- u'ひ]' : u'ぴ',
- u'ふ]' : u'ぷ',
- u'へ]' : u'ぺ',
- u'ほ]' : u'ぽ',
+kana_semi_voiced_consonant_no_rule = {
+ u'は' : u'ぱ',
+ u'ひ' : u'ぴ',
+ u'ふ' : u'ぷ',
+ u'へ' : u'ぺ',
+ u'ほ' : u'ぽ',
}
+# Create the table dynamically with kana_voiced_consonant_no_rule
+#
+#kana_voiced_consonant_rule = {
+# u'か@' : u'が',
+# u'き@' : u'ぎ',
+# u'く@' : u'ぐ',
+# u'け@' : u'げ',
+# u'こ@' : u'ご',
+# u'さ@' : u'ざ',
+# u'し@' : u'じ',
+# u'す@' : u'ず',
+# u'せ@' : u'ぜ',
+# u'そ@' : u'ぞ',
+# u'た@' : u'だ',
+# u'ち@' : u'ぢ',
+# u'つ@' : u'づ',
+# u'て@' : u'で',
+# u'と@' : u'ど',
+# u'は@' : u'ば',
+# u'ひ@' : u'び',
+# u'ふ@' : u'ぶ',
+# u'へ@' : u'べ',
+# u'ほ@' : u'ぼ',
+# u'か`' : u'が',
+# u'き`' : u'ぎ',
+# u'く`' : u'ぐ',
+# u'け`' : u'げ',
+# u'こ`' : u'ご',
+# u'さ`' : u'ざ',
+# u'し`' : u'じ',
+# u'す`' : u'ず',
+# u'せ`' : u'ぜ',
+# u'そ`' : u'ぞ',
+# u'た`' : u'だ',
+# u'ち`' : u'ぢ',
+# u'つ`' : u'づ',
+# u'て`' : u'で',
+# u'と`' : u'ど',
+# u'は`' : u'ば',
+# u'ひ`' : u'び',
+# u'ふ`' : u'ぶ',
+# u'へ`' : u'べ',
+# u'ほ`' : u'ぼ',
+# u'は[' : u'ぱ',
+# u'ひ[' : u'ぴ',
+# u'ふ[' : u'ぷ',
+# u'へ[' : u'ぺ',
+# u'ほ[' : u'ぽ',
+#}
+#
+#kana_voiced_consonant_us_rule = {
+# u'か[' : u'が',
+# u'き[' : u'ぎ',
+# u'く[' : u'ぐ',
+# u'け[' : u'げ',
+# u'こ[' : u'ご',
+# u'さ[' : u'ざ',
+# u'し[' : u'じ',
+# u'す[' : u'ず',
+# u'せ[' : u'ぜ',
+# u'そ[' : u'ぞ',
+# u'た[' : u'だ',
+# u'ち[' : u'ぢ',
+# u'つ[' : u'づ',
+# u'て[' : u'で',
+# u'と[' : u'ど',
+# u'は[' : u'ば',
+# u'ひ[' : u'び',
+# u'ふ[' : u'ぶ',
+# u'へ[' : u'べ',
+# u'ほ[' : u'ぼ',
+# u'は]' : u'ぱ',
+# u'ひ]' : u'ぴ',
+# u'ふ]' : u'ぷ',
+# u'へ]' : u'ぺ',
+# u'ほ]' : u'ぽ',
+#}
+
#hiragana, katakana, half_katakana
hiragana_katakana_table = {
u'あ' : (u'ア', u'ア'),
diff --git a/setup/anthyprefs.py.in b/setup/anthyprefs.py.in
index 3135d93..995b794 100644
--- a/setup/anthyprefs.py.in
+++ b/setup/anthyprefs.py.in
@@ -33,6 +33,7 @@ __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)
@@ -75,6 +76,48 @@ class AnthyPrefs(Prefs):
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:
+ 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'.
@@ -146,6 +189,83 @@ _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',
@@ -550,224 +670,224 @@ _config = {
'kana_typing_rule/jp': {
# no modifiers keys
- '1' : 'ぬ',
- '2' : 'ふ',
- '3' : 'あ',
- '4' : 'う',
- '5' : 'え',
- '6' : 'お',
- '7' : 'や',
- '8' : 'ゆ',
- '9' : 'よ',
- '0' : 'わ',
- '-' : 'ほ',
- '^' : 'へ',
-
- 'q' : 'た',
- 'w' : 'て',
- 'e' : 'い',
- 'r' : 'す',
- 't' : 'か',
- 'y' : 'ん',
- 'u' : 'な',
- 'i' : 'に',
- 'o' : 'ら',
- 'p' : 'せ',
- '@' : '゛',
- '[' : '゜',
-
- 'a' : 'ち',
- 's' : 'と',
- 'd' : 'し',
- 'f' : 'は',
- 'g' : 'き',
- 'h' : 'く',
- 'j' : 'ま',
- 'k' : 'の',
- 'l' : 'り',
- ';' : 'れ',
- ':' : 'け',
- ']' : 'む',
-
- 'z' : 'つ',
- 'x' : 'さ',
- 'c' : 'そ',
- 'v' : 'ひ',
- 'b' : 'こ',
- 'n' : 'み',
- 'm' : 'も',
- ',' : 'ね',
- '.' : 'る',
- '/' : 'め',
- # '\\' : 'ー',
- '\\' : 'ろ',
+ '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
- '!' : 'ぬ',
- '"' : 'ふ',
- '#' : 'ぁ',
- '$' : 'ぅ',
- '%' : 'ぇ',
- '&' : 'ぉ',
- '\'' : 'ゃ',
- '(' : 'ゅ',
- ')' : 'ょ',
- '~' : 'を',
- '=' : 'ゑ',
- '|' : 'ー',
-
- 'Q' : 'た',
- 'W' : 'て',
- 'E' : 'ぃ',
- 'R' : 'す',
- 'T' : 'ヵ',
- 'Y' : 'ん',
- 'U' : 'な',
- 'I' : 'に',
- 'O' : 'ら',
- 'P' : 'せ',
- '`' : '゛',
-
- '{' : '「',
-
- 'A' : 'ち',
- 'S' : 'と',
- 'D' : 'し',
- 'F' : 'ゎ',
- 'G' : 'き',
- 'H' : 'く',
- 'J' : 'ま',
- 'K' : 'の',
- 'L' : 'り',
- '+' : 'れ',
- '*' : 'ヶ',
-
- '}' : '」',
-
- 'Z' : 'っ',
- 'X' : 'さ',
- 'C' : 'そ',
- 'V' : 'ゐ',
- 'B' : 'こ',
- 'M' : 'も',
- 'N' : 'み',
- '<' : '、',
- '>' : '。',
-
- '?' : '・',
- '_' : 'ろ',
-
- '¥' : 'ー',
+ '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
- '`' : 'ろ',
- '1' : 'ぬ',
- '2' : 'ふ',
- '3' : 'あ',
- '4' : 'う',
- '5' : 'え',
- '6' : 'お',
- '7' : 'や',
- '8' : 'ゆ',
- '9' : 'よ',
- '0' : 'わ',
- '-' : 'ほ',
- '=' : 'へ',
-
- 'q' : 'た',
- 'w' : 'て',
- 'e' : 'い',
- 'r' : 'す',
- 't' : 'か',
- 'y' : 'ん',
- 'u' : 'な',
- 'i' : 'に',
- 'o' : 'ら',
- 'p' : 'せ',
- '[' : '゛',
- ']' : '゜',
- # '\\' : 'ー',
- '\\' : 'む',
-
- 'a' : 'ち',
- 's' : 'と',
- 'd' : 'し',
- 'f' : 'は',
- 'g' : 'き',
- 'h' : 'く',
- 'j' : 'ま',
- 'k' : 'の',
- 'l' : 'り',
- ';' : 'れ',
- '\'' : 'け',
-
- 'z' : 'つ',
- 'x' : 'さ',
- 'c' : 'そ',
- 'v' : 'ひ',
- 'b' : 'こ',
- 'n' : 'み',
- 'm' : 'も',
- ',' : 'ね',
- '.' : 'る',
- '/' : 'め',
+ '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
- '~' : 'ろ',
- '!' : 'ぬ',
- '@' : 'ふ',
- '#' : 'ぁ',
- '$' : 'ぅ',
- '%' : 'ぇ',
- '^' : 'ぉ',
- '&' : 'ゃ',
- '*' : 'ゅ',
- '(' : 'ょ',
- ')' : 'を',
- '_' : 'ー',
- '+' : 'ゑ',
-
- 'Q' : 'た',
- 'W' : 'て',
- 'E' : 'ぃ',
- 'R' : 'す',
- 'T' : 'ヵ',
- 'Y' : 'ん',
- 'U' : 'な',
- 'I' : 'に',
- 'O' : 'ら',
- 'P' : 'せ',
- '{' : '「',
-
- '}' : '」',
-
- '|' : 'む',
-
- 'A' : 'ち',
- 'S' : 'と',
- 'D' : 'し',
- 'F' : 'ゎ',
- 'G' : 'き',
- 'H' : 'く',
- 'J' : 'ま',
- 'K' : 'の',
- 'L' : 'り',
- ':' : 'れ',
- '"' : 'ヶ',
-
- 'Z' : 'っ',
- 'X' : 'さ',
- 'C' : 'そ',
- 'V' : 'ゐ',
- 'B' : 'こ',
- 'M' : 'も',
- 'N' : 'み',
- '<' : '、',
- '>' : '。',
-
- '?' : '・',
+ '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,
diff --git a/setup/main.py b/setup/main.py
index c26ca56..837d334 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -351,15 +351,21 @@ class AnthySetup(object):
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 value != '':
- rule[key] = prefs.str(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[key] = prefs.str(value)
+ rule[ch] = prefs.str(value)
for key, value in sorted(rule.items(), \
cmp = self.__japanese_tuple_sort):
ls.append(['kana', key, value])
@@ -1191,6 +1197,11 @@ class AnthySetup(object):
if section_base == None:
self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug."))
return
+ if type == 'kana':
+ 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().
@@ -1233,6 +1244,11 @@ class AnthySetup(object):
return
section = section_base + '/' + method
newkeys = prefs.get_value(section_base, 'newkeys')
+ if type == 'kana':
+ 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)