On Mon, Jul 29, 2013 at 8:05 AM, jkn <[email protected]> wrote:

> (apologies in advance: I have only done minor searching before asking.
> This may be a Qt, rqather than a Leo, question... )
>

It's both.


>
> I am starting to look into creating my own set of Key bindings for Leo. Is
> there a way to specify that, on a 'standard' PC keyboard, a particular key
> on the numeric keypad has been pressed?
>

Not yet.  It should be possible, but it won't be easy because it two very
messy parts of Leo:

1. Translation of key codes to "canonical" key representation.  This is
done in the eventFilter method of the leoQtEventFilter class.  This code is
not only unbearably ugly, but it may also be keyboard specific.

2. Translation of user settings to canonical key representation.  This is
done in the keyHandlerClass class in leoKeys.py, specifically the nest of
methods at:

    leoPy.leo#Code-->Gui base classes-->@file leoKeys.py-->
    class keyHandlerClass-->k.Shortcuts & bindings

For instance, I want to use 'Keypad-Insert', 'Keypad-minus', 'Keypad-plus'
> to have specific keybindings cf. 'Insert', 'minus', 'plus'. I'd like to
> know if this is possible and if so what the actual names to use would be.
>

This would be a reasonable addition to Leo.  Feel free to file a wishlist
bug at: https://bugs.launchpad.net/leo-editor

A quick check of the Qt QKeyEvent class shows that key events have a
KeypadModifier
bit in the KeyboardModifier field, so it should be possible to distinguish
keypad keys.  It's just that Leo doesn't do it.  And as indicated above,
the change is not entirely trivial ;-)

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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to