On 7 Mrz., 13:42, "Edward K. Ream" <[email protected]> wrote:
> On Sat, Mar 6, 2010 at 2:54 PM, resi147 <[email protected]> wrote:
> > Debugging leo with all the advice from Edward brought me to the
> > conclusion that my problem has nothing to do with
> > key/event handling. I think it is a very basic key bindings problem.
> > The keys are all recognized correctly, i.e.
> > The '@' is correctly reported as ALT-'L' in every of the mentioned
> > functions. So my problem is, how to map the
> > ALT-L to '@' in myLeoSettings.leo
>
> This must be done in qtGui.py, not in myLeoSettings.leo.
>
> The place for this kind of hack is in the class leoKeyEvent, after the
> comment:
>
> # Last minute-munges to keysym.
>
> Something like this (not tested):
>
> if sys.platform.startswith('darwin'):
> if tkKey == 'Alt-L':
> tkKey = stroke = '@'
>
> Let me know exactly what works and I'll make the changes to the trunk.
I put the following in qtGui.py after # Last minute-munges to
keysym.
if sys.platform.startswith('darwin'):
darwinmap = {
'Alt-Key-5': '[',
'Alt-Key-6': ']',
'Alt-Key-7': '|',
'Alt-slash': '\\',
'Alt-Key-8': '{',
'Alt-Key-9': '}',
'Alt-e': '€',
'Alt-l': '@',
}
if tkKey in darwinmap:
tkKey = stroke = darwinmap[tkKey]
It works quite reasonabe. Sometimes (not really well reproducable)
following message appears:
/Users/tst/Leo-4.7-final/leo/core/leoKeys.py:3363: UnicodeWarning:
Unicode equal comparison failed to convert both arguments to Unicode -
interpreting them as being unequal
if k.abortAllModesKey and stroke == k.abortAllModesKey:
/Users/scalet/Leo-4.7-final/leo/core/leoKeys.py:2521: UnicodeWarning:
Unicode equal comparison failed to convert both arguments to Unicode -
interpreting them as being unequal
if k.abortAllModesKey and stroke == k.abortAllModesKey: # 'Control-
g'
nonetheless the special characters were inserted as expected.
I think all this is quite a hack, but ... thanks for the hack, most
important for me it's working for now.
Karl
--
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.