[PythonCAD] Big changes available at public repo
ahaas at airmail.net
Fri Jun 30 01:48:05 CEST 2006
There's new stuff available for those of you using Subversion; a simple
'svn update' and you'll get the goodies.
As for what these changes themselves, they are essentially a re-writing
of the GTKImage class and the required followups. I'd written before
about replacing GTKImage with code in the 'gtkshell.py' file with the
goals being greatly simplified entity drawing, the removal of
many/most/all of the various redraw() calls sprinkled around the code,
and complete the separation of the interface and core code by relying on
the messaging system for exchanging information. This work, however, had
stalled to an extent.
While at a doctor visit last week, I decided to take as much of the code
from ImageView/ImageWindow and bring it back into the GTKImage class and
work the issues out there. A few painkillers and some typing later, the
GTKImage class was shortly transformed into a class utilizing the
messaging system for responding to the core Image adding, modifying,
and removing entities. The drawing routines from the ImageView class
which were designed to draw entities based on those messages were
brought into the GTKImage class, and various fixes later they were
working, allowing me to remove the redraw() calls throughout much
of the code. Previously, when an entity was added to an Image, the
entire Image was redrawn. As the number of entities increased, the
redraw operations took longer and longer. The new code now only
draws the new entity if it is visible, not the entire lot again.
People using slower machines with less powerful graphics cards should
notice the speedup.
The second big change was to change the base class of the GTKImage
class. Previously it was the Image class defined in the
'PythonCAD/Generic/image.py' file. Now the base class is simply
the Python 'object' class. This change completes the separation
of the interface and the core code from an object hierarchy. Making
this change, however, required lots of changes to the various files
in the 'PythonCAD/Interface/Gtk' directory. I think I've managed to
make all the needed changes, but it wouldn't be surprising if a few
more edits are needed to complete things.
The end result of all the changes is that the interface now relies
on the messaging system completely for notification of entity
addition, modification, and removal. These changes also greatly
improve the responsiveness of drawing operations, benefitting
everyone but especially people on older hardware. I'll be tweaking
things over the next few days as I clean up some of the changes
plus fix the errors that still quietly lurk in the code.
For people wanting to try out the new code, please let me know when (not
if) you find a glitch or two. The problems are usually simple to fix,
as I've had to make several quick fixes after the initial big batch of
changes were checked in.
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