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

Method onKeyDown

python/input_methods/chedayi/chedayi_ime.py:96–129  ·  view source on GitHub ↗
(self, keyEvent)

Source from the content-addressed store, hash-verified

94
95
96 def onKeyDown(self, keyEvent):
97 if self.cfg.selCinType == 0 or self.cfg.selCinType == 1:
98 self.maxCharLength = 4
99 elif self.cfg.selCinType == 2:
100 self.maxCharLength = 3
101
102 charCode = keyEvent.charCode
103 keyCode = keyEvent.keyCode
104 charStr = chr(charCode)
105
106 # 大易符號 ---------------------------------------------------------
107 self.DayiSymbolChar = "=" if self.selDayiSymbolCharType == 0 else "'"
108 self.DayiSymbolString = "=" if self.selDayiSymbolCharType == 0 else "號"
109
110 if self.langMode == 1 and not self.showmenu:
111 if len(self.compositionChar) == 0 and not self.phrasemode and charStr == self.DayiSymbolChar and not keyEvent.isKeyDown(VK_CONTROL):
112 self.compositionChar += charStr
113 self.dayisymbolsmode = True
114 if self.compositionBufferMode:
115 self.cinbase.setCompositionBufferString(self, self.DayiSymbolString, 0)
116 else:
117 self.setCompositionString(self.DayiSymbolString)
118 elif self.dayisymbolsmode and self.isShowCandidates:
119 self.canUseSelKey = True
120 elif len(self.compositionChar) >= 1 and self.dayisymbolsmode:
121 if self.dsymbols.isInCharDef(self.compositionChar[1:] + charStr):
122 self.compositionChar += charStr
123 self.canUseSelKey = False
124 candidates = self.dsymbols.getCharDef(self.compositionChar[1:])
125
126 if not self.directShowCand:
127 self.autoShowCandWhenMaxChar = True
128 KeyState = self.cinbase.onKeyDown(self, keyEvent, CinTable, RCinTable, HCinTable)
129 return KeyState
130
131
132 # 使用者放開按鍵,在 app 收到前先過濾那些鍵是輸入法需要的。

Callers

nothing calls this directly

Calls 5

isKeyDownMethod · 0.80
setCompositionStringMethod · 0.80
isInCharDefMethod · 0.45
getCharDefMethod · 0.45

Tested by

no test coverage detected