Hello,
After some code searching (Use the Source Luke), I determined how to finally hook in my own kepressevent handlers for the body pane in a reliable fashion. But I had to put in a hack in the EventFilter system, to pass on every key press event to global dispatcher that I created. Otherwise, no matter what I did, I would not get consistently called event handlers.
Sure it works, but I am not sure if there is a way for me to reliably capture keypress events in the body pane without this hack?
Here is what I did:
In the eventFilter method, of the LeoQtEventFilter class:
if self.keyIsActive:
#2017-07-04: change made by me under this comment
try:
g.user_dict['my_key_dispatcher'](event)
except Exception as e:
g.red(e)
g.red("My Key Dispatcher has not been instantiated, qt_events.py")
#--
g.user_dict['my_key_dispatcher'] is a function defined at startup in myLeoSettings. It runs through a list of handlers I can add or remove at anytime.
Yes, it works, but ugly.
Is there a non-hack way to get all key press events from the body pane?
Thanks,
Adrian