Commit f8077ca1 authored by sumpfralle's avatar sumpfralle

some more cleanup of teardown functions


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1163 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 77ecc7ae
......@@ -111,6 +111,8 @@ class ModelSupport(pycam.Plugins.PluginBase):
self._support_model_changed)
self.core.unregister_event("bounds-changed",
self._support_model_changed)
self.core.unregister_event("model-selection-changed",
self._update_widgets)
self.core.unregister_event("support-model-changed",
self.update_support_model)
......
......@@ -168,8 +168,8 @@ class ToolpathCrop(pycam.Plugins.PluginBase):
self.core.get("toolpaths").append(new_tp)
else:
toolpath.paths = new_tp.paths
self.core.emit_event("toolpath-changed")
else:
self.log.info("Toolpath cropping: the result is empty")
self.core.emit_event("visual-item-updated")
self.core.get("toolpaths").select(selected)
......@@ -72,6 +72,14 @@ class ToolpathExport(pycam.Plugins.PluginBase):
def teardown(self):
if self.gui:
self.core.unregister_ui("toolpath_handling", self._frame)
self.core.unregister_event("postprocessors-list-changed",
self._update_postprocessors)
self.core.unregister_event("toolpath-list-changed",
self._update_widgets)
self.core.unregister_event("toolpath-selection-changed",
self._update_widgets)
self.core.unregister_event("toolpath-changed",
self._update_widgets)
def register_postprocessor(self, name, label, func):
if name in self._postprocessors:
......
......@@ -103,8 +103,10 @@ class ToolpathGrid(pycam.Plugins.PluginBase):
new_paths.append(new_path)
if not self.gui.get_object("KeepOriginal").get_active():
toolpath.paths = new_paths
self.core.emit_event("toolpath-changed")
else:
new_toolpath = toolpath.copy()
new_toolpath.paths = new_paths
self.core.get("toolpaths").append(new_toolpath)
self.core.emit_event("visual-item-updated")
self.core.get("toolpaths").select(toolpaths)
......@@ -67,9 +67,6 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
self._visualize_visible_state)
self.gui.get_object("ToolpathNameCell").connect("edited",
self._edit_toolpath_name)
self.gui.get_object("ToolpathTimeColumn").set_cell_data_func(
self.gui.get_object("ToolpathTimeCell"),
self._visualize_machine_time)
# handle selection changes
selection = self._modelview.get_selection()
selection.connect("changed",
......@@ -92,10 +89,15 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
"Toolpath #%d" % index, True))
self.core.emit_event("toolpath-list-changed")
self.register_model_update(update_model)
self.core.register_event("toolpath-changed",
self._update_widgets)
self.core.register_event("toolpath-list-changed",
self._update_widgets)
self.core.register_event("toolpath-changed",
lambda: self.core.emit_event("visual-item-updated"))
self.core.register_event("toolpath-list-changed",
lambda: self.core.emit_event("visual-item-updated"))
self._trigger_toolpath_time_update()
self._update_widgets()
self.core.set("toolpaths", self)
return True
......@@ -107,6 +109,8 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
self.gui.get_object("ExportGCodeAll"))
self.unregister_gtk_accelerator("toolpaths",
self.gui.get_object("ExportGCodeSelected"))
self.core.unregister_event("toolpath-changed",
self._update_widgets)
self.core.unregister_event("toolpath-list-changed",
self._update_widgets)
self.core.set("toolpaths", None)
......@@ -142,6 +146,11 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
self.gui.get_object("ExportGCodeSelected").set_sensitive(
len(selected_toolpaths) > 0)
def _trigger_toolpath_time_update(self):
self.gui.get_object("ToolpathTimeColumn").set_cell_data_func(
self.gui.get_object("ToolpathTimeCell"),
self._visualize_machine_time)
def _list_action_toggle_custom(self, treeview, path, clicked_column,
force_column=None):
if force_column is None:
......
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