(self, cbTS, keyEvent, CinTable, RCinTable, HCinTable)
| 420 | return False |
| 421 | |
| 422 | def onKeyDown(self, cbTS, keyEvent, CinTable, RCinTable, HCinTable): |
| 423 | charCode = keyEvent.charCode |
| 424 | keyCode = keyEvent.keyCode |
| 425 | charStr = chr(charCode) |
| 426 | charStrLow = charStr.lower() |
| 427 | |
| 428 | if CinTable.loading: |
| 429 | if not cbTS.client.isUiLess: |
| 430 | messagestr = '正在載入輸入法碼表,請稍候...' |
| 431 | cbTS.isShowMessage = True |
| 432 | cbTS.showMessage(messagestr, cbTS.messageDurationTime) |
| 433 | return True |
| 434 | |
| 435 | # NumPad 某些狀況允許輸入法處理 |
| 436 | if keyEvent.isKeyToggled(VK_NUMLOCK): # NumLock is on |
| 437 | # if this key is Num pad 0-9, +, -, *, /, pass it back to the system |
| 438 | if keyEvent.keyCode >= VK_NUMPAD0 and keyEvent.keyCode <= VK_DIVIDE: |
| 439 | if not cbTS.compositionBufferMode or cbTS.showCandidates: |
| 440 | return True # bypass IME |
| 441 | |
| 442 | if cbTS.compositionBufferMode and not cbTS.isComposing(): |
| 443 | cbTS.compositionBufferType = "default" |
| 444 | cbTS.compositionBufferChar = {} |
| 445 | |
| 446 | if cbTS.langMode == ENGLISH_MODE: |
| 447 | if cbTS.isComposing() or cbTS.showCandidates: |
| 448 | cbTS.tempEnglishMode = True |
| 449 | else: |
| 450 | cbTS.tempEnglishMode = False |
| 451 | |
| 452 | if cbTS.tempEnglishMode: |
| 453 | if not cbTS.showCandidates and keyEvent.isPrintableChar() and not keyEvent.isKeyDown(VK_CONTROL): |
| 454 | if cbTS.shapeMode == HALFSHAPE_MODE: |
| 455 | cbTS.compositionBufferType = "english" |
| 456 | self.setCompositionBufferString(cbTS, charStr, 0) |
| 457 | else: |
| 458 | if self.isSymbolsChar(keyCode) or self.isNumberChar(keyCode): |
| 459 | cStr = self.SymbolscharCodeToFullshape(charCode) |
| 460 | else: |
| 461 | cStr = self.charCodeToFullshape(cbTS, charCode, keyCode) |
| 462 | cbTS.compositionBufferType = "fullshape" |
| 463 | self.setCompositionBufferString(cbTS, cStr, 0) |
| 464 | self.setCompositionBufferChar(cbTS, cbTS.compositionBufferType, charStr, cbTS.compositionBufferCursor) |
| 465 | |
| 466 | # 鍵盤對映 (注音) |
| 467 | if not cbTS.keyboardLayout == 0 and charStr.lower() in cbTS.kbtypelist[cbTS.keyboardLayout] and not cbTS.tempEnglishMode: |
| 468 | if not keyEvent.isKeyDown(VK_SHIFT) and not keyEvent.isKeyDown(VK_CONTROL): |
| 469 | charIndex = cbTS.kbtypelist[cbTS.keyboardLayout].index(charStr.lower()) |
| 470 | charStr = cbTS.kbtypelist[0][charIndex] |
| 471 | charStrLow = charStr.lower() |
| 472 | |
| 473 | # 檢查選字鍵 |
| 474 | if not cbTS.imeDirName == "chedayi": |
| 475 | cbTS.selKeys = "1234567890" |
| 476 | if not self.candselKeys == "1234567890": |
| 477 | self.candselKeys = "1234567890" |
| 478 | cbTS.TextService.setSelKeys(cbTS, self.candselKeys) |
| 479 | cbTS.isSelKeysChanged = True |
nothing calls this directly
no test coverage detected