Commit 301f4e4d authored by Lars Kruse's avatar Lars Kruse

hide the toolpath settings tab if no toolpath is selected; add a frame label

parent 1b4da9bf
......@@ -31,7 +31,7 @@ _log = pycam.Utils.log.get_logger()
class ToolpathProcessors(pycam.Plugins.ListPluginBase):
DEPENDS = ["ParameterGroupManager"]
DEPENDS = ["Toolpaths", "ParameterGroupManager"]
CATEGORIES = ["Toolpath"]
UI_FILE = "toolpath_processors.ui"
......@@ -109,9 +109,8 @@ class ToolpathProcessors(pycam.Plugins.ListPluginBase):
general_widget.add_widget, general_widget.clear_widgets)
self.core.register_ui("gcode_preferences", "General",
general_widget.get_widget())
complete_box = self.gui.get_object("PreferencesBox")
self.core.register_ui("toolpath_handling", "Settings",
complete_box)
self._frame = self.gui.get_object("SettingsFrame")
self.core.register_ui("toolpath_handling", "Settings", self._frame)
self.gui.get_object("PreferencesButton").connect("clicked",
self._toggle_window, True)
self.gui.get_object("CloseButton").connect("clicked",
......@@ -136,9 +135,11 @@ class ToolpathProcessors(pycam.Plugins.ListPluginBase):
get_current_set_func=self.get_selected)
self._event_handlers = (
("toolpath-processor-list-changed", self._update_processors),
("toolpath-selection-changed", self._update_visibility),
)
self.register_event_handlers(self._event_handlers)
self._update_processors()
self._update_visibility()
return True
def teardown(self):
......@@ -157,6 +158,12 @@ class ToolpathProcessors(pycam.Plugins.ListPluginBase):
item = item["name"]
self._proc_selector.set_value(item)
def _update_visibility(self):
if self.core.get("toolpaths").get_selected():
self._frame.show()
else:
self._frame.hide()
def _update_processors(self):
selected = self.get_selected()
processors = self.core.get("get_parameter_sets")("toolpath_processor").values()
......
......@@ -52,10 +52,16 @@
<action-widget response="0">CloseButton</action-widget>
</action-widgets>
</object>
<object class="GtkAlignment" id="PreferencesBox">
<object class="GtkFrame" id="SettingsFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="Align1">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="VBox">
<property name="visible">True</property>
......@@ -103,4 +109,13 @@
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
</interface>
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