← Back to team overview

kicad-developers team mailing list archive

Re: Python Scripting Window event handling

 

On 06/13/2014 08:15 AM, jp charras wrote:
> Le 13/06/2014 09:43, Brian Sidebotham a écrit :
>> I know I had this same problem with the python console on Windows. I
>> don't t think this is something that changed, I think it's always been
>> there.
>>
>> I can test on Windows tonight for you and let you know.
>>
>> Best Regards, Brian.
> 
> This issue happens both on Windows and Linux (wxWidgets 3.0).
> 
> Perhaps a focus issue between the main frame and the python console,
> related to hot-key accelerators in menu:
> 
> these 2 chars are the only 2 printable keys which are used as
> accelerators in the main menu (see main menu/Place)
> There are other accelerators but they are not printable (Ctrl Z, Ctrl Y
> .. ), therefore you do not see they are not sent to the console (but you
> can see they are "captured" by the main menu.
> 
> 
> If in the hot-key editor, you change o or x to an other (printable) key,
> the new key is no more usable in python console, but o or x become usable.


Up front: obviously, the problem makes the console unusable.  I am somewhat relieved that
recent changes did not cause it.  If it cannot be fixed, then nobody should be surprised
if the console disappears someday.

As to the fix: unless someone gets lucky, it may require a good understanding of
wxEvtHandler logic as it pertains to the parent wxFrame and children.  Paying attention to
focus might help with a fix, but that assumes focus is not being man-handled (forced to a
specific window by kicad).

If this feature is going to survive it has to be made usable.  In my commercial software I
put a distinguishing feature on the child window title/border when that child has the
focus in a multi-child frame.  Only one child has this visible feature (a gradient fill)
at any time.  This way the user knows what kind of keys are legal at any point in time,
and where they will be routed to.  My parent frame itself does not do application specific
key handling, only operating system frame management key handling.


Focus has to come to the rescue here.

This is all I can say about it, hopefully someone will step up and find a fix.  Normally I
might offer to do that, but here it requires building wxPython from source, and I'm not
setup to do that.  I can debug simple wx from source now, but not wxPython without several
hours investment.  I don't have that time now.

TIA for any fix,

Dick


P.S. I stumbled onto this trying to imp'o'rt a python module.

If it does not get fixed soon, do we have a bug report for it?




Follow ups

References