List Info

Thread: Fix a copy-and-paste error in image.py




Fix a copy-and-paste error in image.py
user name
2006-10-24 19:56:41
Hi.

Found another dumb copy-and-paste error today. Patch below
for people
not using Subversion; for those using it just 'svn update'
to get
the fix.

Art

Index: PythonCAD/Generic/image.py
============================================================
=======
--- PythonCAD/Generic/image.py	(revision 2628)
+++ PythonCAD/Generic/image.py	(working copy)
 -1829,7
+1829,7 
             raise ValueError, "Invalid argument count:
%d" % _alen
         _units = args[0]
         # fixme - maybe add error checking  ...
-        self.saveUndoData('scale_changed', _units)
+        self.saveUndoData('units_changed', _units)
 
     def __addedChild(self, image, *args):
         _alen = len(args)
-- 
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
_______________________________________________
PythonCAD mailing list
PythonCADpython.org
htt
p://mail.python.org/mailman/listinfo/pythoncad
Fix a copy-and-paste error in image.py
user name
2006-10-24 20:38:07
On Tue, 24 Oct 2006, Art Haas wrote:

>  -1829,7 +1829,7 

> +        self.saveUndoData('units_changed', _units)

Art,

   It was line 1981 on my copy, but I made the change.

Thanks,

Rich

-- 
Richard B. Shepard, Ph.D.               |    The
Environmental Permitting
Applied Ecosystem Services, Inc.(TM)    |           
Accelerator
<http://www.appl-ecosys
.com>     Voice: 503-667-4517      Fax: 503-667-8863
_______________________________________________
PythonCAD mailing list
PythonCADpython.org
htt
p://mail.python.org/mailman/listinfo/pythoncad
Followup patch for gtkimage.py
user name
2006-10-24 23:38:04
On Tue, Oct 24, 2006 at 02:56:41PM -0500, Art Haas wrote:
> Hi.
> 
> Found another dumb copy-and-paste error today. Patch
below for people
> not using Subversion; for those using it just 'svn
update' to get
> the fix.
> 
> Index: PythonCAD/Generic/image.py
>
============================================================
=======
> --- PythonCAD/Generic/image.py	(revision 2628)
> +++ PythonCAD/Generic/image.py	(working copy)
>  -1829,7 +1829,7 
>              raise ValueError, "Invalid argument
count: %d" % _alen
>          _units = args[0]
>          # fixme - maybe add error checking  ...
> -        self.saveUndoData('scale_changed', _units)
> +        self.saveUndoData('units_changed', _units)
>  
>      def __addedChild(self, image, *args):
>          _alen = len(args)

Hi.

After applying the patch above, the following patch is worth
applying as
well. Switching units, then undoing the switch, will fail to
generate
a redraw operation, a problem I just found after playing
with the code
above. The change to gtkpycad.py below add the bits needed
to make
the redraw operation occur as expected.

Index: PythonCAD/Interface/Gtk/gtkimage.py
============================================================
=======
--- PythonCAD/Interface/Gtk/gtkimage.py	(revision 2629)
+++ PythonCAD/Interface/Gtk/gtkimage.py	(revision 2630)
 -243,6
+243,7 
         _image.connect('removed_child',
self.__imageRemovedChild)
         _image.connect('group_action_started',
self.__groupActionStarted)
         _image.connect('group_action_ended',
self.__groupActionEnded)
+        _image.connect('units_changed',
self.__imageUnitsChanged)
 
         _layers = [_image.getTopLayer()]
         while len(_layers):
 -1141,7
+1142,11 
             self.refresh()
         else:
             self.__refresh = True
-            
+
+    def __imageUnitsChanged(self, obj, *args):
+        # print "__imageUnitsChanged()"
+        self.redraw()
+        
     def __objChangePending(self, obj, *args):
         # print "__objChangePending()" + `obj`
         _alen = len(args)
-- 
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
_______________________________________________
PythonCAD mailing list
PythonCADpython.org
htt
p://mail.python.org/mailman/listinfo/pythoncad
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )