Exemplo n.º 1
0
 def handle_keyDown(self, event):
     key = event.charactersIgnoringModifiers()
     if len(key) != 1 or not key.isalpha():
         key = osxmenus.REVERSE_KEYS_MAP.get(key)
     mods = osxmenus.translate_event_modifiers(event)
     responder = self.firstResponder()
     while responder is not None:
         wrapper = wrappermap.wrapper(responder)
         if isinstance(wrapper, Widget) or isinstance(wrapper, Window):
             if wrapper.emit('key-press', key, mods):
                 return True # signal handler returned True, stop processing
         responder = responder.nextResponder()
Exemplo n.º 2
0
 def sendKeyDownToWrapper_(self, event):
     """Give a keyDown event to the wrapper for our responder
     
     Return True if the wrapper handled the event
     """
     key = event.charactersIgnoringModifiers()
     if len(key) != 1 or not key.isalnum():
         key = osxmenus.REVERSE_KEYS_MAP.get(key)
     mods = osxmenus.translate_event_modifiers(event)
     wrapper = wrappermap.wrapper(self.responder)
     if isinstance(wrapper, Widget) or isinstance(wrapper, Window):
         if wrapper.emit('key-press', key, mods):
             return True
     return False
Exemplo n.º 3
0
 def sendKeyDownToWrapper_(self, event):
     """Give a keyDown event to the wrapper for our responder
     
     Return True if the wrapper handled the event
     """
     key = event.charactersIgnoringModifiers()
     if len(key) != 1 or not key.isalnum():
         key = osxmenus.REVERSE_KEYS_MAP.get(key)
     mods = osxmenus.translate_event_modifiers(event)
     wrapper = wrappermap.wrapper(self.responder)
     if isinstance(wrapper, Widget) or isinstance(wrapper, Window):
         if wrapper.emit('key-press', key, mods):
             return True
     return False