Commit 3549f150 authored by sumpfralle's avatar sumpfralle

keep the state of the "generate toolpath" buttons up-to-date


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1189 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent b23b6c91
...@@ -119,14 +119,17 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -119,14 +119,17 @@ class Tasks(pycam.Plugins.ListPluginBase):
self._gtk_handlers.append((self.gui.get_object("TaskTypeSelector"), self._gtk_handlers.append((self.gui.get_object("TaskTypeSelector"),
"changed", "task-type-changed")) "changed", "task-type-changed"))
self._event_handlers = ( self._event_handlers = (
("task-type-list-changed", self._update_widgets), ("task-type-list-changed", self._update_table),
("task-selection-changed", self._task_switch), ("task-selection-changed", self._task_switch),
("task-changed", self._store_task), ("task-changed", self._store_task),
("task-type-changed", self._store_task)) ("task-type-changed", self._store_task),
("task-selection-changed", self._update_widgets),
("task-list-changed", self._update_widgets))
self.register_model_update(update_model) self.register_model_update(update_model)
self.register_gtk_handlers(self._gtk_handlers) self.register_gtk_handlers(self._gtk_handlers)
self.register_event_handlers(self._event_handlers) self.register_event_handlers(self._event_handlers)
self._update_widgets() self._update_widgets()
self._update_table()
self._task_switch() self._task_switch()
self.core.set("tasks", self) self.core.set("tasks", self)
return True return True
...@@ -192,7 +195,7 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -192,7 +195,7 @@ class Tasks(pycam.Plugins.ListPluginBase):
else: else:
selector.set_active(-1) selector.set_active(-1)
def _update_widgets(self): def _update_table(self):
selected = self._get_type() selected = self._get_type()
model = self.gui.get_object("TaskTypeList") model = self.gui.get_object("TaskTypeList")
model.clear() model.clear()
...@@ -219,6 +222,12 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -219,6 +222,12 @@ class Tasks(pycam.Plugins.ListPluginBase):
if selected: if selected:
self.select_type(selected["name"]) self.select_type(selected["name"])
def _update_widgets(self):
self.gui.get_object("GenerateToolPathButton").set_sensitive(
len(self.get_selected()) > 0)
self.gui.get_object("GenerateAllToolPathsButton").set_sensitive(
len(self) > 0)
def _task_switch(self): def _task_switch(self):
tasks = self.get_selected() tasks = self.get_selected()
control_box = self.gui.get_object("TaskDetails") control_box = self.gui.get_object("TaskDetails")
......
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