On Sat, Feb 27, 2010 at 4:20 AM, resi147 <[email protected]> wrote: > I'll still very much like to get leo running with Qt. > Can anybody give me hints how to debug leo, to find out, why '@' and > other characters (i.e. now needed '|' to make rst tables) > cannot be entered in body and headlines.
Key handling is complex, but the tips are straightforward. There are two main areas to look at: 1. Qt gui-->@thin qtGui.py-->Key handling (in qtGui.py) This handles the Qt side of keystrokes. As you can see, there are two classes: - leoKeyEvent class. This is a wrapper class. It exists to hide differences between Tk key events and Qt key events. It's also a place for last-minute hacks :-) Everything happens in the ctor. - leoQtEventFilter class. This class receives raw Qt events of all kinds The top-level entry point is the eventFilter function. You can enable/disable many useful traces in eventFilter. In essence, eventFilter calls many complex helpers to munge the key event, then calls k.masterKeyHandler. The munging translates Qt key names to the Tk key names used in Leo's core. Many of eventFilter's helpers also have trace variables that you can enable. 2. k.masterKeyHandler and helpers (in leoKeys.py) As the name implies, all key strokes eventually come to k.masterKeyHandler. As with eventFilter, you can enable many traces in k.masterKeyHandler and its helpers. Both eventFilter and k.masterKeyHandler are good places to drop into the debugger. Do this by inserting a call to g.pdb(). Then run Leo (say test.leo) from a console. Type a character and you'll drop into the debugger, ready for single stepping. No doubt you will think all this is way too complex. It is, but there are reasons why it is the way it is. Simplifying it would not be easy. Unlike many programs, Leo must grab all characters that are bound anywhere. Ignoring the details, your strategy will be simple enough. First, to determine whether any key event at all is generated by the keys in question. Second, to determine whether k.masterKeyHandler is ever called. Third, to determine what k.masterKeyHandler and its allies do with the keystroke. Hint: many problems arise because the wrong names get passed to k.masterKeyHandler. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
