[PythonCAD] [PATCH] Save and restore autosplitting value in layer.py
ahaas at airmail.net
Wed May 24 20:36:32 CEST 2006
On Tue, May 23, 2006 at 05:12:09PM -0500, Art Haas wrote:
> On Tue, May 23, 2006 at 10:27:53AM -0500, Art Haas wrote:
> > On Mon, May 22, 2006 at 05:54:28PM -0500, Art Haas wrote:
> > > Hi.
> > >
> > > The patch below addresses a problem I found regarding the newly added
> > > autosplitting code. The issue was that a layer would be set to not
> > > perform any autosplitting regardless of what the checkbox in the
> > > Preferences dialog setting.
> > >
> > > By default, autosplitting is off when the program starts unless you
> > > install the 'prefs.py' file into /etc/pythoncad and set Autosplit
> > > to True. I'd done that on my development machine, so I didn't see
> > > this problem until running PythonCAD on another machine where
> > > the default autosplit value was still False. Now, when an object
> > > is added to the Layer, the object invokes its setParent() method
> > > to store the Layer as the parent entity. If the newly added object
> > > is a Point, the Image instance containing the Layer will call
> > > the setAutosplit() method of the Layer, and it is at this point
> > > that things break because the autosplitting state variable the
> > > Layer examines - self.__asplit in the code below - gets set
> > > to False and never toggled back to the True value. So, the Layer
> > > ends up never performing autosplitting.
> > > [ ... snip ... ]
> > Hi.
> > The patch I sent above works, but after thinking about the problem more
> > I am not certain the approach used in resolving the problem is the right
> > choice. Unfortunately I don't have a better patch available at the
> > moment, so it will have to do for now.
> I've reworked how the autosplit state is stored in the Layer class, and
> when calling the setAutosplit() and getAutosplit() methods are useful,
> so for those of you using Subversion my changes are available via the
> usual 'svn update'. These changes replace the patch I posted two
> messages ago, and my testing on different machines indicates the
> autosplitting works correctly and can be toggled on/off without problem.
> Feedback from people using Subversion to test the autosplitting
> abilities would be welcomed. Thanks in advance.
One more small reworking is now in the repo, with the latest change
being a slight simplification of the code in the layer module. As
before, the code can be accessed via 'svn update' for Subversion users,
and any feedback would be welcomed. I'm likely to make another release
tomorrow or Friday as I want the autosplitting feature to work out
of the box, much like I thought it did but sadly found out it did not.
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