Commit 879b4b17 authored by sumpfralle's avatar sumpfralle

pressing "return" immediately activates scale/shift of model (via "grab_default" ...)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@540 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5cdf59d6
...@@ -281,16 +281,38 @@ class ProjectGui: ...@@ -281,16 +281,38 @@ class ProjectGui:
self.gui.get_object("Rotate").connect("clicked", self.transform_model) self.gui.get_object("Rotate").connect("clicked", self.transform_model)
self.gui.get_object("Flip").connect("clicked", self.transform_model) self.gui.get_object("Flip").connect("clicked", self.transform_model)
self.gui.get_object("Swap").connect("clicked", self.transform_model) self.gui.get_object("Swap").connect("clicked", self.transform_model)
self.gui.get_object("Shift Model").connect("clicked", self.shift_model, True) shift_model_button = self.gui.get_object("Shift Model")
shift_model_button.connect("clicked", self.shift_model, True)
# Make the "shift" button the default while one of the x/y/z values is
# active.
for objname in ("shift_x", "shift_y", "shift_z"):
self.gui.get_object(objname).connect("focus-in-event",
lambda widget, data: shift_model_button.grab_default())
self.gui.get_object(objname).connect("focus-out-event",
lambda widget, data: self.window.set_default(None))
self.gui.get_object("Shift To Origin").connect("clicked", self.shift_model, False) self.gui.get_object("Shift To Origin").connect("clicked", self.shift_model, False)
# scale model # scale model
self.gui.get_object("ScalePercent").set_value(100) scale_percent = self.gui.get_object("ScalePercent")
self.gui.get_object("ScaleModelButton").connect("clicked", self.scale_model) scale_button = self.gui.get_object("ScaleModelButton")
scale_percent.set_value(100)
scale_percent.connect("focus-in-event",
lambda widget, data: scale_button.grab_default())
scale_percent.connect("focus-out-event",
lambda widget, data: self.window.set_default(None))
scale_button.connect("clicked", self.scale_model)
# scale model to an axis dimension # scale model to an axis dimension
self.gui.get_object("ScaleDimensionAxis").connect("changed", self.update_scale_controls) self.gui.get_object("ScaleDimensionAxis").connect("changed",
self.gui.get_object("ScaleDimensionButton").connect("clicked", self.scale_model_axis_fit) self.update_scale_controls)
scale_dimension_button = self.gui.get_object("ScaleDimensionButton")
scale_dimension_button.connect("clicked", self.scale_model_axis_fit)
scale_dimension_control = self.gui.get_object("ScaleDimensionControl")
scale_dimension_control.connect("focus-in-event",
lambda widget, data: scale_dimension_button.grab_default())
scale_dimension_control.connect("focus-out-event",
lambda widget, data: self.window.set_default(None))
# support grid # support grid
self.gui.get_object("SupportGridEnable").connect("clicked", self.update_support_grid_controls) self.gui.get_object("SupportGridEnable").connect("clicked",
self.update_support_grid_controls)
grid_distance_x = self.gui.get_object("SupportGridDistanceX") grid_distance_x = self.gui.get_object("SupportGridDistanceX")
grid_distance_x.connect("value-changed", grid_distance_x.connect("value-changed",
self.update_support_grid_controls) self.update_support_grid_controls)
......
...@@ -562,6 +562,7 @@ ...@@ -562,6 +562,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="activates_default">True</property>
<property name="adjustment">scale_percent_value</property> <property name="adjustment">scale_percent_value</property>
<property name="numeric">True</property> <property name="numeric">True</property>
</object> </object>
...@@ -589,6 +590,7 @@ ...@@ -589,6 +590,7 @@
<property name="label" translatable="yes">Scale Model</property> <property name="label" translatable="yes">Scale Model</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
</object> </object>
<packing> <packing>
...@@ -633,6 +635,7 @@ ...@@ -633,6 +635,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="activates_default">True</property>
<property name="adjustment">ScaleDimensionValue</property> <property name="adjustment">ScaleDimensionValue</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
...@@ -665,6 +668,7 @@ ...@@ -665,6 +668,7 @@
<property name="label" translatable="yes">Fit Dimension</property> <property name="label" translatable="yes">Fit Dimension</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
</object> </object>
<packing> <packing>
...@@ -727,6 +731,7 @@ ...@@ -727,6 +731,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="activates_default">True</property>
<property name="width_chars">5</property> <property name="width_chars">5</property>
<property name="adjustment">shift-x</property> <property name="adjustment">shift-x</property>
<property name="digits">2</property> <property name="digits">2</property>
...@@ -743,6 +748,7 @@ ...@@ -743,6 +748,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="activates_default">True</property>
<property name="width_chars">5</property> <property name="width_chars">5</property>
<property name="adjustment">shift-y</property> <property name="adjustment">shift-y</property>
<property name="digits">2</property> <property name="digits">2</property>
...@@ -761,6 +767,7 @@ ...@@ -761,6 +767,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property> <property name="invisible_char">&#x2022;</property>
<property name="activates_default">True</property>
<property name="width_chars">5</property> <property name="width_chars">5</property>
<property name="adjustment">shift-z</property> <property name="adjustment">shift-z</property>
<property name="digits">2</property> <property name="digits">2</property>
...@@ -816,6 +823,7 @@ ...@@ -816,6 +823,7 @@
<property name="label" translatable="yes">Shift</property> <property name="label" translatable="yes">Shift</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
</object> </object>
<packing> <packing>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment