Commit 2297fbc2 authored by sumpfralle's avatar sumpfralle

add some descriptive labels to the bounding box tab


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@461 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5db617d1
......@@ -520,7 +520,6 @@ class ProjectGui:
self.update_process_table()
self.update_bounds_table()
self.update_tasklist_table()
self.update_tasklist_controls()
self.update_save_actions()
self.update_unit_labels()
self.update_support_grid_controls()
......@@ -665,6 +664,8 @@ class ProjectGui:
bounds.adjust_bounds_to_absolute_limits(abs_bounds_low, abs_bounds_high,
reference=self.model.get_bounds())
self._put_bounds_settings_to_gui(bounds)
# update the descriptive label for each margin type
self.update_bounds_controls()
self.append_to_queue(self.update_boundary_limits)
@gui_activity_guard
......@@ -673,7 +674,7 @@ class ProjectGui:
self.update_support_grid_model()
self.update_view()
def update_tasklist_controls(self, widget=None, data=None):
def update_tasklist_controls(self):
# en/disable some buttons
index = self._treeview_get_active_index(self.tasklist_table, self.task_list)
selection_active = not index is None
......@@ -1580,6 +1581,26 @@ class ProjectGui:
self.update_bounds_table()
self.append_to_queue(self.update_boundary_limits)
def update_bounds_controls(self):
current_index = self._treeview_get_active_index(
self.bounds_editor_table, self.bounds_list)
if current_index is None:
# no bounds setting is active
return
# show the proper descriptive label for the current margin type
current_type = self._load_bounds_settings_from_gui().get_type()
type_labels = {
Bounds.TYPE_RELATIVE_MARGIN: "BoundsMarginTypeRelativeLabel",
Bounds.TYPE_FIXED_MARGIN: "BoundsMarginTypeFixedLabel",
Bounds.TYPE_CUSTOM: "BoundsMarginTypeCustomLabel",
}
for type_key, label_name in type_labels.items():
is_active = type_key == current_type
if is_active:
self.gui.get_object(label_name).show()
else:
self.gui.get_object(label_name).hide()
def update_bounds_table(self, new_index=None, skip_model_update=False):
# reset the model data and the selection
if new_index is None:
......@@ -1595,15 +1616,19 @@ class ProjectGui:
model.append(items)
if not new_index is None:
self._treeview_set_active_index(self.bounds_editor_table, new_index)
selection_active = not new_index is None
# enable/disable the modification buttons
self.gui.get_object("BoundsListMoveUp").set_sensitive((not new_index is None) and (new_index > 0))
self.gui.get_object("BoundsListDelete").set_sensitive(not new_index is None)
self.gui.get_object("BoundsListMoveDown").set_sensitive((not new_index is None) and (new_index + 1 < len(self.bounds_list)))
self.gui.get_object("BoundsListMoveUp").set_sensitive(selection_active \
and (new_index > 0))
self.gui.get_object("BoundsListDelete").set_sensitive(selection_active)
self.gui.get_object("BoundsListMoveDown").set_sensitive(
selection_active and (new_index + 1 < len(self.bounds_list)))
# hide all controls if no bound is defined
if new_index is None:
self.gui.get_object("BoundsSettingsControlsBox").hide()
else:
if selection_active:
self.gui.get_object("BoundsSettingsControlsBox").show()
else:
self.gui.get_object("BoundsSettingsControlsBox").hide()
self.update_bounds_controls()
# remove any broken tasks and update changed names
self.update_task_description()
......
......@@ -2490,6 +2490,10 @@ This operation is not available for engraving.</property>
<property name="visible">True</property>
<property name="top_padding">2</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox11">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkHBox" id="hbox23">
<property name="visible">True</property>
......@@ -2729,30 +2733,6 @@ This operation is not available for engraving.</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="min label">
<property name="visible">True</property>
<property name="label" translatable="yes">lower</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment34">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkButton" id="BoundsMarginIncreaseX">
<property name="label" translatable="yes">+</property>
......@@ -2942,6 +2922,30 @@ This operation is not available for engraving.</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="min label">
<property name="visible">True</property>
<property name="label" translatable="yes">lower</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment34">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......@@ -2949,6 +2953,60 @@ This operation is not available for engraving.</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox26">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="BoundsMarginTypeRelativeLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">2</property>
<property name="label" translatable="yes">&lt;i&gt;Relative margins are given in percent relative to the corresponding model size. Positive values create a margin around the model. Negative values create a bounding box that is smaller than the model.&lt;/i&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="BoundsMarginTypeFixedLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">2</property>
<property name="label" translatable="yes">&lt;i&gt;Fixed margins are given in mm/inches. Positive values create a margin around the model. Negative values create a bounding box that is smaller than the model.&lt;/i&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="BoundsMarginTypeCustomLabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">2</property>
<property name="label" translatable="yes">&lt;i&gt;These values are absolute coordinates of the processing bounding box. Changes of the model size have no effect upon the bounding box.&lt;/i&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
......
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