[PythonCAD] _got_line?

Art Haas ahaas at airmail.net
Tue Jun 6 16:30:43 CEST 2006


On Tue, Jun 06, 2006 at 02:17:10AM -0400, Russ Nelson wrote:
> In Interface/Gtk/gtkmirror.py/get_mirror_line_cb, a variable called
> "_got_line" is being set, but is never being used.  Should that line
> be removed?

No, but it needs to be moved and set if a construction is selected.
I've commited the following change to fix this problem you found.
For those using subversion an 'svn update' will get you this fix.

Thanks!

Art Haas

Index: PythonCAD/Interface/Gtk/gtkmirror.py
===================================================================
--- PythonCAD/Interface/Gtk/gtkmirror.py	(revision 2364)
+++ PythonCAD/Interface/Gtk/gtkmirror.py	(revision 2365)
@@ -109,19 +109,21 @@
     _x, _y = gtkimage.getCurrentPoint()
     _tol = gtkimage.getTolerance()
     _objdict = gtkimage.mapPoint(_x, _y, _tol)
+    _got_line = False
     if len(_objdict):
         _active_layer = gtkimage.getActiveLayer()
-        _got_line = False
         if _active_layer in _objdict:
             for _obj, _pt in _objdict[_active_layer]:
                 if isinstance(_obj, (HCLine, VCLine, ACLine, CLine)):
                     tool.setMirrorLine(_obj)
+                    _got_line = True
                     break
-    if gtkimage.hasSelection():
-        mirror_objects(gtkimage, tool, gtkimage.getSelectedObjects())
-    else:
-        tool.setHandler("button_press", first_button_press_cb)
-        gtkimage.setPrompt(_('Click on the objects to mirror.'))
+    if _got_line:
+        if gtkimage.hasSelection():
+            mirror_objects(gtkimage, tool, gtkimage.getSelectedObjects())
+        else:
+            tool.setHandler("button_press", first_button_press_cb)
+            gtkimage.setPrompt(_('Click on the objects to mirror.'))
     return True
 
 def mirror_mode_init(tool):
-- 
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