Skip to content

Commit

Permalink
Add user phrase editor to the popup menu of chewing module.
Browse files Browse the repository at this point in the history
  • Loading branch information
PCMan committed Dec 17, 2016
1 parent 1e0aea5 commit befc5b2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions python/input_methods/chewing/chewing_ime.py
Expand Up @@ -70,6 +70,7 @@
ID_LITTLEDICT = 16
ID_PROVERBDICT = 17
ID_OUTPUT_SIMP_CHINESE = 18
ID_USER_PHRASE_EDITOR = 19


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

0 comments on commit befc5b2

Please sign in to comment.