Exemplo n.º 1
0
def _blackmamba_handleKeyUIEvent(_self, _cmd, event):
    e = ObjCInstance(event)

    if e.type() == UIEventType.PHYSICAL_KEYBOARD.value and e.subtype(
    ) == UIEventSubtype.NONE.value:
        for h in _key_event_handlers:
            if h.key_code == e._keyCode() and h.modifier == e._modifierFlags():
                if not e._isKeyDown():
                    h.fn()
                return

    ObjCInstance(_self).originalhandleKeyUIEvent_(e)
Exemplo n.º 2
0
def _blackmamba_handleKeyUIEvent(_self, _cmd, event):
    e = ObjCInstance(event)

    #    print('Down: {} Type: {} Subtype: {} Modifier flags: {} Keycode: {}'
    #        .format(e._isKeyDown(), e.type(), e.subtype(), e._modifierFlags(), e._keyCode()))

    if e.type() == UIEventTypePhysicalKeyboard and e.subtype(
    ) == 0 and not e._isKeyDown():
        for h in _key_event_handlers:
            if h.key_code == e._keyCode(
            ) and h.modifier_flags == e._modifierFlags():
                try:
                    h.fn()
                except Exception as ex:
                    print('Exception in key event handler {}'.format(h.fn))
                    print(ex)

    ObjCInstance(_self).originalhandleKeyUIEvent_(e)