def handleKeyEvent(self, event): if event.isMouseButton(): return False elif not isFocusedComponent( self.component) and not self.mozillaHandlesKeyboard: return False else: character = event.character if event.isKeyDown(): callKeyboardEvent = False callUnicodeEvent = False if event.key == Keys.KEY_ESCAPE: usedKey = LLMozlibKeys.LL_DOM_VK_ESCAPE callKeyboardEvent = True elif event.key == Keys.KEY_BACKSPACE: usedKey = LLMozlibKeys.LL_DOM_VK_BACK_SPACE callKeyboardEvent = True elif event.key == Keys.KEY_RETURN: usedKey = LLMozlibKeys.LL_DOM_VK_RETURN callKeyboardEvent = True elif event.key == Keys.KEY_TAB: usedKey = LLMozlibKeys.LL_DOM_VK_TAB callKeyboardEvent = True elif character is not None: callUnicodeEvent = True if not self.mozillaHandlesKeyboard: if callUnicodeEvent: self.webPage.handleUnicodeInput(character) return 1 if callKeyboardEvent: self.webPage.handleKeyboardEvent(usedKey) return 1 else: return True return True
def handleKeyEvent(self, event): if event.isMouseButton(): return False elif not isFocusedComponent(self.component) and not self.mozillaHandlesKeyboard: return False else: character = event.character if event.isKeyDown(): callKeyboardEvent = False callUnicodeEvent = False if event.key == Keys.KEY_ESCAPE: usedKey = LLMozlibKeys.LL_DOM_VK_ESCAPE callKeyboardEvent = True elif event.key == Keys.KEY_BACKSPACE: usedKey = LLMozlibKeys.LL_DOM_VK_BACK_SPACE callKeyboardEvent = True elif event.key == Keys.KEY_RETURN: usedKey = LLMozlibKeys.LL_DOM_VK_RETURN callKeyboardEvent = True elif event.key == Keys.KEY_TAB: usedKey = LLMozlibKeys.LL_DOM_VK_TAB callKeyboardEvent = True elif character is not None: callUnicodeEvent = True if not self.mozillaHandlesKeyboard: if callUnicodeEvent: self.webPage.handleUnicodeInput(character) return 1 if callKeyboardEvent: self.webPage.handleKeyboardEvent(usedKey) return 1 else: return True return True