Add more logging to eventFilter
This commit is contained in:
parent
8f9d7542a6
commit
83f829ed93
@ -182,38 +182,50 @@ class ModeManager(QObject):
|
|||||||
if typ not in [QEvent.KeyPress, QEvent.KeyRelease]:
|
if typ not in [QEvent.KeyPress, QEvent.KeyRelease]:
|
||||||
# We're not interested in non-key-events so we pass them through.
|
# We're not interested in non-key-events so we pass them through.
|
||||||
return False
|
return False
|
||||||
logging.debug("Got event {} for {}".format(debug.EVENTS[typ],
|
|
||||||
obj.__class__))
|
|
||||||
if not isinstance(obj, QWindow):
|
if not isinstance(obj, QWindow):
|
||||||
# We already handled this same event at some point earlier, so
|
# We already handled this same event at some point earlier, so
|
||||||
# we're not interested in it anymore.
|
# we're not interested in it anymore.
|
||||||
|
logging.debug("Got event {} for {} -> ignoring".format(
|
||||||
|
debug.EVENTS[typ], obj.__class__.__name__))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
logging.debug("Got event {} for {}".format(
|
||||||
|
debug.EVENTS[typ], obj.__class__.__name__))
|
||||||
|
|
||||||
handler = self._handlers[self.mode]
|
handler = self._handlers[self.mode]
|
||||||
|
|
||||||
if self.mode in self.passthrough:
|
if self.mode in self.passthrough:
|
||||||
# We're currently in a passthrough mode so we pass everything
|
# We're currently in a passthrough mode so we pass everything
|
||||||
# through.*and* let the passthrough keyhandler know.
|
# through.*and* let the passthrough keyhandler know.
|
||||||
# FIXME what if we leave the passthrough mode right here?
|
# FIXME what if we leave the passthrough mode right here?
|
||||||
|
logging.debug("We're in a passthrough mode -> passing through")
|
||||||
if typ == QEvent.KeyPress:
|
if typ == QEvent.KeyPress:
|
||||||
|
logging.debug("KeyPress, calling handler {}".format(handler))
|
||||||
self.key_pressed.emit(evt)
|
self.key_pressed.emit(evt)
|
||||||
if handler is not None:
|
if handler is not None:
|
||||||
handler(evt)
|
handler(evt)
|
||||||
|
else:
|
||||||
|
logging.debug("KeyRelease, not calling anything")
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
logging.debug("We're in a non-passthrough mode")
|
||||||
if typ == QEvent.KeyPress:
|
if typ == QEvent.KeyPress:
|
||||||
# KeyPress in a non-passthrough mode - call handler and filter
|
# KeyPress in a non-passthrough mode - call handler and filter
|
||||||
# event from widgets (unless unhandled and configured to pass
|
# event from widgets (unless unhandled and configured to pass
|
||||||
# unhandled events through)
|
# unhandled events through)
|
||||||
|
logging.debug("KeyPress, calling handler {}".format(handler))
|
||||||
self.key_pressed.emit(evt)
|
self.key_pressed.emit(evt)
|
||||||
if handler is not None:
|
handled = handler(evt) if handler is not None else False
|
||||||
handled = handler(evt)
|
logging.debug("handled: {}, forward_unbound_keys: {} -> "
|
||||||
else:
|
"filtering: {}".format(
|
||||||
handled = False
|
handled, self._forward_unbound_keys,
|
||||||
|
handled or not self._forward_unbound_keys))
|
||||||
if handled or not self._forward_unbound_keys:
|
if handled or not self._forward_unbound_keys:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return True
|
return False
|
||||||
else:
|
else:
|
||||||
# KeyRelease in a non-passthrough mode - filter event and
|
# KeyRelease in a non-passthrough mode - filter event and
|
||||||
# ignore it entirely.
|
# ignore it entirely.
|
||||||
|
logging.debug("KeyRelease, not calling anything and filtering")
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user