diff options
author | Hideaki ABE <abe.sendai@gmail.com> | 2009-06-06 11:56:30 +0900 |
---|---|---|
committer | Hideaki ABE <abe.sendai@gmail.com> | 2009-06-06 11:56:30 +0900 |
commit | e9c356983cf3e06ad3c67392ca558b221f119257 (patch) | |
tree | 774a8a7360e2fadfa2d17deffa6d225d959652d8 | |
parent | eede04867dacd2afb657b603cdd42187658b501d (diff) | |
download | ibus-anthy-e9c356983cf3e06ad3c67392ca558b221f119257.tar.gz |
Implimented multi shortcut key setsetup_ui_new
-rw-r--r-- | engine/engine.py | 38 | ||||
-rw-r--r-- | po/fr.po | 151 | ||||
-rw-r--r-- | po/ja.po | 184 | ||||
-rw-r--r-- | po/zh_CN.po | 145 | ||||
-rw-r--r-- | setup/anthyprefs.py | 116 | ||||
-rw-r--r-- | setup/main.py | 31 | ||||
-rw-r--r-- | setup/setup.glade | 218 |
7 files changed, 542 insertions, 341 deletions
diff --git a/engine/engine.py b/engine/engine.py index ebe5f46..9f241ad 100644 --- a/engine/engine.py +++ b/engine/engine.py @@ -888,12 +888,7 @@ class Engine(ibus.EngineBase): if not cls.__prefs: cls.__prefs = AnthyPrefs(bus) - keybind = {} - for k in cls.__prefs.keys('shortcut/default'): - cmd = '_Engine__cmd_' + k - for s in cls.__prefs.get_value('shortcut/default', k): - keybind.setdefault(cls._s_to_key(s), []).append(cmd) - cls.__keybind = keybind + cls.__keybind = cls._mk_keybind() jastring.JaString._prefs = cls.__prefs @@ -901,22 +896,45 @@ class Engine(ibus.EngineBase): def CONFIG_VALUE_CHANGED(cls, bus, section, name, value): print 'VALUE_CHAMGED =', section, name, value section = section[len(cls.__prefs._prefix) + 1:] - if section.startswith('shortcut/'): + if section == cls._get_shortcut_type(): cmd = '_Engine__cmd_' + name - old = cls.__prefs.get_value('shortcut/default', name) + sec = cls._get_shortcut_type() + 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('shortcut/default') + 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('shortcut/default', name, value) + cls.__prefs.set_value(sec, name, value) elif section == 'common': cls.__prefs.set_value(section, name, value) + if name == 'shortcut_type': + cls.__keybind = cls._mk_keybind() + else: + cls.__prefs.set_value(sec, name, value) + + @classmethod + def _mk_keybind(cls): + keybind = {} + sec = cls._get_shortcut_type() + for k in cls.__prefs.keys(sec): + cmd = '_Engine__cmd_' + k + for s in cls.__prefs.get_value(sec, 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') + except: + t = 'shortcut/default' + return t @classmethod def _s_to_key(cls, s): @@ -8,50 +8,50 @@ msgid "" msgstr "" "Project-Id-Version: ibus-anthy VERSION\n" "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n" -"POT-Creation-Date: 2009-05-28 10:22+0900\n" +"POT-Creation-Date: 2009-06-06 11:48+0900\n" "PO-Revision-Date: 2009-02-23 03:31+0100\n" "Last-Translator: Julroy67 <julroy67@gmail.com>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: engine/engine.py:125 +#: engine/engine.py:126 msgid "Switch input mode" msgstr "Changer de méthode d'entrée" -#: engine/engine.py:131 +#: engine/engine.py:132 msgid "Hiragana" msgstr "Hiragana" -#: engine/engine.py:134 +#: engine/engine.py:135 msgid "Katakana" msgstr "Katakana" -#: engine/engine.py:137 +#: engine/engine.py:138 msgid "Half width katakana" msgstr "" -#: engine/engine.py:140 +#: engine/engine.py:141 msgid "Latin" msgstr "Latin" -#: engine/engine.py:143 +#: engine/engine.py:144 msgid "Wide Latin" msgstr "Latin large" -#: engine/engine.py:157 +#: engine/engine.py:158 msgid "Switch typing mode" msgstr "Changer méthode d'écriture" -#: engine/engine.py:163 +#: engine/engine.py:164 msgid "Romaji" msgstr "Romaji" -#: engine/engine.py:166 +#: engine/engine.py:167 msgid "Kana" msgstr "Kana" -#: engine/engine.py:179 +#: engine/engine.py:180 msgid "Configure Anthy" msgstr "" @@ -59,35 +59,35 @@ msgstr "" msgid "Anthy" msgstr "Anthy" -#: setup/main.py:72 +#: setup/main.py:80 msgid "Confirm" msgstr "" -#: setup/main.py:73 +#: setup/main.py:81 msgid "Are you sure to close Setup?" msgstr "" -#: setup/main.py:86 +#: setup/main.py:94 msgid "Notice!" msgstr "" -#: setup/main.py:87 +#: setup/main.py:95 msgid "Are you sure to close Setup without save configure?" msgstr "" -#: setup/main.py:166 +#: setup/main.py:194 msgid "Please press a key (or a key combination)" msgstr "" -#: setup/main.py:167 +#: setup/main.py:195 msgid "The dialog willbe closed when the key is released" msgstr "" -#: setup/main.py:186 +#: setup/main.py:214 msgid "Invalid keysym" msgstr "" -#: setup/main.py:187 +#: setup/main.py:215 msgid "This keysym is not valid" msgstr "" @@ -95,14 +95,15 @@ msgstr "" msgid "Setup - IBus-Anthy" msgstr "" -#: setup/setup.glade:43 -#, fuzzy -msgid "" -"Romaji\n" -"Kana" -msgstr "Romaji" +#: setup/setup.glade:44 +msgid "_Input Mode:" +msgstr "" + +#: setup/setup.glade:57 +msgid "_Typing Method:" +msgstr "" -#: setup/setup.glade:58 +#: setup/setup.glade:71 msgid "" "Hiragana\n" "Katakana\n" @@ -111,57 +112,56 @@ msgid "" "Wide Latin" msgstr "" -#: setup/setup.glade:75 -msgid "_Typing Method:" -msgstr "" - -#: setup/setup.glade:90 -msgid "_Input Mode:" -msgstr "" +#: setup/setup.glade:87 +#, fuzzy +msgid "" +"Romaji\n" +"Kana" +msgstr "Romaji" #: setup/setup.glade:106 msgid "<b>Initial Setting</b>" msgstr "" -#: setup/setup.glade:140 -msgid "" -"Clear\n" -"Commit\n" -"Hold\n" -msgstr "" - -#: setup/setup.glade:157 -msgid "" -"Do Nothing\n" -"Auto Convert" +#: setup/setup.glade:141 +msgid "_Period Style:" msgstr "" -#: setup/setup.glade:173 -msgid "Behaivior on _Focus Out:" +#: setup/setup.glade:154 +msgid "Ten _Key Type:" msgstr "" -#: setup/setup.glade:188 -msgid "_Behavior on Period:" +#: setup/setup.glade:168 +msgid "" +"Ten Key Mode\n" +"Usual Mode\n" msgstr "" -#: setup/setup.glade:202 +#: setup/setup.glade:184 msgid "" "、。\n" ",.\n" msgstr "" -#: setup/setup.glade:216 -msgid "" -"Ten Key Mode\n" -"Usual Mode\n" +#: setup/setup.glade:199 +msgid "_Behavior on Period:" msgstr "" -#: setup/setup.glade:233 -msgid "Ten _Key Type:" +#: setup/setup.glade:214 +msgid "Behaivior on _Focus Out:" msgstr "" -#: setup/setup.glade:248 -msgid "_Period Style:" +#: setup/setup.glade:228 +msgid "" +"Do Nothing\n" +"Auto Convert" +msgstr "" + +#: setup/setup.glade:243 +msgid "" +"Clear\n" +"Commit\n" +"Hold\n" msgstr "" #: setup/setup.glade:264 @@ -169,7 +169,7 @@ msgid "<b>Behaivior</b>" msgstr "" #: setup/setup.glade:298 -msgid "Half Width _Symbol" +msgid "Half Width _Number" msgstr "" #: setup/setup.glade:319 @@ -177,7 +177,7 @@ msgid "Candidate _Window Page Size:" msgstr "" #: setup/setup.glade:350 -msgid "Half Width _Number" +msgid "Half Width _Symbol" msgstr "" #: setup/setup.glade:370 @@ -188,19 +188,26 @@ msgstr "" msgid "Co_mmon" msgstr "" -#: setup/setup.glade:407 -msgid "_Key Customize" +#: setup/setup.glade:410 +msgid "_Shortcut Type:" msgstr "" -#: setup/setup.glade:471 +#: setup/setup.glade:424 +msgid "" +"Default\n" +"ATOK\n" +"Wnn\n" +msgstr "" + +#: setup/setup.glade:495 msgid "De_fault" msgstr "" -#: setup/setup.glade:515 +#: setup/setup.glade:539 msgid "Key bin_ding" msgstr "" -#: setup/setup.glade:528 +#: setup/setup.glade:552 msgid "" "<span size='xx-large'><b>IBus-Anthy</b></span>\n" "\n" @@ -210,34 +217,34 @@ msgid "" "\n" msgstr "" -#: setup/setup.glade:546 +#: setup/setup.glade:570 msgid "Abo_ut" msgstr "" -#: setup/setup.glade:617 +#: setup/setup.glade:641 msgid "Edit Shortcut" msgstr "" -#: setup/setup.glade:652 +#: setup/setup.glade:676 msgid "Key Code:" msgstr "" -#: setup/setup.glade:673 +#: setup/setup.glade:697 msgid "..." msgstr "" -#: setup/setup.glade:698 +#: setup/setup.glade:722 msgid "Modifier:" msgstr "" -#: setup/setup.glade:712 +#: setup/setup.glade:736 msgid "A_lternate" msgstr "" -#: setup/setup.glade:722 +#: setup/setup.glade:746 msgid "Co_ntrol" msgstr "" -#: setup/setup.glade:735 +#: setup/setup.glade:759 msgid "_Shift" msgstr "" @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ibus-anthy VERSION\n" "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n" -"POT-Creation-Date: 2009-05-28 10:22+0900\n" +"POT-Creation-Date: 2009-06-06 11:48+0900\n" "PO-Revision-Date: 2009-03-16 12:31+1000\n" "Last-Translator: UTUMI Hirosi <utuhiro78@yahoo.co.jp>\n" "Language-Team: Japanese <gnome-translation@gnome.gr.jp>\n" @@ -15,43 +15,43 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: engine/engine.py:125 +#: engine/engine.py:126 msgid "Switch input mode" msgstr "入力モード切替" -#: engine/engine.py:131 +#: engine/engine.py:132 msgid "Hiragana" msgstr "ひらがな" -#: engine/engine.py:134 +#: engine/engine.py:135 msgid "Katakana" msgstr "カタカナ" -#: engine/engine.py:137 +#: engine/engine.py:138 msgid "Half width katakana" msgstr "半角カタカナ" -#: engine/engine.py:140 +#: engine/engine.py:141 msgid "Latin" msgstr "英数" -#: engine/engine.py:143 +#: engine/engine.py:144 msgid "Wide Latin" msgstr "全角英数" -#: engine/engine.py:157 +#: engine/engine.py:158 msgid "Switch typing mode" msgstr "入力モード切替" -#: engine/engine.py:163 +#: engine/engine.py:164 msgid "Romaji" msgstr "ローマ字" -#: engine/engine.py:166 +#: engine/engine.py:167 msgid "Kana" msgstr "かな" -#: engine/engine.py:179 +#: engine/engine.py:180 msgid "Configure Anthy" msgstr "Anthyの設定" @@ -59,35 +59,35 @@ msgstr "Anthyの設定" msgid "Anthy" msgstr "Anthy" -#: setup/main.py:72 +#: setup/main.py:80 msgid "Confirm" msgstr "確認" -#: setup/main.py:73 +#: setup/main.py:81 msgid "Are you sure to close Setup?" msgstr "この設定ツールを終了します。よろしいですか?" -#: setup/main.py:86 +#: setup/main.py:94 msgid "Notice!" msgstr "注意!" -#: setup/main.py:87 +#: setup/main.py:95 msgid "Are you sure to close Setup without save configure?" msgstr "変更を保存せずに終了します。よろしいですか?" -#: setup/main.py:166 +#: setup/main.py:194 msgid "Please press a key (or a key combination)" msgstr "キーを入力してください" -#: setup/main.py:167 +#: setup/main.py:195 msgid "The dialog willbe closed when the key is released" msgstr "このダイアログはキーリリース時に閉じられます" -#: setup/main.py:186 +#: setup/main.py:214 msgid "Invalid keysym" msgstr "無効なキーシンボル" -#: setup/main.py:187 +#: setup/main.py:215 msgid "This keysym is not valid" msgstr "このキーシンボルは有効ではありません" @@ -95,15 +95,15 @@ msgstr "このキーシンボルは有効ではありません" msgid "Setup - IBus-Anthy" msgstr "IBus-Anthyの設定" -#: setup/setup.glade:43 -msgid "" -"Romaji\n" -"Kana" -msgstr "" -"ローマ字\n" -"かな" +#: setup/setup.glade:44 +msgid "_Input Mode:" +msgstr "入力モード(_I):" + +#: setup/setup.glade:57 +msgid "_Typing Method:" +msgstr "入力タイプ(_T):" -#: setup/setup.glade:58 +#: setup/setup.glade:71 msgid "" "Hiragana\n" "Katakana\n" @@ -117,45 +117,35 @@ msgstr "" "英数\n" "全角英数" -#: setup/setup.glade:75 -msgid "_Typing Method:" -msgstr "入力タイプ(_T):" - -#: setup/setup.glade:90 -msgid "_Input Mode:" -msgstr "入力モード(_I):" +#: setup/setup.glade:87 +msgid "" +"Romaji\n" +"Kana" +msgstr "" +"ローマ字\n" +"かな" #: setup/setup.glade:106 msgid "<b>Initial Setting</b>" msgstr "<b>初期値の設定</b>" -#: setup/setup.glade:140 -msgid "" -"Clear\n" -"Commit\n" -"Hold\n" -msgstr "" -"消去\n" -"確定\n" -"保持\n" +#: setup/setup.glade:141 +msgid "_Period Style:" +msgstr "句読点スタイル(_P):" + +#: setup/setup.glade:154 +msgid "Ten _Key Type:" +msgstr "テンキータイプ(_K):" -#: setup/setup.glade:157 +#: setup/setup.glade:168 msgid "" -"Do Nothing\n" -"Auto Convert" +"Ten Key Mode\n" +"Usual Mode\n" msgstr "" -"何もしない\n" -"自動変換" - -#: setup/setup.glade:173 -msgid "Behaivior on _Focus Out:" -msgstr "フォーカスアウト時のふるまい(_F):" - -#: setup/setup.glade:188 -msgid "_Behavior on Period:" -msgstr "句読点入力時のふるまい(_B):" +"テンキーコードのまま\n" +"非テンキーコードに変換\n" -#: setup/setup.glade:202 +#: setup/setup.glade:184 msgid "" "、。\n" ",.\n" @@ -163,37 +153,47 @@ msgstr "" "、。\n" ",.\n" -#: setup/setup.glade:216 +#: setup/setup.glade:199 +msgid "_Behavior on Period:" +msgstr "句読点入力時のふるまい(_B):" + +#: setup/setup.glade:214 +msgid "Behaivior on _Focus Out:" +msgstr "フォーカスアウト時のふるまい(_F):" + +#: setup/setup.glade:228 msgid "" -"Ten Key Mode\n" -"Usual Mode\n" +"Do Nothing\n" +"Auto Convert" msgstr "" -"テンキーコードのまま\n" -"非テンキーコードに変換\n" - -#: setup/setup.glade:233 -msgid "Ten _Key Type:" -msgstr "テンキータイプ(_K):" +"何もしない\n" +"自動変換" -#: setup/setup.glade:248 -msgid "_Period Style:" -msgstr "句読点スタイル(_P):" +#: setup/setup.glade:243 +msgid "" +"Clear\n" +"Commit\n" +"Hold\n" +msgstr "" +"消去\n" +"確定\n" +"保持\n" #: setup/setup.glade:264 msgid "<b>Behaivior</b>" msgstr "<b>ふるまい</b>" #: setup/setup.glade:298 -msgid "Half Width _Symbol" -msgstr "常に記号を半角にする(_S)" +msgid "Half Width _Number" +msgstr "常に数字を半角にする(_N)" #: setup/setup.glade:319 msgid "Candidate _Window Page Size:" msgstr "候補ウインドウの項目数(_W):" #: setup/setup.glade:350 -msgid "Half Width _Number" -msgstr "常に数字を半角にする(_N)" +msgid "Half Width _Symbol" +msgstr "常に記号を半角にする(_S)" #: setup/setup.glade:370 msgid "<b>Other</b>" @@ -203,19 +203,26 @@ msgstr "<b>その他</b>" msgid "Co_mmon" msgstr "全般(_M)" -#: setup/setup.glade:407 -msgid "_Key Customize" -msgstr "キーカスタマイズ(_K)" +#: setup/setup.glade:410 +msgid "_Shortcut Type:" +msgstr "ショートカットタイプ(_S):" -#: setup/setup.glade:471 +#: setup/setup.glade:424 +msgid "" +"Default\n" +"ATOK\n" +"Wnn\n" +msgstr "" + +#: setup/setup.glade:495 msgid "De_fault" msgstr "デフォルト(_F)" -#: setup/setup.glade:515 +#: setup/setup.glade:539 msgid "Key bin_ding" msgstr "キー割当(_D)" -#: setup/setup.glade:528 +#: setup/setup.glade:552 msgid "" "<span size='xx-large'><b>IBus-Anthy</b></span>\n" "\n" @@ -225,34 +232,37 @@ msgid "" "\n" msgstr "" -#: setup/setup.glade:546 +#: setup/setup.glade:570 msgid "Abo_ut" msgstr "このプログラムについて(_U)" -#: setup/setup.glade:617 +#: setup/setup.glade:641 msgid "Edit Shortcut" msgstr "ショートカットの編集" -#: setup/setup.glade:652 +#: setup/setup.glade:676 msgid "Key Code:" msgstr "キーコード:" -#: setup/setup.glade:673 +#: setup/setup.glade:697 msgid "..." msgstr "..." -#: setup/setup.glade:698 +#: setup/setup.glade:722 msgid "Modifier:" msgstr "キー修飾:" -#: setup/setup.glade:712 +#: setup/setup.glade:736 msgid "A_lternate" msgstr "" -#: setup/setup.glade:722 +#: setup/setup.glade:746 msgid "Co_ntrol" msgstr "" -#: setup/setup.glade:735 +#: setup/setup.glade:759 msgid "_Shift" msgstr "" + +#~ msgid "_Key Customize" +#~ msgstr "キーカスタマイズ(_K)" diff --git a/po/zh_CN.po b/po/zh_CN.po index 7cae5ea..5e8cf46 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ibus-anthy VERSION\n" "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n" -"POT-Creation-Date: 2009-05-28 10:22+0900\n" +"POT-Creation-Date: 2009-06-06 11:48+0900\n" "PO-Revision-Date: 2008-08-21 21:37+0800\n" "Last-Translator: Huang Peng <shawn.p.huang@gmail.com>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -15,43 +15,43 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: engine/engine.py:125 +#: engine/engine.py:126 msgid "Switch input mode" msgstr "切换输入模式" -#: engine/engine.py:131 +#: engine/engine.py:132 msgid "Hiragana" msgstr "平假名" -#: engine/engine.py:134 +#: engine/engine.py:135 msgid "Katakana" msgstr "片假名" -#: engine/engine.py:137 +#: engine/engine.py:138 msgid "Half width katakana" msgstr "半角片假名" -#: engine/engine.py:140 +#: engine/engine.py:141 msgid "Latin" msgstr "英数" -#: engine/engine.py:143 +#: engine/engine.py:144 msgid "Wide Latin" msgstr "全角英数" -#: engine/engine.py:157 +#: engine/engine.py:158 msgid "Switch typing mode" msgstr "切换输入模式" -#: engine/engine.py:163 +#: engine/engine.py:164 msgid "Romaji" msgstr "" -#: engine/engine.py:166 +#: engine/engine.py:167 msgid "Kana" msgstr "" -#: engine/engine.py:179 +#: engine/engine.py:180 msgid "Configure Anthy" msgstr "" @@ -59,35 +59,35 @@ msgstr "" msgid "Anthy" msgstr "" -#: setup/main.py:72 +#: setup/main.py:80 msgid "Confirm" msgstr "" -#: setup/main.py:73 +#: setup/main.py:81 msgid "Are you sure to close Setup?" msgstr "" -#: setup/main.py:86 +#: setup/main.py:94 msgid "Notice!" msgstr "" -#: setup/main.py:87 +#: setup/main.py:95 msgid "Are you sure to close Setup without save configure?" msgstr "" -#: setup/main.py:166 +#: setup/main.py:194 msgid "Please press a key (or a key combination)" msgstr "" -#: setup/main.py:167 +#: setup/main.py:195 msgid "The dialog willbe closed when the key is released" msgstr "" -#: setup/main.py:186 +#: setup/main.py:214 msgid "Invalid keysym" msgstr "" -#: setup/main.py:187 +#: setup/main.py:215 msgid "This keysym is not valid" msgstr "" @@ -95,13 +95,15 @@ msgstr "" msgid "Setup - IBus-Anthy" msgstr "" -#: setup/setup.glade:43 -msgid "" -"Romaji\n" -"Kana" +#: setup/setup.glade:44 +msgid "_Input Mode:" +msgstr "" + +#: setup/setup.glade:57 +msgid "_Typing Method:" msgstr "" -#: setup/setup.glade:58 +#: setup/setup.glade:71 msgid "" "Hiragana\n" "Katakana\n" @@ -110,57 +112,55 @@ msgid "" "Wide Latin" msgstr "" -#: setup/setup.glade:75 -msgid "_Typing Method:" -msgstr "" - -#: setup/setup.glade:90 -msgid "_Input Mode:" +#: setup/setup.glade:87 +msgid "" +"Romaji\n" +"Kana" msgstr "" #: setup/setup.glade:106 msgid "<b>Initial Setting</b>" msgstr "" -#: setup/setup.glade:140 -msgid "" -"Clear\n" -"Commit\n" -"Hold\n" -msgstr "" - -#: setup/setup.glade:157 -msgid "" -"Do Nothing\n" -"Auto Convert" +#: setup/setup.glade:141 +msgid "_Period Style:" msgstr "" -#: setup/setup.glade:173 -msgid "Behaivior on _Focus Out:" +#: setup/setup.glade:154 +msgid "Ten _Key Type:" msgstr "" -#: setup/setup.glade:188 -msgid "_Behavior on Period:" +#: setup/setup.glade:168 +msgid "" +"Ten Key Mode\n" +"Usual Mode\n" msgstr "" -#: setup/setup.glade:202 +#: setup/setup.glade:184 msgid "" "、。\n" ",.\n" msgstr "" -#: setup/setup.glade:216 -msgid "" -"Ten Key Mode\n" -"Usual Mode\n" +#: setup/setup.glade:199 +msgid "_Behavior on Period:" msgstr "" -#: setup/setup.glade:233 -msgid "Ten _Key Type:" +#: setup/setup.glade:214 +msgid "Behaivior on _Focus Out:" msgstr "" -#: setup/setup.glade:248 -msgid "_Period Style:" +#: setup/setup.glade:228 +msgid "" +"Do Nothing\n" +"Auto Convert" +msgstr "" + +#: setup/setup.glade:243 +msgid "" +"Clear\n" +"Commit\n" +"Hold\n" msgstr "" #: setup/setup.glade:264 @@ -168,7 +168,7 @@ msgid "<b>Behaivior</b>" msgstr "" #: setup/setup.glade:298 -msgid "Half Width _Symbol" +msgid "Half Width _Number" msgstr "" #: setup/setup.glade:319 @@ -176,7 +176,7 @@ msgid "Candidate _Window Page Size:" msgstr "" #: setup/setup.glade:350 -msgid "Half Width _Number" +msgid "Half Width _Symbol" msgstr "" #: setup/setup.glade:370 @@ -187,19 +187,26 @@ msgstr "" msgid "Co_mmon" msgstr "" -#: setup/setup.glade:407 -msgid "_Key Customize" +#: setup/setup.glade:410 +msgid "_Shortcut Type:" +msgstr "" + +#: setup/setup.glade:424 +msgid "" +"Default\n" +"ATOK\n" +"Wnn\n" msgstr "" -#: setup/setup.glade:471 +#: setup/setup.glade:495 msgid "De_fault" msgstr "" -#: setup/setup.glade:515 +#: setup/setup.glade:539 msgid "Key bin_ding" msgstr "" -#: setup/setup.glade:528 +#: setup/setup.glade:552 msgid "" "<span size='xx-large'><b>IBus-Anthy</b></span>\n" "\n" @@ -209,34 +216,34 @@ msgid "" "\n" msgstr "" -#: setup/setup.glade:546 +#: setup/setup.glade:570 msgid "Abo_ut" msgstr "" -#: setup/setup.glade:617 +#: setup/setup.glade:641 msgid "Edit Shortcut" msgstr "" -#: setup/setup.glade:652 +#: setup/setup.glade:676 msgid "Key Code:" msgstr "" -#: setup/setup.glade:673 +#: setup/setup.glade:697 msgid "..." msgstr "" -#: setup/setup.glade:698 +#: setup/setup.glade:722 msgid "Modifier:" msgstr "" -#: setup/setup.glade:712 +#: setup/setup.glade:736 msgid "A_lternate" msgstr "" -#: setup/setup.glade:722 +#: setup/setup.glade:746 msgid "Co_ntrol" msgstr "" -#: setup/setup.glade:735 +#: setup/setup.glade:759 msgid "_Shift" msgstr "" diff --git a/setup/anthyprefs.py b/setup/anthyprefs.py index 5f2d6a2..24d031f 100644 --- a/setup/anthyprefs.py +++ b/setup/anthyprefs.py @@ -30,7 +30,7 @@ _cmd_keys = [ "wide_latin_mode", "hiragana_mode", "katakana_mode", - "half_katakana", + "half_katakana_mode", "cancel_pseudo_ascii_mode_key", "circle_typing_method", @@ -105,7 +105,9 @@ _config = { 'page_size': 10, 'half_width_symbol': False, - 'half_width_number': False + 'half_width_number': False, + + 'shortcut_type': 'default' }, 'shortcut/default': { #mode_keys @@ -116,7 +118,7 @@ _config = { 'wide_latin_mode': [], 'hiragana_mode': [], 'katakana_mode': [], - 'half_katakana': [], + 'half_katakana_mode': [], 'cancel_pseudo_ascii_mode_key': ['Escape'], 'circle_typing_method': ['Alt+Romaji', 'Ctrl+slash'], @@ -186,3 +188,111 @@ _config = { 'add_word': ['F12'], }, } + +_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'], + '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'], + + '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'], + + 'add_word': ['Ctrl+F7'], +} + +_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'], + + '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'], +} + +_config['shortcut/wnn'] = dict.fromkeys(_cmd_keys, []) +_config['shortcut/wnn'].update(_shortcut_wnn) + diff --git a/setup/main.py b/setup/main.py index 47752bd..c412ddb 100644 --- a/setup/main.py +++ b/setup/main.py @@ -31,6 +31,11 @@ class AnthySetup(object): 'half_width_symbol', 'half_width_number']: xml.get_widget(name).set_active(prefs.get_value('common', name)) + l = ['default', 'atok', 'wnn'] + s_type = prefs.get_value('common', 'shortcut_type') + s_type = s_type if s_type in l else 'default' + xml.get_widget('shortcut_type').set_active(l.index(s_type)) + xml.get_widget('page_size').set_value(prefs.get_value('common', 'page_size')) @@ -44,7 +49,7 @@ class AnthySetup(object): tv.get_selection().connect_after('changed', self.on_selection_changed, 0) ls = gtk.ListStore(str, str) - sec = 'shortcut/default' + sec = 'shortcut/' + s_type for k in self.prefs.keys(sec): ls.append([k, l_to_s(self.prefs.get_value(sec, k))]) tv.set_model(ls) @@ -125,19 +130,39 @@ class AnthySetup(object): if id == gtk.RESPONSE_OK: new = l_to_s([m[i][0] for i in range(len(m))]) if new != ls.get(it, 1)[0]: - self.prefs.set_value('shortcut/default', ls.get(it, 0)[0], s_to_l(new)) + sec = self._get_shortcut_sec() + self.prefs.set_value(sec, ls.get(it, 0)[0], s_to_l(new)) ls.set(it, 1, new) self.xml.get_widget('btn_apply').set_sensitive(True) def on_btn_default_clicked(self, widget): ls, it = self.xml.get_widget('shortcut').get_selection().get_selected() - sec = 'shortcut/default' + sec = self._get_shortcut_sec() new = l_to_s(self.prefs.default[sec][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)) ls.set(it, 1, new) self.xml.get_widget('btn_apply').set_sensitive(True) + def _get_shortcut_sec(self): + l = ['default', 'atok', 'wnn'] + s_type = self.xml.get_widget('shortcut_type').get_active_text().lower() + return 'shortcut/' + s_type if s_type in l else 'default' + + def on_shortcut_type_changed(self, widget): + ls = self.xml.get_widget('shortcut').get_model() + ls.clear() + + for a in widget.get_model(): + print a[0] + + sec = self._get_shortcut_sec() + for k in self.prefs.keys(sec): + ls.append([k, l_to_s(self.prefs.get_value(sec, k))]) + + self.prefs.set_value('common', widget.name, sec[len('shortcut/'):]) + self.xml.get_widget('btn_apply').set_sensitive(True) + def on_shortcut_key_release_event(self, widget, event): if event.hardware_keycode in [36, 65]: self.on_btn_edit_clicked(None) diff --git a/setup/setup.glade b/setup/setup.glade index faa88ea..0beb3b6 100644 --- a/setup/setup.glade +++ b/setup/setup.glade @@ -38,17 +38,30 @@ <property name="column_spacing">8</property> <property name="row_spacing">4</property> <child> - <widget class="GtkComboBox" id="typing_method"> + <widget class="GtkLabel" id="label9"> <property name="visible">True</property> - <property name="items" translatable="yes">Romaji -Kana</property> - <signal name="changed" handler="on_cb_changed"/> + <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> + </widget> + <packing> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label21"> + <property name="visible">True</property> + <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> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> @@ -69,30 +82,17 @@ Wide Latin</property> </packing> </child> <child> - <widget class="GtkLabel" id="label21"> + <widget class="GtkComboBox" id="typing_method"> <property name="visible">True</property> - <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="items" translatable="yes">Romaji +Kana</property> + <signal name="changed" handler="on_cb_changed"/> </widget> <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label9"> - <property name="visible">True</property> - <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> - </widget> - <packing> - <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> @@ -135,49 +135,60 @@ Wide Latin</property> <property name="column_spacing">8</property> <property name="row_spacing">4</property> <child> - <widget class="GtkComboBox" id="behivior_on_focus_out"> + <widget class="GtkLabel" id="label12"> <property name="visible">True</property> - <property name="items" translatable="yes">Clear -Commit -Hold -</property> - <signal name="changed" handler="on_cb_changed"/> + <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> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="behivior_on_period"> + <widget class="GtkLabel" id="label26"> <property name="visible">True</property> - <property name="items" translatable="yes">Do Nothing -Auto Convert</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Ten _Key Type:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">ten_key_mode</property> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <widget class="GtkComboBox" id="ten_key_mode"> + <property name="visible">True</property> + <property name="items" translatable="yes">Ten Key Mode +Usual Mode +</property> <signal name="changed" handler="on_cb_changed"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label23"> + <widget class="GtkComboBox" id="period_style"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Behaivior on _Focus Out:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">behivior_on_focus_out</property> + <property name="items" translatable="yes">、。 +,. +</property> + <signal name="changed" handler="on_cb_changed"/> </widget> <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">GTK_FILL</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> <property name="y_options"></property> </packing> </child> @@ -197,60 +208,49 @@ Auto Convert</property> </packing> </child> <child> - <widget class="GtkComboBox" id="period_style"> + <widget class="GtkLabel" id="label23"> <property name="visible">True</property> - <property name="items" translatable="yes">、。 -,. -</property> - <signal name="changed" handler="on_cb_changed"/> + <property name="xalign">0</property> + <property name="label" translatable="yes">Behaivior on _Focus Out:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">behivior_on_focus_out</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="ten_key_mode"> + <widget class="GtkComboBox" id="behivior_on_period"> <property name="visible">True</property> - <property name="items" translatable="yes">Ten Key Mode -Usual Mode -</property> + <property name="items" translatable="yes">Do Nothing +Auto Convert</property> <signal name="changed" handler="on_cb_changed"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label26"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Ten _Key Type:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">ten_key_mode</property> - </widget> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label12"> + <widget class="GtkComboBox" id="behivior_on_focus_out"> <property name="visible">True</property> - <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="items" translatable="yes">Clear +Commit +Hold +</property> + <signal name="changed" handler="on_cb_changed"/> </widget> <packing> - <property name="x_options">GTK_FILL</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="y_options"></property> </packing> </child> @@ -293,18 +293,18 @@ Usual Mode <property name="column_spacing">8</property> <property name="row_spacing">4</property> <child> - <widget class="GtkCheckButton" id="half_width_symbol"> + <widget class="GtkCheckButton" id="half_width_number"> <property name="visible">True</property> - <property name="label" translatable="yes">Half Width _Symbol</property> + <property name="label" translatable="yes">Half Width _Number</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_ck_toggled"/> - <accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/> + <accelerator key="N" modifiers="GDK_MOD1_MASK" signal="grab_focus"/> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options"></property> </packing> </child> @@ -345,18 +345,18 @@ Usual Mode </packing> </child> <child> - <widget class="GtkCheckButton" id="half_width_number"> + <widget class="GtkCheckButton" id="half_width_symbol"> <property name="visible">True</property> - <property name="label" translatable="yes">Half Width _Number</property> + <property name="label" translatable="yes">Half Width _Symbol</property> <property name="use_underline">True</property> <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_ck_toggled"/> - <accelerator key="N" modifiers="GDK_MOD1_MASK" signal="grab_focus"/> + <accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/> </widget> <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="y_options"></property> </packing> </child> @@ -401,12 +401,36 @@ Usual Mode <property name="border_width">4</property> <property name="spacing">4</property> <child> - <widget class="GtkLabel" id="label28"> + <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Key Customize</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">shortcut</property> + <property name="spacing">8</property> + <child> + <widget class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Shortcut Type:</property> + <property name="use_underline">True</property> + <property name="wrap_mode">PANGO_WRAP_WORD_CHAR</property> + <property name="mnemonic_widget">shortcut_type</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">1</property> + </packing> + </child> + <child> + <widget class="GtkComboBox" id="shortcut_type"> + <property name="visible">True</property> + <property name="items" translatable="yes">Default +ATOK +Wnn +</property> + <signal name="changed" handler="on_shortcut_type_changed"/> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> </widget> <packing> <property name="expand">False</property> |