Commit 6984090c authored by sumpfralle's avatar sumpfralle

disable "scale" controls for zero-sized dimensions (e.g. contour models)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@488 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5c4bd378
...@@ -277,7 +277,7 @@ class ProjectGui: ...@@ -277,7 +277,7 @@ class ProjectGui:
self.gui.get_object("ScalePercent").set_value(100) self.gui.get_object("ScalePercent").set_value(100)
self.gui.get_object("ScaleModelButton").connect("clicked", self.scale_model) self.gui.get_object("ScaleModelButton").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.switch_scale_axis) self.gui.get_object("ScaleDimensionAxis").connect("changed", self.update_scale_controls)
self.gui.get_object("ScaleDimensionButton").connect("clicked", self.scale_model_axis_fit) self.gui.get_object("ScaleDimensionButton").connect("clicked", self.scale_model_axis_fit)
# 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)
...@@ -546,7 +546,7 @@ class ProjectGui: ...@@ -546,7 +546,7 @@ class ProjectGui:
self.update_save_actions() self.update_save_actions()
self.update_unit_labels() self.update_unit_labels()
self.update_support_grid_controls() self.update_support_grid_controls()
self.switch_scale_axis() self.update_scale_controls()
def progress_activity_guard(func): def progress_activity_guard(func):
def progress_activity_guard_wrapper(self, *args, **kwargs): def progress_activity_guard_wrapper(self, *args, **kwargs):
...@@ -1457,22 +1457,22 @@ class ProjectGui: ...@@ -1457,22 +1457,22 @@ class ProjectGui:
self.update_view() self.update_view()
@gui_activity_guard @gui_activity_guard
def switch_scale_axis(self, widget=None): def update_scale_controls(self, widget=None):
if self.model is None: if self.model is None:
return return
index = self.gui.get_object("ScaleDimensionAxis").get_active() axis_control = self.gui.get_object("ScaleDimensionAxis")
if index == 0: scale_button = self.gui.get_object("ScaleDimensionButton")
# x axis scale_value = self.gui.get_object("ScaleDimensionControl")
value = self.model.maxx - self.model.minx index = axis_control.get_active()
elif index == 1: dims = (self.model.maxx - self.model.minx,
# y axis self.model.maxy - self.model.miny,
value = self.model.maxy - self.model.miny self.model.maxz - self.model.minz)
elif index == 2: value = dims[index]
# z axis non_zero_dimensions = [i for i, dim in enumerate(dims) if dim > 0]
value = self.model.maxz - self.model.minz enable_controls = index in non_zero_dimensions
else: scale_button.set_sensitive(enable_controls)
return scale_value.set_sensitive(enable_controls)
self.gui.get_object("ScaleDimensionValue").set_value(value) scale_value.set_value(value)
@gui_activity_guard @gui_activity_guard
def scale_model_axis_fit(self, widget): def scale_model_axis_fit(self, widget):
......
...@@ -817,7 +817,7 @@ ...@@ -817,7 +817,7 @@
<child type="label"> <child type="label">
<object class="GtkLabel" id="Shift Model Label"> <object class="GtkLabel" id="Shift Model Label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Move Origin&lt;/b&gt;</property> <property name="label" translatable="yes">&lt;b&gt;Move Model&lt;/b&gt;</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
</object> </object>
</child> </child>
...@@ -5258,7 +5258,6 @@ You should have received a copy of the GNU General Public License along with thi ...@@ -5258,7 +5258,6 @@ You should have received a copy of the GNU General Public License along with thi
<property name="always_show_image">True</property> <property name="always_show_image">True</property>
</object> </object>
<object class="GtkAdjustment" id="ScaleDimensionValue"> <object class="GtkAdjustment" id="ScaleDimensionValue">
<property name="lower">0.01</property>
<property name="upper">2000</property> <property name="upper">2000</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
</object> </object>
......
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