(self, cbTS, commandId, commandType)
| 2395 | |
| 2396 | |
| 2397 | def onCommand(self, cbTS, commandId, commandType): |
| 2398 | if commandId == ID_SWITCH_LANG and commandType == 0: # 切換中英文模式 |
| 2399 | self.toggleLanguageMode(cbTS) |
| 2400 | elif commandId == ID_SWITCH_SHAPE and commandType == 0: # 切換全形/半形 |
| 2401 | self.toggleShapeMode(cbTS) |
| 2402 | elif commandId == ID_SETTINGS: # 開啟設定工具 |
| 2403 | tool_name = "config" |
| 2404 | config_tool = '"{0}" {1} {2}'.format(os.path.join(self.cinbasecurdir, "configtool.py"), tool_name, cbTS.imeDirName) |
| 2405 | python_exe = sys.executable # 找到 python 執行檔 |
| 2406 | # 使用我們自帶的 python runtime exe 執行 config tool |
| 2407 | # 此處也可以用 subprocess,不過使用 windows API 比較方便 |
| 2408 | r = windll.shell32.ShellExecuteW(None, "open", python_exe, config_tool, self.cinbasecurdir, 0) # SW_HIDE = 0 (hide the window) |
| 2409 | elif commandId == ID_MODE_ICON: # windows 8 mode icon |
| 2410 | self.toggleLanguageMode(cbTS) # 切換中英文模式 |
| 2411 | elif commandId == ID_WEBSITE: # visit chewing website |
| 2412 | os.startfile("https://github.com/EasyIME/PIME") |
| 2413 | elif commandId == ID_BUGREPORT: # visit bug tracker page |
| 2414 | os.startfile("https://github.com/EasyIME/PIME/issues") |
| 2415 | elif commandId == ID_FORUM: |
| 2416 | os.startfile("https://github.com/EasyIME/forum") |
| 2417 | elif commandId == ID_MOEDICT: # a very awesome online Chinese dictionary |
| 2418 | os.startfile("https://www.moedict.tw/") |
| 2419 | elif commandId == ID_DICT: # online Chinese dictonary |
| 2420 | os.startfile("http://dict.revised.moe.edu.tw/cbdic/") |
| 2421 | elif commandId == ID_SIMPDICT: # a simplified version of the online dictonary |
| 2422 | os.startfile("http://dict.concised.moe.edu.tw/jbdic/") |
| 2423 | elif commandId == ID_LITTLEDICT: # a simplified dictionary for little children |
| 2424 | os.startfile("http://dict.mini.moe.edu.tw/cgi-bin/gdic/gsweb.cgi?o=ddictionary") |
| 2425 | elif commandId == ID_PROVERBDICT: # a dictionary for proverbs (seems to be broken at the moment?) |
| 2426 | os.startfile("http://dict.idioms.moe.edu.tw/cydic/") |
| 2427 | elif commandId == ID_OUTPUT_SIMP_CHINESE: # 切換簡體中文輸出 |
| 2428 | self.setOutputSimplifiedChinese(cbTS, not cbTS.outputSimpChinese) |
| 2429 | |
| 2430 | |
| 2431 | # 開啟語言列按鈕選單 |
nothing calls this directly
no test coverage detected