[PythonCAD] more undo

Art Haas ahaas at airmail.net
Sun Sep 5 21:06:07 CEST 2004


On Sat, Sep 04, 2004 at 08:57:36AM -0500, Eric Wilhelm wrote:
> I'm poking at your undo system to see how it works.  If I draw a line, 
> change the color, and then try ctrl+Z, I get this:
> 
> <raw_junk>
> 
> saveUndoData: ('add', ('point', (4, 1), 159.0, 516.0))
> saveUndoData: ('add', ('point', (5, 1), 408.0, 326.0))
> saveUndoData: ('add', ('segment', (6, 1), (None, None, None, None), 4, 
> 5))
> saveUndoData: ('attr_changed', 'color', (255, 255, 255))
> saveUndoData: ('mod', 6)
> Traceback (most recent call last):
>   File "./trunk/Interface/Gtk/gtkmenus.py", line 313, in edit_undo_cb
>     gtkimage.undo()
>   File "./trunk/Generic/image.py", line 916, in undo
>     _layer.undo()
>   File "./trunk/Generic/entity.py", line 256, in undo
>     self.__log.undo()
>   File "./trunk/Generic/logger.py", line 67, in undo
>     self.execute(True, *_data)
>   File "./trunk/Generic/layer.py", line 2388, in execute
>     _obj.undo()
>   File "./trunk/Generic/entity.py", line 256, in undo
>     self.__log.undo()
>   File "./trunk/Generic/logger.py", line 67, in undo
>     self.execute(True, *_data)
>   File "./trunk/Generic/segment.py", line 991, in execute
>     raise ValueError, "Unexpected operation: %s" % _op
> ValueError: Unexpected operation: attr_changed
> 

I've fixed this error now, and sent the corrected code to the public
repo. Changing the linetype, thickness, and color of an object should
now work. Styles still don't, unfortunately. The bug, as discussed in an
earlier reply, was that the execute() method for the GraphicObjectLog
was not being invoked.

I tested these changes on segments and circles, but the bug would have
also affected arcs, leaders, polylines, chamfers, and fillets as well.

Art
-- 
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