[PythonCAD] R26 and stretching
Art Haas
ahaas at airmail.net
Tue Jun 28 21:29:38 CEST 2005
On Tue, Jun 28, 2005 at 08:02:36AM -0400, Ed Richley wrote:
>
> (I don't use the mouse to enter coordinates; I usually specify
> them accurately with numeric entry), I can't stretch things.
> I tried Horizontal and Vertical and they both don't work.
>
> Stretching with mouse coordinates works fine, but not with
> numeric input. Also, "Move" works fine with both.
>
I've added the missing 'entry_event' handling code now. People getting
the PythonCAD code from SVN can just do an 'svn update' to get the code,
or you can apply this patch:
Index: PythonCAD/Interface/Gtk/gtkmodify.py
===================================================================
--- PythonCAD/Interface/Gtk/gtkmodify.py (revision 1863)
+++ PythonCAD/Interface/Gtk/gtkmodify.py (revision 1916)
@@ -388,14 +388,25 @@
_x1 = tool.popObject()
tool.setDistance((_x - _x1), 0.0)
gtkimage.setPrompt("Select the points to move.")
- # tool.delHandler("entry_event")
+ tool.delHandler("entry_event")
tool.setHandler("button_press", stretch_elem_button_press_cb)
return True
+def stretch_horiz_entry_event(gtkimage, widget, tool):
+ _entry = gtkimage.getEntry()
+ _text = _entry.get_text()
+ _entry.delete_text(0,-1)
+ if len(_text):
+ _dist = util.get_float(eval(_text, gtkimage.getImageVariables()))
+ tool.setDistance(_dist, 0.0)
+ gtkimage.setPrompt("Select the points to move.")
+ tool.setHandler("button_press", stretch_elem_button_press_cb)
+ tool.delHandler("entry_event")
+
def stretch_horizontal_init(tool):
tool.initialize()
tool.setHandler("button_press", stretch_horiz_button_press_cb)
- # tool.setHandler("entry_event", stretch_horiz_entry_event)
+ tool.setHandler("entry_event", stretch_horiz_entry_event)
#
# stretch vertical
@@ -414,14 +425,25 @@
_x1 = tool.popObject()
tool.setDistance(0.0, (_y - _y1))
gtkimage.setPrompt("Select the points to move.")
- # tool.delHandler("entry_event")
+ tool.delHandler("entry_event")
tool.setHandler("button_press", stretch_elem_button_press_cb)
return True
+def stretch_vert_entry_event(gtkimage, widget, tool):
+ _entry = gtkimage.getEntry()
+ _text = _entry.get_text()
+ _entry.delete_text(0,-1)
+ if len(_text):
+ _dist = util.get_float(eval(_text, gtkimage.getImageVariables()))
+ tool.setDistance(0.0, _dist)
+ gtkimage.setPrompt("Select the points to move.")
+ tool.setHandler("button_press", stretch_elem_button_press_cb)
+ tool.delHandler("entry_event")
+
def stretch_vertical_init(tool):
tool.initialize()
tool.setHandler("button_press", stretch_vert_button_press_cb)
- # tool.setHandler("entry_event", stretch_horiz_entry_event)
+ tool.setHandler("entry_event", stretch_vert_entry_event)
#
# split objects into two pieces or at intersection points
--
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