[PythonCAD] New patches to PythonCAD . . . .

Stuart Brorson sdb at cloud9.net
Fri Dec 9 20:09:01 CET 2005

Art and PythonCADsters --

I've been silent for a while!  Thanks for the most recent release of

I have recently had a little time to do some hacking on PythonCAD.  In
particular, I have implemented the following two changes:

1.  I have long wanted to move objects on the following way:

    1.  Select all objects to be moved.  They highlight upon
    2.  Do "modify -> move -> move horizontal"
    3a. 1  The user types in the distance to move.
           The numerical distance appears in
           the text Entry widget at the bottom of the screen.
    3a. 2  Hit <return>.  The selected objects move, and are
           automatically deselected after the move.
    -----------  <or>  ------------
    3b. 1. The user presses the first left mouse button to define a
           move distance.
    3b. 2. The user presses the second left mouse button to define
           the move distance.  The selected objects move, and
           are automatically deselected after the move.

As you know, the way it works now is:  1.  Do "modify -> move -> move
horizontal".  2.  Define move distance.  3.  Select items to move.

Personally, I think it makes more sense to first select the items you
want to act upon, and then do the action.  Right now PythonCAD is
mixed: some actions are done by selecting first, then acting, and
others are done by choosing the action and then selecting the
objects.  As a user, I favor a consistant interface, and one where you
select first and then act is the most common, most logical,
and most up-to-date.

I have modified only the "modify -> move -> move horizontal" action to
work in my preferred way.  I wanted to see how open you were to this
kind of change.  If you do like the change, then I can modify all the
other actions to behave this way also.  If you don't like it, that's
too bad for me, but at least I didn't make zillions of changes.  In
any event,  but I really think that "select first, then act" is the
best way to drive PythonCAD, and I would appreciate it if you gave
this method some thought.

Note that I had to make one architectural change to make "select
first, then act" work for text objects:  I had to make TextBlock a
subclass of GraphicObject (it was subclassed to Entity).  Without this
change, text wouldn't move using
PythonCAD.Generic.move.move_objects().  Now moving text works, but I
get lots warning spew when the program is run and addStyle is called.
The program seems to work anyway.  The warning spew occurs because
_layerAddedChild tries to setStyle or getStyle on the
text.  Maybe I need to add a Style parameter to TextBlock?  Or make
the conditional (isinstance(_obj,  GraphicObject)) return true for
text by defining a different type of class which can be moved?  In any
event, if you don't like my changes, I didn't want to get too far
ahead in cleaning up this issue.

2.  Next change:  Added stuff to Entry, TreeView, and
window_general_event to try to make entry box behave as I want, but
also pass arrow keys to the TreeView, which is what you want.  That
is, I want to type numbers into the Entry widget at the bottom of the
window when asked for numerical input (e.g. when making a move).  My
changes seem to work, but you must sometimes
first select the LayerDisplay area with the mouse.  That is, when the
Entry box has the focus, it doesn't let any arrow keys past it to get
to the TreeView. I can look at that more, but first wanted to gague
your interest in this change.

Please find my patches attached here.  Please let me know how
interested you are in these changes, and depending upon your interest
I can continue working on cleaning them up, or I can drop them.  BTW:
the patches are done against revision 2077, which is the last time I
was able to do an "svn update".  If this presents a problem, please let
me know.

Finally, Art, you have mentioned several times doing away with GTKImage and
replacing it with ImageView and ImageWindow.  I may have asked this 
but could you please give a quick top-level overview of what 
functionality these
two classes are supposed to implement.  I more or less understand 
GTKImage (it's
the top-level class for the entire user interface), but I'm less certain what
ImageView and ImageWindow are all about.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PythonCAD_20051209.diff.gz
Type: application/gzip
Size: 4276 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythoncad/attachments/20051209/b75b3eb1/PythonCAD_20051209.diff.bin

More information about the PythonCAD mailing list