[PythonCAD] PythonCAD changes and documentation

Art Haas ahaas at airmail.net
Mon Oct 17 20:42:20 CEST 2005


On Mon, Oct 17, 2005 at 11:36:40AM -0400, Stuart Brorson wrote:
> Hello PythonCADsters --
> 
> I spent some spare hours on PythonCAD over the last few days.  Here's
> what I did:
> 
> *  I implemented keyboard mnemonics for all actions.  You can now use
> the "keyboard in left hand, mouse in right hand" method to
> conveniently drive the program.  I will e-mail the patches (a diff
> file) directly to Art.
> 
> *  I created an OpenOffice doc which lists all available actions along
> with their accelerators, mnemonics, and text commands.  Please find
> the .sxw original along with a .pdf version attached below.
> 
> Art -- a kindly suggestion:  Please create a "doc" directory beneath
> the main pythoncad directory and put this doc in there.  It will
> hopefully be useful to other PythonCAD newbies.

I'll add a directory for these files.

> *  I fixed the issue with the <escape> key.  Now, if you are in the
> middle or end of some action and hit the <escape> key, then the
> program will return to an idle mode, and await the next command.
> 
> *  I also was puzzled by the program's behavior w.r.t. entering normal
> keystrokes for entering text commands.  Previously, the entered text
> would sometimes go into the Entry box at the bottom of the window, but
> sometimes a popup Entry box would appear and accept the text.  This
> behavior seemed to be related to which of the window sub-widgets was
> last activated.  I modified the program so that any normal text
> keystrokes now go only into the Entry field at the bottom of the
> window.  Hopefully, this is the desired behavior.
 
It isn't, but the behavior you describe about the sometimes unexpected
keypress handling is not very nice either. When the Layer display on the
left has the focus, arrow keys allow the user to select and change the
active layer in the drawing. Pressing a letter key allows for selecting
a Layer by name. All this is part of the TreeView widget in GTK.

What would be ideal would be some clever means of making it obvious
where keypress events are handled. If the focus is in the Layer display,
and the user wants to enter some commands, then the user should type in
a 'Tab' to move the focus to the DrawingArea or the entry box directly.

> *  To help me understand how the UI worked, I created the beginnings
> of a quasi-UML diagram showing the components of the GTKImage class.
> I did the drawing using dia; please find the original attached.  If
> desired, I can create a .png.

One of my long-term goals is to remove the GTKImage class and replace it
with an ImageView/ImageWindow. See below for more details ...

> Art -- another kindly suggestion:  Please create a subdirectory
> "development" beneath the "doc" directory, and place this drawing in
> there.  It will hopefully be useful to other newbie developers.  And
> the more help provided to developers, the more developers will
> (hopefully) show up.  In any event, I will add more stuff to the
> drawing as I learn more about the program.
> 
> Now for some questions.
> 
> *  I noticed two classes (in gtkshell.py) which seem to be unused:
> ImageView and ImageWindow.   What are these?  Are they vestigal
> classes which are no longer needed?  Or are they an as-yet
> unimplemented feature?
 
They are unimplemented as yet. As I wrote above, these classes will
hopefully be the replacement for the GTKImage class. The GTKImage class
uses the Image class as a base class, and while this is a workable
design, I've come to believe it is a poor choice. I really want to
try and keep a "wall" between the Interface code and the interface
neutral core, and GTKImage class pokes holes in that plan. When I
first started PythonCAD there was no messaging mechanism in the code, so
subclassing objects was my means of bridging the interface/core gap.

> *  When I save out a drawing, close and restart PythonCAD and try to
> read in the drawing, I get this error:
> 
> Failed loading '/home/sdb/TestOfPythonCAD.xml.gz'!
> /usr/lib/python2.3/site-packages/_xmlplus/parsers/pyexpat.so:
> undefined symbol: PyUnicodeUCS4_Decode
> 
> It looks to me like there is a problem with my XML installation.  Has
> anybody else seen this?

That looks like a Python installation issue as you appear to be missing
some shared library.

> *  Typing in command strings doesn't seem to work.  When I type
> e.g. copy, I get this:
> 
> Traceback (most recent call last):
>   File "/usr/local/src/pythoncad/PythonCAD/Interface/Gtk/gtkimage.py", line 255,
> in entry_event
>     eval(_cmd) # this will go away ...
>   File "<string>", line 0, in ?
> NameError: name 'gtkmenus' is not defined
> 
> Is this a known problem?  I can work on it if desired, but don't want
> to interfere if somebody else is taking care of this.

Bug. I'll look at this.

> ================================================================
> 
> Other random notes:
> 
> *  I haven't done any re-orgainzation of the menus yet.  I may
> get to that in a few days.
> 
> *  Selection mechanism:  It would be nice if you could just click on
> an object (rather than doing "edit -> select") to select it.  Are
> there any objections to that behavior?
 
Allowing this behavior depends on how it is implemented. Going the
'Edit' -> 'Select' route clearly indicates the the program is now in
a selection mode.

> Enjoy!  I'll be contributing more stuff as time goes on.

Thanks.

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822


More information about the PythonCAD mailing list