Skip to content

Commit befc5b2

Browse files
committed
Add user phrase editor to the popup menu of chewing module.
1 parent 1e0aea5 commit befc5b2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

python/input_methods/chewing/chewing_ime.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
ID_LITTLEDICT = 16
7171
ID_PROVERBDICT = 17
7272
ID_OUTPUT_SIMP_CHINESE = 18
73+
ID_USER_PHRASE_EDITOR = 19
7374

7475

7576
class ChewingTextService(TextService):
@@ -561,8 +562,12 @@ def onCommand(self, commandId, commandType):
561562
self.toggleLanguageMode()
562563
elif commandId == ID_SWITCH_SHAPE and commandType == COMMAND_LEFT_CLICK: # 切換全形/半形
563564
self.toggleShapeMode()
564-
elif commandId == ID_SETTINGS: # 開啟設定工具
565-
config_tool = '"{0}"'.format(os.path.join(self.curdir, "config_tool.py"))
565+
elif commandId == ID_SETTINGS or commandId == ID_USER_PHRASE_EDITOR: # 開啟設定工具 or 編輯辭庫
566+
if commandId == ID_USER_PHRASE_EDITOR: # 編輯使用者辭庫
567+
tool_name = "user_phrase_editor"
568+
else: # 輸入法設定
569+
tool_name = "config_tool"
570+
config_tool = '"{0}" {1}'.format(os.path.join(self.curdir, "config_tool.py"), tool_name)
566571
python_exe = sys.executable # 找到 python 執行檔
567572
# 使用我們自帶的 python runtime exe 執行 config tool
568573
# 此處也可以用 subprocess,不過使用 windows API 比較方便
@@ -608,7 +613,7 @@ def onMenu(self, buttonId):
608613
{"text": "注音及選字選詞錯誤回報 (&P)", "id": ID_DICT_BUGREPORT},
609614
{},
610615
# {"text": "新酷音使用說明 (&H)", "id": ID_CHEWING_HELP},
611-
# {"text": "編輯使用者詞庫 (&E)", "id": ID_HASHED},
616+
{"text": "編輯使用者詞庫 (&E)", "id": ID_USER_PHRASE_EDITOR},
612617
{"text": "設定新酷音輸入法(&C)", "id": ID_SETTINGS},
613618
{},
614619
{"text": "網路辭典 (&D)", "submenu": [

0 commit comments

Comments
 (0)