On Fri, May 14, 2010 at 2:26 AM, Ville M. Vainio <[email protected]> wrote:

> For occasions when keypress means something apart from the expected default
> action (this doesn't mean commands, they can be handled by
> QAction/QShortcut), you would have a dispatch dict that calls your own
> function. This would be in the ui layer as well, not core.

This would have to be done for *all* keystrokes.  Because of vim
emulation, we can not predict what *any* keystroke means.
Furthermore, what a keystroke means can, and often does, depend on a
mode handled in leoKeys.py.

Truly, having the gui call k.masterKeyHandler is the simplest thing
that could possibly work.

> Core needs to be asked for what the completions are, not how user activates 
> them.

The core knows both.  Several keystrokes can invoke the autocompleter
in various ways.  This is a key binding issue, not a gui issue.

The autoCompleterClass class in leoKeys.py coordinates many different,
related, activities: it drives the autocompletion tab in the log pane
(delegating actual gui-related stuff to the gui), it determines the
possible completions, and it (optionally) inserts text into the body
pane.

It would be wrong to do any of this in a gui.  The gui should handle
only gui-related chores.  That does not include any aspect of
autocompletion except for showing the possible completions in a tab in
the log pane.

It gets back, fundamentally, to proper encapsulation.  Encapsulation
does impose costs, the costs of communication between black boxes.
20+ years of experience tells me that the kind of encapsulation I use
is always beneficial.  In the case of autocompletion, I am not aware
of any significant difficulty that arises because of the separation
between the gui code and leoKeys.py.  The gui just calls
k.masterKeyHandler, which does *all* the heavy lifting.

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.

Reply via email to