[wxPython] European keyboards and PyCrust

Robin, Peter

Pressing AltGr key == pressing the Ctrl and Alt keys simultaneously.
Therefore, if AltGr is pressed event.ControlDown() == 1 and event.AltDown()
== 1.

PyCrust 0.7, Python 2.1.1, wxPython 2.3.3b7, win 98 SE, swiss french
keyboard

In shell.py:

def OnChar(....)
By removing the two lines
       elif event.ControlDown() or event.AltDown():
            pass
everything is working okay: arrow keys, AltGr chars, last line editing
(Ctrl-X, C, V), Ctrl Up/Down, Alt-P, Alt-N, autocompletion with . and (

def OnKeyDown(...)
Just for testing, I replaced the lines

       # Retrieve the previous command from the history buffer.
       elif (event.ControlDown() and key == WXK_UP) \
       or (event.AltDown() and key in (ord('P'), ord('p'))):
            self.OnHistoryRetrieve(step=+1)
        # Retrieve the next command from the history buffer.
        elif (event.ControlDown() and key == WXK_DOWN) \
        or (event.AltDown() and key in (ord('N'), ord('n'))):
            self.OnHistoryRetrieve(step=-1)

by
       # Retrieve the previous command from the history buffer.
        elif ( event.ControlDown() and not(event.AltDown()) and key ==
WXK_UP ) \
        or (not(event.ControlDown()) and event.AltDown()and key in
(ord('P'), ord('p')) ):
            self.OnHistoryRetrieve(step=+1)
        # Retrieve the next command from the history buffer.
        elif ( event.ControlDown() and not(event.AltDown()) and key ==
WXK_DOWN ) \
        or ( not(event.ControlDown()) and event.AltDown() and key in
(ord('N'), ord('n')) ):
            self.OnHistoryRetrieve(step=-1)

The goal is to unable AltGr+P ou AlrGr+N. But, this is not necessary.

To Robin:

I tested again the wxSTC control in all the samples and in the demo.
Everything is working okay.

Jean-Michel Fauth, Martigny, Switzerland, an amateur programmer
jmfauth@bluewin.ch

Thanks Jean-Michel, this made life simpler for me.
I never actually realized that AltGr = Alt + Ctrl!

def OnChar(....)
By removing the two lines
       elif event.ControlDown() or event.AltDown():
            pass

I don't understand what those lines were for anyway. I don't
see that they make any difference if you press ctrl-something
or alt-something. Not in Windows at least. Pressing ctrl-L in
PyCrust will crash the app on the next Enter, but that is
regardless of those lines.

Anyway, if there is some reason to prevent Alt XOR Ctrl (ie not
AltGr), the following also works:

             if self.autoCallTip: self.autoCallTipShow(command)
         # Hack to make AltGr work.
         elif event.ControlDown() and event.AltDown():
             event.Skip()
         # Hack to keep characters from entering when Alt or Control are down.
         elif event.ControlDown() or event.AltDown():
             pass
         else:
             # Allow the normal event handling to take place.
             event.Skip()

···

At 17:46 2001-12-11 +0100, Jean-Michel wrote:

--
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se

From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Magnus
Lyckå
Sent: Tuesday, December 11, 2001 11:47 AM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] European keyboards and PyCrust

Thanks Jean-Michel, this made life simpler for me.
I never actually realized that AltGr = Alt + Ctrl!

>def OnChar(....)
>By removing the two lines
> elif event.ControlDown() or event.AltDown():
> pass

I don't understand what those lines were for anyway.

This was a hack to fix an issue with wxPython prior to the current 2.3.2
beta. Since they are no longer needed, I am removing them from the code.

I don't
see that they make any difference if you press ctrl-something
or alt-something. Not in Windows at least. Pressing ctrl-L in
PyCrust will crash the app on the next Enter, but that is
regardless of those lines.

Ouch! Yet another Scintilla feature I need to wrestle into submission.
<grin> Do you know of any others? I'd like to get any known bugs fixed prior
to wxPython 2.3.2 getting released. But I can't fix the ones I don't know
about. <wink>

Anyway, if there is some reason to prevent Alt XOR Ctrl (ie not
AltGr), the following also works:

             if self.autoCallTip: self.autoCallTipShow(command)
         # Hack to make AltGr work.
         elif event.ControlDown() and event.AltDown():
             event.Skip()
         # Hack to keep characters from entering when Alt or
Control are down.
         elif event.ControlDown() or event.AltDown():
             pass
         else:
             # Allow the normal event handling to take place.
             event.Skip()

Good suggestions. Thanks.

···

-----Original Message-----
At 17:46 2001-12-11 +0100, Jean-Michel wrote:

---
Patrick K. O'Brien
Orbtech.com - Your Source For Python Development Services
Phone: 314-963-3206

> see that they make any difference if you press ctrl-something
> or alt-something. Not in Windows at least. Pressing ctrl-L in
> PyCrust will crash the app on the next Enter, but that is
> regardless of those lines.

Ouch! Yet another Scintilla feature I need to wrestle into submission.
<grin> Do you know of any others?

You can see the default Scintilla keymap in

http://cvs.wxwindows.org/cgi-bin/viewcvs.cgi/wxWindows/contrib/src/stc/scint
illa/src/KeyMap.cxx?rev=1.6&content-type=text/vnd.viewcvs-markup

Ctrl-L is LINECUT. If you want to disable this and any others you can use
the CmdKeyClear method.

I'd like to get any known bugs fixed prior
to wxPython 2.3.2 getting released.

Too late! I'm uploading the last of the files to SF right now. If needed I
can do some 2.3.2.x releases before moving on to 2.3.3.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

I see. Well, I guess I better tag the version of PyCrust in CVS as 0.7.0.
These minor fixes will just have to be part of PyCrust 0.7.1.

I think it is just going to be the case that we will not always be
completely in sync, and that anybody who wants the latest PyCrust will have
to get it from the PyCrust project on SourceForge, rather than the files
shipping with wxPython. C'est la vie, n'est pas? (If I spelled that
correctly, it represents the sum total of everything I remember from four
full years of high school French class. What a waste. I doubt I could even
hail a taxicab in Paris.)

···

---
Patrick K. O'Brien
Orbtech.com - Your Source For Python Development Services
Phone: 314-963-3206

-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Robin Dunn
Sent: Tuesday, December 11, 2001 1:00 PM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] European keyboards and PyCrust

> I'd like to get any known bugs fixed prior
> to wxPython 2.3.2 getting released.

Too late! I'm uploading the last of the files to SF right now.
If needed I
can do some 2.3.2.x releases before moving on to 2.3.3.

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Robin Dunn:

Ctrl-L is LINECUT. If you want to disable this and any others you can use
the CmdKeyClear method.

   If you want absolutely no keyboard surprises from Scintilla then you can
use the CmdKeyClearAll method. But then you have to reinstate the keys you
want either by handling them yourself or by using CmdKeyAssign to tell
Scintilla what you want them to do.

   It is very easy in Python to have a list of key bindings (copy the map in
scintilla/src/KeyMap.cxx and convert braces and constant names etc. as
appropriate) then loop through it to assign each key.

   Neil