[PythonCAD] [PATCH] Fixes for typos and dimension changes

Art Haas ahaas at airmail.net
Tue Oct 24 16:56:04 CEST 2006


Hi.

The three patches below fix a number of errors in PythonCAD, and I'm
sending this out to the list so people not getting the code via
subversion can get the changes. The changes to 'dimension.py' are
meant to fix a redraw bug where changing the dimension text attributes
would not be displayed immediately. People using subversion to get
the code just need to do 'svn update'.

I've been slogging along on the changes handling the storage and
display of user preferences, and unfortunately the work has been
moving more slowly than I hoped. There have also been more times
where I've had to deal with non-computer things of late, also
taking time away from PythonCAD development. I'm now hoping to make
the next release in the middle of November, as it is highly unlikely
I'll get the fixes I want in the next release done over the next
week.

Art Haas

Index: PythonCAD/Interface/Gtk/gtkmenus.py
===================================================================
--- PythonCAD/Interface/Gtk/gtkmenus.py	(revision 2625)
+++ PythonCAD/Interface/Gtk/gtkmenus.py	(revision 2628)
@@ -1106,7 +1106,7 @@
     _tool.setPrimary(flag)
     _tool.setObjtype(dimension.DimString)
     gtkimage.setTool(_tool)
-    gtkmodify.change_dimstr_precision_init(gtkimage, _tool)
+    gtkmodify.change_dimstr_units_init(gtkimage, _tool)
 
 def change_dim_primary_units_cb(menuitem, gtkimage):
     _unit = gtkmodify.change_dimstr_units_dialog(gtkimage, 'DIM_PRIMARY_UNITS')
Index: PythonCAD/Interface/Gtk/gtkconobjs.py
===================================================================
--- PythonCAD/Interface/Gtk/gtkconobjs.py	(revision 2625)
+++ PythonCAD/Interface/Gtk/gtkconobjs.py	(revision 2628)
@@ -431,9 +431,9 @@
 #
 
 def parallel_refpt_button_press_cb(gtkimage, widget, event, tool):
-    tool.setReferencePoint(_x, _y)
     _image = gtkimage.getImage()
     _x, _y = _image.getCurrentPoint()
+    tool.setReferencePoint(_x, _y)
     _init_func = tool.getHandler("initialize")
     _image.startAction()
     try:
Index: PythonCAD/Generic/dimension.py
===================================================================
--- PythonCAD/Generic/dimension.py	(revision 2625)
+++ PythonCAD/Generic/dimension.py	(revision 2628)
@@ -1184,6 +1184,7 @@
         'thickness_changed' : True,
         'scale_changed' : True,
         'location_changed' : True,
+        'dimstring_changed' : True,
         'moved' : True,
         }
         
@@ -2357,16 +2358,52 @@
         _alen = len(args)
         if _alen < 1:
             raise ValueError, "Invalid argument count: %d" % _alen
-        if args[0] == 'moved':
-            self.startChange('moved')
+        _arg = args[0]
+        if _arg == 'moved':
+            self.startChange(_arg)
+        elif (_arg == 'textstyle_changed' or
+              _arg == 'font_family_changed' or
+              _arg == 'font_style_changed' or
+              _arg == 'font_weight_changed' or
+              _arg == 'font_color_changed' or
+              _arg == 'text_size_changed' or
+              _arg == 'text_angle_changed' or
+              _arg == 'text_alignment_changed' or
+              _arg == 'prefix_changed' or
+              _arg == 'suffix_changed' or
+              _arg == 'units_changed' or
+              _arg == 'precision_changed' or
+              _arg == 'print_zero_changed' or
+              _arg == 'print_decimal_changed'):
+            self.startChange('dimstring_changed')
+        else:
+            pass
 
     def __dimstringChangeComplete(self, p, *args):
         _alen = len(args)
         if _alen < 1:
             raise ValueError, "Invalid argument count: %d" % _alen
-        if args[0] == 'moved':
-            self.endChange('moved')
-
+        _arg = args[0]
+        if _arg == 'moved':
+            self.endChanged(_arg)
+        elif (_arg == 'textstyle_changed' or
+              _arg == 'font_family_changed' or
+              _arg == 'font_style_changed' or
+              _arg == 'font_weight_changed' or
+              _arg == 'font_color_changed' or
+              _arg == 'text_size_changed' or
+              _arg == 'text_angle_changed' or
+              _arg == 'text_alignment_changed' or
+              _arg == 'prefix_changed' or
+              _arg == 'suffix_changed' or
+              _arg == 'units_changed' or
+              _arg == 'precision_changed' or
+              _arg == 'print_zero_changed' or
+              _arg == 'print_decimal_changed'):
+            self.endChange('dimstring_changed')
+        else:
+            pass
+            
     def sendsMessage(self, m):
         if m in Dimension.__messages:
             return True
-- 
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