Commit ce73e44b authored by Lars Kruse's avatar Lars Kruse

small fixes

* proper teardown
* selective show for input controls
* use ".get_widget()" instead of the internal ".widget" property
parent feb4a796
...@@ -189,7 +189,9 @@ class InputTable(InputChoice): ...@@ -189,7 +189,9 @@ class InputTable(InputChoice):
self._values.append(value) self._values.append(value)
renderer = gtk.CellRendererText() renderer = gtk.CellRendererText()
self.control = gtk.ScrolledWindow() self.control = gtk.ScrolledWindow()
self.control.show()
self._treeview = gtk.TreeView(self.model) self._treeview = gtk.TreeView(self.model)
self._treeview.show()
self.control.add(self._treeview) self.control.add(self._treeview)
self.control.set_shadow_type(gtk.SHADOW_ETCHED_OUT) self.control.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
self.control.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.control.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
...@@ -200,7 +202,6 @@ class InputTable(InputChoice): ...@@ -200,7 +202,6 @@ class InputTable(InputChoice):
self._treeview.set_headers_visible(False) self._treeview.set_headers_visible(False)
self._selection = self._treeview.get_selection() self._selection = self._treeview.get_selection()
self._selection.set_mode(gtk.SELECTION_MULTIPLE) self._selection.set_mode(gtk.SELECTION_MULTIPLE)
self.control.show_all()
self.connect("changed", change_handler, self._selection) self.connect("changed", change_handler, self._selection)
def get_value(self): def get_value(self):
...@@ -243,8 +244,9 @@ class ParameterSection(object): ...@@ -243,8 +244,9 @@ class ParameterSection(object):
self._table.set_row_spacings(3) self._table.set_row_spacings(3)
self.update_widgets() self.update_widgets()
self._update_widgets_visibility() self._update_widgets_visibility()
self._table.show()
self.widget = self._table def get_widget(self):
return self._table
def add_widget(self, widget, label, weight=100): def add_widget(self, widget, label, weight=100):
item = (widget, label, weight, []) item = (widget, label, weight, [])
......
...@@ -219,7 +219,11 @@ class PathParamPattern(pycam.Plugins.PluginBase): ...@@ -219,7 +219,11 @@ class PathParamPattern(pycam.Plugins.PluginBase):
def teardown(self): def teardown(self):
self.core.unregister_ui("process_path_parameters", self.control.get_widget()) self.core.unregister_ui("process_path_parameters", self.control.get_widget())
self.core.unregister_event("process-path-pattern-list-changed",
self._update_selector)
self.core.get("unregister_parameter")("process", "path_pattern") self.core.get("unregister_parameter")("process", "path_pattern")
self.core.get("unregister_parameter_group")("path_pattern")
def _update_selector(self): def _update_selector(self):
patterns = list(self.core.get("get_parameter_sets")( patterns = list(self.core.get("get_parameter_sets")(
......
...@@ -80,7 +80,7 @@ class Processes(pycam.Plugins.ListPluginBase): ...@@ -80,7 +80,7 @@ class Processes(pycam.Plugins.ListPluginBase):
self.parameter_widget.add_widget, self.parameter_widget.add_widget,
self.parameter_widget.clear_widgets) self.parameter_widget.clear_widgets)
self.core.register_ui("process_parameters", "Path parameters", self.core.register_ui("process_parameters", "Path parameters",
self.parameter_widget.widget, weight=10) self.parameter_widget.get_widget(), weight=10)
self._gtk_handlers.append((self._modelview.get_selection(), self._gtk_handlers.append((self._modelview.get_selection(),
"changed", "process-selection-changed")) "changed", "process-selection-changed"))
self._gtk_handlers.append((self.gui.get_object("NameCell"), self._gtk_handlers.append((self.gui.get_object("NameCell"),
...@@ -109,7 +109,7 @@ class Processes(pycam.Plugins.ListPluginBase): ...@@ -109,7 +109,7 @@ class Processes(pycam.Plugins.ListPluginBase):
self.core.unregister_ui("main", self.gui.get_object("ProcessBox")) self.core.unregister_ui("main", self.gui.get_object("ProcessBox"))
self.core.unregister_ui_section("process_path_parameters") self.core.unregister_ui_section("process_path_parameters")
self.core.unregister_ui("process_parameters", self.core.unregister_ui("process_parameters",
self.parameter_widget.widget) self.parameter_widget.get_widget())
self.core.unregister_ui_section("process_parameters") self.core.unregister_ui_section("process_parameters")
self.unregister_gtk_handlers(self._gtk_handlers) self.unregister_gtk_handlers(self._gtk_handlers)
self.unregister_event_handlers(self._event_handlers) self.unregister_event_handlers(self._event_handlers)
......
...@@ -83,13 +83,13 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -83,13 +83,13 @@ class Tasks(pycam.Plugins.ListPluginBase):
self.models_widget.add_widget, self.models_widget.add_widget,
self.models_widget.clear_widgets) self.models_widget.clear_widgets)
self.core.register_ui("task_parameters", "Collision models", self.core.register_ui("task_parameters", "Collision models",
self.models_widget.widget, weight=20) self.models_widget.get_widget(), weight=20)
self.components_widget = pycam.Gui.ControlsGTK.ParameterSection() self.components_widget = pycam.Gui.ControlsGTK.ParameterSection()
self.core.register_ui_section("task_components", self.core.register_ui_section("task_components",
self.components_widget.add_widget, self.components_widget.add_widget,
self.components_widget.clear_widgets) self.components_widget.clear_widgets)
self.core.register_ui("task_parameters", "Components", self.core.register_ui("task_parameters", "Components",
self.components_widget.widget, weight=10) self.components_widget.get_widget(), weight=10)
# table # table
self._gtk_handlers.append((self.gui.get_object("NameCell"), self._gtk_handlers.append((self.gui.get_object("NameCell"),
"edited", self._edit_task_name)) "edited", self._edit_task_name))
......
...@@ -77,13 +77,13 @@ class Tools(pycam.Plugins.ListPluginBase): ...@@ -77,13 +77,13 @@ class Tools(pycam.Plugins.ListPluginBase):
get_current_set_func=self._get_shape) get_current_set_func=self._get_shape)
self.size_widget = pycam.Gui.ControlsGTK.ParameterSection() self.size_widget = pycam.Gui.ControlsGTK.ParameterSection()
self.core.register_ui("tool_parameters", "Size", self.core.register_ui("tool_parameters", "Size",
self.size_widget.widget, weight=10) self.size_widget.get_widget(), weight=10)
self.core.register_ui_section("tool_size", self.core.register_ui_section("tool_size",
self.size_widget.add_widget, self.size_widget.add_widget,
self.size_widget.clear_widgets) self.size_widget.clear_widgets)
self.speed_widget = pycam.Gui.ControlsGTK.ParameterSection() self.speed_widget = pycam.Gui.ControlsGTK.ParameterSection()
self.core.register_ui("tool_parameters", "Speed", self.core.register_ui("tool_parameters", "Speed",
self.speed_widget.widget, weight=20) self.speed_widget.get_widget(), weight=20)
self.core.register_ui_section("tool_speed", self.core.register_ui_section("tool_speed",
self.speed_widget.add_widget, self.speed_widget.add_widget,
self.speed_widget.clear_widgets) self.speed_widget.clear_widgets)
...@@ -128,8 +128,10 @@ class Tools(pycam.Plugins.ListPluginBase): ...@@ -128,8 +128,10 @@ class Tools(pycam.Plugins.ListPluginBase):
self.core.unregister_ui("main", self.gui.get_object("ToolBox")) self.core.unregister_ui("main", self.gui.get_object("ToolBox"))
self.core.unregister_ui_section("tool_speed") self.core.unregister_ui_section("tool_speed")
self.core.unregister_ui_section("tool_size") self.core.unregister_ui_section("tool_size")
self.core.unregister_ui("tool_parameters", self.size_widget.widget) self.core.unregister_ui("tool_parameters",
self.core.unregister_ui("tool_parameters", self.speed_widget.widget) self.size_widget.get_widget())
self.core.unregister_ui("tool_parameters",
self.speed_widget.get_widget())
self.core.unregister_ui_section("tool_parameters") self.core.unregister_ui_section("tool_parameters")
self.unregister_gtk_handlers(self._gtk_handlers) self.unregister_gtk_handlers(self._gtk_handlers)
self.unregister_event_handlers(self._event_handlers) self.unregister_event_handlers(self._event_handlers)
......
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