This is an Engineering Notebook post. It consists of notes to myself. It is
pre-writing for a Theory of Operation for the curses gui code.
This post discusses what is still to be done (not very much) and compares
the event handlers in the Qt and curses guis.
Definitions: *User Events* are mouse-down and key events and (Qt only)
other events generated as the direct result of mouse-downs and key
presses. *Leo Events* are events generated by Leo scripts (including
commands and plugins).
*Qt vs curses*
*Leo events happen only the Qt gui code.* Indeed, Qt itself generates
events when outline nodes expand or contract, an outline node is selected,
and the body text changes. *No such events exist in the curses gui*.
This makes the curses gui code *much* simpler than the Qt gui code. The
question naturally arises, could the Qt gui code be simplified? Yes, but
only if Qt mouse events could do *all* the work of selecting, expanding and
contracting outline nodes. If I had it to do over again, I would
definitely investigate this possibility. Another possible simplification of
the Qt code would be to use *persistent* headline editors. If this works,
it would eliminate a lot of bookkeeping in the Qt tree code.
*Strategy*
The curses redraw code is trivial:
if self.widget and not self.busy():
self.widget.update()
This code already works. All but one unit tests pass. Some notes:
1. In the Qt code, the busy() guard prevents endless loops. This guard
might go away completely in the curses gui. Most kinds of loops simply
can't happen because Leo events don't generate user events. At present, the
code does contain a few lockouts. I'm not sure they can be removed.
2. The overridden LeoMLTree.update method draws only the nodes presently
visible on the screen. When the user "scrolls" the tree, the newly-visible
nodes are drawn from scratch.
3. There are no real headline widgets to worry about. Instead, there are
LeoTreeLine objects.
*Remaining work*
1. Support more standard key bindings in the body pane. This will require
overriding some, perhaps all, of the h_* handlers of the base classes of
the LeoBody class, namely the InputHandler, MultiLine and MultiLineEditable
classes. Note that overriding h_* handlers is not enough. Various tables
must be updated, so this is a bit tricky.
2. The key handlers must update p.b and p.h as required. In the Qt gui,
this involves very tricky calls to onBodyChanged and onHeadChanged. I
expect that these calls will be simpler in the curses gui.
3. Fixing the one failing unit test. This tests whether all text is
selected when creating a new node. This is a localized failure, but
attempts to fix it have spoiled other tests...
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.