MCPcopy Create free account
hub / github.com/EasyIME/PIME / onMenuCommand

Method onMenuCommand

python/cinbase/__init__.py:2579–2609  ·  view source on GitHub ↗
(self, cbTS, commandId, commandType)

Source from the content-addressed store, hash-verified

2577
2578 # 按下「`」鍵的選單命令
2579 def onMenuCommand(self, cbTS, commandId, commandType):
2580 if commandType == 0:
2581 if commandId == 0:
2582 tool_name = "config"
2583 config_tool = '"{0}" {1} {2}'.format(os.path.join(self.cinbasecurdir, "configtool.py"), tool_name, cbTS.imeDirName)
2584 python_exe = sys.executable # 找到 python 執行檔
2585 # 使用我們自帶的 python runtime exe 執行 config tool
2586 # 此處也可以用 subprocess,不過使用 windows API 比較方便
2587 r = windll.shell32.ShellExecuteW(None, "open", python_exe, config_tool, self.cinbasecurdir, 0) # SW_HIDE = 0 (hide the window)
2588 elif commandId == 1:
2589 self.setOutputSimplifiedChinese(cbTS, not cbTS.outputSimpChinese)
2590 elif commandType == 1: # 功能開關
2591 commandItem = cbTS.smenuitems[commandId]
2592 if commandItem == "fullShapeSymbols":
2593 cbTS.fullShapeSymbols = not cbTS.fullShapeSymbols
2594 elif commandItem == "easySymbolsWithShift":
2595 cbTS.easySymbolsWithShift = not cbTS.easySymbolsWithShift
2596 elif commandItem == "supportWildcard":
2597 cbTS.supportWildcard = not cbTS.supportWildcard
2598 elif commandItem == "autoClearCompositionChar":
2599 cbTS.autoClearCompositionChar = not cbTS.autoClearCompositionChar
2600 elif commandItem == "playSoundWhenNonCand":
2601 cbTS.playSoundWhenNonCand = not cbTS.playSoundWhenNonCand
2602 elif commandItem == "showPhrase":
2603 cbTS.showPhrase = not cbTS.showPhrase
2604 elif commandItem == "sortByPhrase":
2605 cbTS.sortByPhrase = not cbTS.sortByPhrase
2606 elif commandItem == "imeReverseLookup":
2607 cbTS.imeReverseLookup = not cbTS.imeReverseLookup
2608 elif commandItem == "homophoneQuery":
2609 cbTS.homophoneQuery = not cbTS.homophoneQuery
2610
2611
2612 def switchMenuType(self, cbTS, menutype, prevmenutypelist):

Callers 1

onKeyDownMethod · 0.95

Calls 3

joinMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected