Commit 7ed99e24 authored by sumpfralle's avatar sumpfralle

finished cleanup of gtk widget signal handling


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1173 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 1193c3dd
...@@ -154,6 +154,8 @@ class Bounds(pycam.Plugins.ListPluginBase): ...@@ -154,6 +154,8 @@ class Bounds(pycam.Plugins.ListPluginBase):
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)
self.core.set("bounds", None) self.core.set("bounds", None)
while len(self) > 0:
self.pop()
def get_selected(self, index=False): def get_selected(self, index=False):
return self._get_selected(self._boundsview, index=index) return self._get_selected(self._boundsview, index=index)
...@@ -194,7 +196,11 @@ class Bounds(pycam.Plugins.ListPluginBase): ...@@ -194,7 +196,11 @@ class Bounds(pycam.Plugins.ListPluginBase):
model_ids = [id(m) for m in all_models] model_ids = [id(m) for m in all_models]
if model_id in model_ids: if model_id in model_ids:
this_model = all_models[model_ids.index(model_id)] this_model = all_models[model_ids.index(model_id)]
cell.set_property("text", all_models.get_attr(this_model, "name")) try:
label = all_models.get_attr(this_model, "name")
except IndexError:
label = ""
cell.set_property("text", label)
def _render_bounds_size(self, column, cell, model, m_iter): def _render_bounds_size(self, column, cell, model, m_iter):
path = model.get_path(m_iter) path = model.get_path(m_iter)
...@@ -225,6 +231,16 @@ class Bounds(pycam.Plugins.ListPluginBase): ...@@ -225,6 +231,16 @@ class Bounds(pycam.Plugins.ListPluginBase):
model_list.remove(index_iter) model_list.remove(index_iter)
if len(model_list) <= index: if len(model_list) <= index:
model_list.append((model_id,)) model_list.append((model_id,))
# remove missing models from all bounds
for bounds in self:
removal_list = []
for index, model in enumerate(bounds["Models"]):
if not model in self.core.get("models"):
removal_list.append(index)
removal_list.reverse()
for index in removal_list:
bounds["Models"].pop(index)
print "Removed model %d" % index
def _store_bounds_settings(self, widget=None): def _store_bounds_settings(self, widget=None):
data = self.get_selected() data = self.get_selected()
......
...@@ -113,6 +113,8 @@ class Models(pycam.Plugins.ListPluginBase): ...@@ -113,6 +113,8 @@ class Models(pycam.Plugins.ListPluginBase):
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)
self.core.set("models", None) self.core.set("models", None)
while len(self) > 0:
self.pop()
return True return True
def _get_colors_of_selected_models(self, widget=None): def _get_colors_of_selected_models(self, widget=None):
......
...@@ -43,10 +43,16 @@ class ParallelProcessing(pycam.Plugins.PluginBase): ...@@ -43,10 +43,16 @@ class ParallelProcessing(pycam.Plugins.PluginBase):
# "process pool" window # "process pool" window
self.process_pool_window = self.gui.get_object("ProcessPoolWindow") self.process_pool_window = self.gui.get_object("ProcessPoolWindow")
self.process_pool_window.set_default_size(500, 400) self.process_pool_window.set_default_size(500, 400)
self.process_pool_window.connect("delete-event", self.toggle_process_pool_window, False) self._gtk_handlers = []
self.process_pool_window.connect("destroy", self.toggle_process_pool_window, False) self._gtk_handlers.extend((
(self.process_pool_window, "delete-event",
self.toggle_process_pool_window, False),
(self.process_pool_window, "destroy",
self.toggle_process_pool_window, False)))
self.process_pool_window.add_accel_group(self.core.get("gtk-accel-group")) self.process_pool_window.add_accel_group(self.core.get("gtk-accel-group"))
self.gui.get_object("ProcessPoolWindowClose").connect("clicked", self.toggle_process_pool_window, False) self._gtk_handlers.append((
self.gui.get_object("ProcessPoolWindowClose"), "clicked",
self.toggle_process_pool_window, False))
self.gui.get_object("ProcessPoolRefreshInterval").set_value(3) self.gui.get_object("ProcessPoolRefreshInterval").set_value(3)
self.process_pool_model = self.gui.get_object("ProcessPoolStatisticsModel") self.process_pool_model = self.gui.get_object("ProcessPoolStatisticsModel")
# show/hide controls # show/hide controls
...@@ -63,22 +69,23 @@ class ParallelProcessing(pycam.Plugins.PluginBase): ...@@ -63,22 +69,23 @@ class ParallelProcessing(pycam.Plugins.PluginBase):
self.gui.get_object("EnableParallelProcesses").hide() self.gui.get_object("EnableParallelProcesses").hide()
self.enable_parallel_processes.set_active( self.enable_parallel_processes.set_active(
pycam.Utils.threading.is_multiprocessing_enabled()) pycam.Utils.threading.is_multiprocessing_enabled())
self.enable_parallel_processes.connect("toggled", self._gtk_handlers.append((self.enable_parallel_processes,
self.handle_parallel_processes_settings) "toggled", self.handle_parallel_processes_settings))
self.number_of_processes = self.gui.get_object( self.number_of_processes = self.gui.get_object(
"NumberOfProcesses") "NumberOfProcesses")
self.number_of_processes.set_value( self.number_of_processes.set_value(
pycam.Utils.threading.get_number_of_processes()) pycam.Utils.threading.get_number_of_processes())
server_port_local_obj = self.gui.get_object("ServerPortLocal") server_port_local_obj = self.gui.get_object("ServerPortLocal")
server_port_remote_obj = self.gui.get_object("RemoteServerPort") server_port_remote_obj = self.gui.get_object("RemoteServerPort")
self.number_of_processes.connect("value-changed", self._gtk_handlers.extend((
self.handle_parallel_processes_settings) (self.number_of_processes, "value-changed",
self.gui.get_object("EnableServerMode").connect("toggled", self.handle_parallel_processes_settings),
self.initialize_multiprocessing) (self.gui.get_object("EnableServerMode"), "toggled",
self.gui.get_object("ServerPasswordGenerate").connect("clicked", self.initialize_multiprocessing),
self.generate_random_server_password) (self.gui.get_object("ServerPasswordGenerate"), "clicked",
self.gui.get_object("ServerPasswordShow").connect("toggled", self.generate_random_server_password),
self.update_parallel_processes_settings) (self.gui.get_object("ServerPasswordShow"), "toggled",
self.update_parallel_processes_settings)))
auth_key_obj = self.gui.get_object("ServerPassword") auth_key_obj = self.gui.get_object("ServerPassword")
server_hostname = self.gui.get_object("RemoteServerHostname") server_hostname = self.gui.get_object("RemoteServerHostname")
cpu_cores = pycam.Utils.threading.get_number_of_cores() cpu_cores = pycam.Utils.threading.get_number_of_cores()
...@@ -86,11 +93,13 @@ class ParallelProcessing(pycam.Plugins.PluginBase): ...@@ -86,11 +93,13 @@ class ParallelProcessing(pycam.Plugins.PluginBase):
cpu_cores = "unknown" cpu_cores = "unknown"
self.gui.get_object("AvailableCores").set_label(str(cpu_cores)) self.gui.get_object("AvailableCores").set_label(str(cpu_cores))
toggle_button = self.gui.get_object("ToggleProcessPoolWindow") toggle_button = self.gui.get_object("ToggleProcessPoolWindow")
toggle_button.connect("toggled", self.toggle_process_pool_window) self._gtk_handlers.append((toggle_button, "toggled",
self.toggle_process_pool_window))
self.register_gtk_accelerator("processes", toggle_button, self.register_gtk_accelerator("processes", toggle_button,
None, "ToggleProcessPoolWindow") None, "ToggleProcessPoolWindow")
self.core.register_ui("view_menu", "ToggleProcessPoolWindow", self.core.register_ui("view_menu", "ToggleProcessPoolWindow",
toggle_button, 40) toggle_button, 40)
self.register_gtk_handlers(self._gtk_handlers)
return True return True
def teardown(self): def teardown(self):
...@@ -101,6 +110,7 @@ class ParallelProcessing(pycam.Plugins.PluginBase): ...@@ -101,6 +110,7 @@ class ParallelProcessing(pycam.Plugins.PluginBase):
toggle_button = self.gui.get_object("ToggleProcessPoolWindow") toggle_button = self.gui.get_object("ToggleProcessPoolWindow")
self.core.unregister_ui("view_menu", toggle_button) self.core.unregister_ui("view_menu", toggle_button)
self.unregister_gtk_accelerator("processes", toggle_button) self.unregister_gtk_accelerator("processes", toggle_button)
self.unregister_gtk_handlers(self._gtk_handlers)
def toggle_process_pool_window(self, widget=None, value=None, action=None): def toggle_process_pool_window(self, widget=None, value=None, action=None):
toggle_process_pool_checkbox = self.gui.get_object("ToggleProcessPoolWindow") toggle_process_pool_checkbox = self.gui.get_object("ToggleProcessPoolWindow")
......
...@@ -160,6 +160,7 @@ class PathParamTraceModel(pycam.Plugins.PluginBase): ...@@ -160,6 +160,7 @@ class PathParamTraceModel(pycam.Plugins.PluginBase):
models_dict[id(model)] = model models_dict[id(model)] = model
models = [] models = []
for model_ref in model_refs: for model_ref in model_refs:
if model_ref in models_dict:
models.append(models_dict[model_ref]) models.append(models_dict[model_ref])
return models return models
def set_converter(models): def set_converter(models):
......
...@@ -38,32 +38,38 @@ class PluginSelector(pycam.Plugins.PluginBase): ...@@ -38,32 +38,38 @@ class PluginSelector(pycam.Plugins.PluginBase):
if self.gui: if self.gui:
import gtk import gtk
self.plugin_window = self.gui.get_object("PluginManagerWindow") self.plugin_window = self.gui.get_object("PluginManagerWindow")
self.plugin_window.connect("delete-event", self._gtk_handlers = []
self.toggle_plugin_window, False) self._gtk_handlers.extend((
self.plugin_window.connect("destroy", (self.plugin_window, "delete-event",
self.toggle_plugin_window, False) self.toggle_plugin_window, False),
(self.plugin_window, "destroy",
self.toggle_plugin_window, False)))
self.plugin_window.add_accel_group( self.plugin_window.add_accel_group(
self.core.get("gtk-accel-group")) self.core.get("gtk-accel-group"))
self.gui.get_object("ClosePluginManager").connect("clicked", self._gtk_handlers.append((
self.toggle_plugin_window, False) self.gui.get_object("ClosePluginManager"), "clicked",
self.toggle_plugin_window, False))
self._treemodel = self.gui.get_object("PluginsModel") self._treemodel = self.gui.get_object("PluginsModel")
self._treemodel.clear() self._treemodel.clear()
action = self.gui.get_object("TogglePluginWindow") action = self.gui.get_object("TogglePluginWindow")
action.connect("toggled", self.toggle_plugin_window) self._gtk_handlers.append((action, "toggled",
self.toggle_plugin_window))
self.register_gtk_accelerator("plugins", action, None, self.register_gtk_accelerator("plugins", action, None,
"TogglePluginWindow") "TogglePluginWindow")
self.core.register_ui("view_menu", "TogglePluginWindow", action, 60) self.core.register_ui("view_menu", "TogglePluginWindow", action, 60)
# model filters # model filters
model_filter = self.gui.get_object("PluginsModel").filter_new() model_filter = self.gui.get_object("PluginsModel").filter_new()
for obj_name in ("StatusFilter", "CategoryFilter"): for obj_name in ("StatusFilter", "CategoryFilter"):
self.gui.get_object(obj_name).connect("changed", self._gtk_handlers.append((self.gui.get_object(obj_name),
lambda widget: model_filter.refilter()) "changed", lambda widget: model_filter.refilter()))
self.gui.get_object("PluginsTable").set_model(model_filter) self.gui.get_object("PluginsTable").set_model(model_filter)
model_filter.set_visible_func(self._filter_set_visible) model_filter.set_visible_func(self._filter_set_visible)
self.gui.get_object("PluginsEnabledCell").connect("toggled", self._gtk_handlers.append((
self.toggle_plugin_state) self.gui.get_object("PluginsEnabledCell"), "toggled",
self.toggle_plugin_state))
self.core.register_event("plugin-list-changed", self.core.register_event("plugin-list-changed",
self._update_plugin_model) self._update_plugin_model)
self.register_gtk_handlers(self._gtk_handlers)
self._update_plugin_model() self._update_plugin_model()
return True return True
...@@ -74,6 +80,7 @@ class PluginSelector(pycam.Plugins.PluginBase): ...@@ -74,6 +80,7 @@ class PluginSelector(pycam.Plugins.PluginBase):
self.core.register_ui("view_menu", action) self.core.register_ui("view_menu", action)
self.core.unregister_event("plugin-list-changed", self.core.unregister_event("plugin-list-changed",
self._update_plugin_model) self._update_plugin_model)
self.unregister_gtk_handlers(self._gtk_handlers)
def toggle_plugin_window(self, widget=None, value=None, action=None): def toggle_plugin_window(self, widget=None, value=None, action=None):
toggle_plugin_button = self.gui.get_object("TogglePluginWindow") toggle_plugin_button = self.gui.get_object("TogglePluginWindow")
......
...@@ -37,6 +37,7 @@ class Processes(pycam.Plugins.ListPluginBase): ...@@ -37,6 +37,7 @@ class Processes(pycam.Plugins.ListPluginBase):
self._gtk = gtk self._gtk = gtk
process_frame = self.gui.get_object("ProcessBox") process_frame = self.gui.get_object("ProcessBox")
process_frame.unparent() process_frame.unparent()
self._gtk_handlers = []
self.core.register_ui("main", "Processs", process_frame, weight=20) self.core.register_ui("main", "Processs", process_frame, weight=20)
self._modelview = self.gui.get_object("ProcessEditorTable") self._modelview = self.gui.get_object("ProcessEditorTable")
for action, obj_name in ((self.ACTION_UP, "ProcessMoveUp"), for action, obj_name in ((self.ACTION_UP, "ProcessMoveUp"),
...@@ -44,8 +45,8 @@ class Processes(pycam.Plugins.ListPluginBase): ...@@ -44,8 +45,8 @@ class Processes(pycam.Plugins.ListPluginBase):
(self.ACTION_DELETE, "ProcessDelete")): (self.ACTION_DELETE, "ProcessDelete")):
self.register_list_action_button(action, self._modelview, self.register_list_action_button(action, self._modelview,
self.gui.get_object(obj_name)) self.gui.get_object(obj_name))
self.gui.get_object("ProcessNew").connect("clicked", self._gtk_handlers.append((self.gui.get_object("ProcessNew"),
self._process_new) "clicked", self._process_new))
# parameters # parameters
parameters_box = self.gui.get_object("ProcessParametersBox") parameters_box = self.gui.get_object("ProcessParametersBox")
def clear_parameter_widgets(): def clear_parameter_widgets():
...@@ -77,8 +78,8 @@ class Processes(pycam.Plugins.ListPluginBase): ...@@ -77,8 +78,8 @@ class Processes(pycam.Plugins.ListPluginBase):
selection.connect("changed", selection.connect("changed",
lambda widget, event: self.core.emit_event(event), lambda widget, event: self.core.emit_event(event),
"process-selection-changed") "process-selection-changed")
self.gui.get_object("NameCell").connect("edited", self._gtk_handlers.append((self.gui.get_object("NameCell"),
self._edit_process_name) "edited", self._edit_process_name))
self._treemodel = self.gui.get_object("ProcessList") self._treemodel = self.gui.get_object("ProcessList")
self._treemodel.clear() self._treemodel.clear()
def update_model(): def update_model():
...@@ -93,29 +94,27 @@ class Processes(pycam.Plugins.ListPluginBase): ...@@ -93,29 +94,27 @@ class Processes(pycam.Plugins.ListPluginBase):
cache[id(item)] = [id(item), "Process #%d" % index] cache[id(item)] = [id(item), "Process #%d" % index]
self._treemodel.append(cache[id(item)]) self._treemodel.append(cache[id(item)])
self.core.emit_event("process-list-changed") self.core.emit_event("process-list-changed")
strategy_selector = self.gui.get_object("StrategySelector") self._gtk_handlers.append((self.gui.get_object("StrategySelector"),
strategy_selector.connect("changed", lambda widget: \ "changed", "process-strategy-changed"))
self.core.emit_event("process-strategy-changed"))
self.core.register_event("process-strategy-list-changed",
self._update_widgets)
self.register_model_update(update_model) self.register_model_update(update_model)
self.core.register_event("process-selection-changed", self._event_handlers = (
self._process_switch) ("process-strategy-list-changed", self._update_widgets),
self.core.register_event("process-changed", ("process-selection-changed", self._process_switch),
self._store_process_settings) ("process-changed", self._store_process_settings),
self.core.register_event("process-strategy-changed", ("process-strategy-changed", self._store_process_settings))
self._store_process_settings) self.register_gtk_handlers(self._gtk_handlers)
self.register_event_handlers(self._event_handlers)
self.core.set("processes", self) self.core.set("processes", self)
return True return True
def teardown(self): def teardown(self):
if self.gui: if self.gui:
self.core.unregister_ui("main", self.gui.get_object("ProcessBox")) self.core.unregister_ui("main", self.gui.get_object("ProcessBox"))
self.core.unregister_event("process-selection-changed", self.unregister_gtk_handlers(self._gtk_handlers)
self._process_switch) self.unregister_event_handlers(self._event_handlers)
self.core.unregister_event("process-changed",
self._store_process_settings)
self.core.set("processes", None) self.core.set("processes", None)
while len(self) > 0:
self.pop()
return True return True
def get_selected(self, index=False): def get_selected(self, index=False):
......
...@@ -87,6 +87,7 @@ class TaskParamTool(pycam.Plugins.PluginBase): ...@@ -87,6 +87,7 @@ class TaskParamTool(pycam.Plugins.PluginBase):
def teardown(self): def teardown(self):
self.core.get("unregister_parameter")("task", "components", "tool") self.core.get("unregister_parameter")("task", "components", "tool")
self.core.unregister_event("tool-list-changed", self._update_tools)
def _update_tools(self): def _update_tools(self):
choices = [] choices = []
...@@ -115,6 +116,7 @@ class TaskParamProcess(pycam.Plugins.PluginBase): ...@@ -115,6 +116,7 @@ class TaskParamProcess(pycam.Plugins.PluginBase):
def teardown(self): def teardown(self):
self.core.get("unregister_parameter")("task", "components", "process") self.core.get("unregister_parameter")("task", "components", "process")
self.core.unregister_event("process-list-changed", self._update_processes)
def _update_processes(self): def _update_processes(self):
choices = [] choices = []
...@@ -143,6 +145,7 @@ class TaskParamBounds(pycam.Plugins.PluginBase): ...@@ -143,6 +145,7 @@ class TaskParamBounds(pycam.Plugins.PluginBase):
def teardown(self): def teardown(self):
self.core.get("unregister_parameter")("task", "components", "bounds") self.core.get("unregister_parameter")("task", "components", "bounds")
self.core.unregister_event("bounds-list-changed", self._update_bounds)
def _update_bounds(self): def _update_bounds(self):
choices = [] choices = []
......
...@@ -39,6 +39,7 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -39,6 +39,7 @@ class Tasks(pycam.Plugins.ListPluginBase):
if self.gui: if self.gui:
import gtk import gtk
self._gtk = gtk self._gtk = gtk
self._gtk_handlers = []
task_frame = self.gui.get_object("TaskBox") task_frame = self.gui.get_object("TaskBox")
task_frame.unparent() task_frame.unparent()
self.core.register_ui("main", "Tasks", task_frame, weight=40) self.core.register_ui("main", "Tasks", task_frame, weight=40)
...@@ -48,8 +49,8 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -48,8 +49,8 @@ class Tasks(pycam.Plugins.ListPluginBase):
(self.ACTION_DELETE, "TaskDelete")): (self.ACTION_DELETE, "TaskDelete")):
self.register_list_action_button(action, self._taskview, self.register_list_action_button(action, self._taskview,
self.gui.get_object(obj_name)) self.gui.get_object(obj_name))
self.gui.get_object("TaskNew").connect("clicked", self._gtk_handlers.append((self.gui.get_object("TaskNew"),
self._task_new) "clicked", self._task_new))
# parameters # parameters
parameters_box = self.gui.get_object("TaskParameterBox") parameters_box = self.gui.get_object("TaskParameterBox")
def clear_parameter_widgets(): def clear_parameter_widgets():
...@@ -82,20 +83,20 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -82,20 +83,20 @@ class Tasks(pycam.Plugins.ListPluginBase):
self.core.register_ui("task_parameters", "Components", self.core.register_ui("task_parameters", "Components",
self.components_parameter_widget, weight=10) self.components_parameter_widget, weight=10)
# table # table
self.gui.get_object("TaskNameCell").connect("edited", self._gtk_handlers.append((self.gui.get_object("TaskNameCell"),
self._edit_task_name) "edited", self._edit_task_name))
selection = self._taskview.get_selection() selection = self._taskview.get_selection()
selection.connect("changed", self._gtk_handlers.append((selection, "changed",
lambda widget, event: self.core.emit_event(event), "task-selection-changed"))
"task-selection-changed")
selection.set_mode(self._gtk.SELECTION_MULTIPLE) selection.set_mode(self._gtk.SELECTION_MULTIPLE)
self._treemodel = self.gui.get_object("TaskList") self._treemodel = self.gui.get_object("TaskList")
self._treemodel.clear() self._treemodel.clear()
# generate toolpaths # generate toolpaths
self.gui.get_object("GenerateToolPathButton").connect("clicked", self._gtk_handlers.extend((
self._generate_selected_toolpaths) (self.gui.get_object("GenerateToolPathButton"), "clicked",
self.gui.get_object("GenerateAllToolPathsButton").connect("clicked", self._generate_selected_toolpaths),
self._generate_all_toolpaths) (self.gui.get_object("GenerateAllToolPathsButton"), "clicked",
self._generate_all_toolpaths)))
# manage the treemodel # manage the treemodel
def update_model(): def update_model():
if not hasattr(self, "_model_cache"): if not hasattr(self, "_model_cache"):
...@@ -111,16 +112,16 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -111,16 +112,16 @@ class Tasks(pycam.Plugins.ListPluginBase):
self._treemodel.append((id(item), "Task #%d" % index)) self._treemodel.append((id(item), "Task #%d" % index))
self.core.emit_event("task-list-changed") self.core.emit_event("task-list-changed")
# shape selector # shape selector
type_selector = self.gui.get_object("TaskTypeSelector") self._gtk_handlers.append((self.gui.get_object("TaskTypeSelector"),
type_selector.connect("changed", lambda widget: \ "changed", "task-type-changed"))
self.core.emit_event("task-type-changed")) self._event_handlers = (
self.core.register_event("task-type-list-changed", ("task-type-list-changed", self._update_widgets),
self._update_widgets) ("task-selection-changed", self._task_switch),
self.core.register_event("task-selection-changed", ("task-changed", self._store_task),
self._task_switch) ("task-type-changed", self._store_task))
self.core.register_event("task-changed", self._store_task)
self.core.register_event("task-type-changed", self._store_task)
self.register_model_update(update_model) self.register_model_update(update_model)
self.register_gtk_handlers(self._gtk_handlers)
self.register_event_handlers(self._event_handlers)
self._update_widgets() self._update_widgets()
self._task_switch() self._task_switch()
self.core.set("tasks", self) self.core.set("tasks", self)
...@@ -129,16 +130,14 @@ class Tasks(pycam.Plugins.ListPluginBase): ...@@ -129,16 +130,14 @@ class Tasks(pycam.Plugins.ListPluginBase):
def teardown(self): def teardown(self):
if self.gui: if self.gui:
self.core.unregister_ui("main", self.gui.get_object("TaskBox")) self.core.unregister_ui("main", self.gui.get_object("TaskBox"))
self.core.unregister_event("task-type-list-changed",
self._update_widgets)
self.core.unregister_event("task-selection-changed",
self._task_switch)
self.core.unregister_event("task-changed", self._store_task)
self.core.unregister_event("task-type-changed", self._store_task)
self.core.unregister_ui("task_parameters", self.core.unregister_ui("task_parameters",
self.models_parameter_widget) self.models_parameter_widget)
self.core.unregister_ui("task_parameters", self.core.unregister_ui("task_parameters",
self.components_parameter_widget) self.components_parameter_widget)
self.unregister_gtk_handlers(self._gtk_handlers)
self.unregister_event_handlers(self._event_handlers)
while len(self) > 0:
self.pop()
def get_selected(self, index=False): def get_selected(self, index=False):
return self._get_selected(self._taskview, index=index) return self._get_selected(self._taskview, index=index)
......
...@@ -38,12 +38,14 @@ class ToolpathCrop(pycam.Plugins.PluginBase): ...@@ -38,12 +38,14 @@ class ToolpathCrop(pycam.Plugins.PluginBase):
self._frame = self.gui.get_object("ToolpathCropFrame") self._frame = self.gui.get_object("ToolpathCropFrame")
self.core.register_ui("toolpath_handling", "Crop", self.core.register_ui("toolpath_handling", "Crop",
self._frame, 40) self._frame, 40)
self._gtk_handlers = []
for objname in ("ToolpathCropZSlice", "ToolpathCropMargin"): for objname in ("ToolpathCropZSlice", "ToolpathCropMargin"):
obj = self.gui.get_object(objname) obj = self.gui.get_object(objname)
obj.set_value(0) obj.set_value(0)
obj.connect("value-changed", self._update_widgets) self._gtk_handlers.append((obj, "value-changed",
self.gui.get_object("CropButton").connect("clicked", self._update_widgets))
self.crop_toolpath) self._gtk_handlers.append((self.gui.get_object("CropButton"),
"clicked", self.crop_toolpath))
# model selector # model selector
self.models_widget = pycam.Gui.ControlsGTK.InputTable([], self.models_widget = pycam.Gui.ControlsGTK.InputTable([],
force_type=long, change_handler=self._update_widgets) force_type=long, change_handler=self._update_widgets)
...@@ -62,10 +64,11 @@ class ToolpathCrop(pycam.Plugins.PluginBase): ...@@ -62,10 +64,11 @@ class ToolpathCrop(pycam.Plugins.PluginBase):
get_conv=get_converter) get_conv=get_converter)
self.gui.get_object("ModelTableContainer").add( self.gui.get_object("ModelTableContainer").add(
self.models_widget.get_widget()) self.models_widget.get_widget())
self.core.register_event("model-list-changed", self._event_handlers = (
self._update_models_list) ("model-list-changed", self._update_models_list),
self.core.register_event("toolpath-selection-changed", ("toolpath-selection-changed", self._update_visibility))
self._update_visibility) self.register_gtk_handlers(self._gtk_handlers)
self.register_event_handlers(self._event_handlers)
self._update_widgets() self._update_widgets()
self._update_visibility() self._update_visibility()
return True return True
...@@ -75,10 +78,8 @@ class ToolpathCrop(pycam.Plugins.PluginBase): ...@@ -75,10 +78,8 @@ class ToolpathCrop(pycam.Plugins.PluginBase):
self.gui.get_object("ModelTableContainer").remove( self.gui.get_object("ModelTableContainer").remove(
self.models_widget.get_widget()) self.models_widget.get_widget())
self.core.unregister_ui("toolpath_handling", self._frame) self.core.unregister_ui("toolpath_handling", self._frame)
self.core.unregister_event("model-list-changed", self.unregister_gtk_handlers(self._gtk_handlers)
self._update_models_list) self.unregister_event_handlers(self._event_handlers)
self.core.unregister_event("toolpath-selection-changed",
self._update_visibility)
def _update_models_list(self): def _update_models_list(self):
choices = [] choices = []
......
...@@ -51,20 +51,20 @@ class ToolpathExport(pycam.Plugins.PluginBase): ...@@ -51,20 +51,20 @@ class ToolpathExport(pycam.Plugins.PluginBase):
self._postproc_model = self.gui.get_object("PostprocessorList") self._postproc_model = self.gui.get_object("PostprocessorList")
self._postproc_selector = self.gui.get_object( self._postproc_selector = self.gui.get_object(
"PostprocessorSelector") "PostprocessorSelector")
self.gui.get_object("ExportGCodeAll").connect("clicked", self._gtk_handlers = (
self.export_all) (self.gui.get_object("ExportGCodeAll"), "clicked",
self.gui.get_object("ExportGCodeSelected").connect("clicked", self.export_all),
self.export_selected) (self.gui.get_object("ExportGCodeSelected"), "clicked",
self.gui.get_object("ExportGCodeVisible").connect("clicked", self.export_selected),
self.export_visible) (self.gui.get_object("ExportGCodeVisible"), "clicked",
self.core.register_event("postprocessors-list-changed", self.export_visible))
self._update_postprocessors) self._event_handlers = (
self.core.register_event("toolpath-list-changed", ("postprocessors-list-changed", self._update_postprocessors),
self._update_widgets) ("toolpath-list-changed", self._update_widgets),
self.core.register_event("toolpath-selection-changed", ("toolpath-selection-changed", self._update_widgets),
self._update_widgets) ("toolpath-changed", self._update_widgets))
self.core.register_event("toolpath-changed", self.register_gtk_handlers(self._gtk_handlers)
self._update_widgets) self.register_event_handlers(self._event_handlers)
self._update_postprocessors() self._update_postprocessors()
self._update_widgets() self._update_widgets()
return True return True
...@@ -72,14 +72,8 @@ class ToolpathExport(pycam.Plugins.PluginBase): ...@@ -72,14 +72,8 @@ class ToolpathExport(pycam.Plugins.PluginBase):
def teardown(self): def teardown(self):
if self.gui: if self.gui:
self.core.unregister_ui("toolpath_handling", self._frame) self.core.unregister_ui("toolpath_handling", self._frame)
self.core.unregister_event("postprocessors-list-changed", self.unregister_gtk_handlers(self._gtk_handlers)
self._update_postprocessors) self.unregister_event_handlers(self._event_handlers)
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): def register_postprocessor(self, name, label, func):
if name in self._postprocessors: if name in self._postprocessors:
......
...@@ -33,6 +33,7 @@ class ToolpathGrid(pycam.Plugins.PluginBase): ...@@ -33,6 +33,7 @@ class ToolpathGrid(pycam.Plugins.PluginBase):
def setup(self): def setup(self):
if self.gui: if self.gui:
self._gtk_handlers = []
self._frame = self.gui.get_object("ToolpathGridFrame") self._frame = self.gui.get_object("ToolpathGridFrame")
self.core.register_ui("toolpath_handling", "Clone grid", self.core.register_ui("toolpath_handling", "Clone grid",
self._frame, 30) self._frame, 30)
...@@ -40,21 +41,22 @@ class ToolpathGrid(pycam.Plugins.PluginBase): ...@@ -40,21 +41,22 @@ class ToolpathGrid(pycam.Plugins.PluginBase):
self.gui.get_object(objname).set_value(1) self.gui.get_object(objname).set_value(1)
for objname in ("GridYCount", "GridXCount", "GridYDistance", for objname in ("GridYCount", "GridXCount", "GridYDistance",
"GridXDistance"): "GridXDistance"):
self.gui.get_object(objname).connect("value-changed", self._gtk_handlers.append((self.gui.get_object(objname),
self._update_widgets) "value-changed", self._update_widgets))
self.gui.get_object("GridCreate").connect("clicked", self._gtk_handlers.append((self.gui.get_object("GridCreate"),
self.create_toolpath_grid) "clicked", self.create_toolpath_grid))
self.core.register_event("toolpath-selection-changed", self.core.register_event("toolpath-selection-changed",
self._update_widgets) self._update_widgets)
self.register_gtk_handlers(self._gtk_handlers)
self._update_widgets() self._update_widgets()
return True return True
def teardown(self): def teardown(self):
if self.gui: if self.gui:
self.core.unregister_ui("toolpath_handling", self._frame) self.core.unregister_ui("toolpath_handling", self._frame)
self.unregister_gtk_handlers(self._gtk_handlers)
self.core.unregister_event("toolpath-selection-changed", self.core.unregister_event("toolpath-selection-changed",
self._update_widgets) self._update_widgets)
pass
def _get_toolpaths_dim(self, toolpaths): def _get_toolpaths_dim(self, toolpaths):
if toolpaths: if toolpaths:
......
...@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License ...@@ -20,6 +20,7 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
import math
import pycam.Plugins import pycam.Plugins
# this requires ODE - we import it later, if necessary # this requires ODE - we import it later, if necessary
...@@ -33,6 +34,7 @@ class ToolpathSimulation(pycam.Plugins.PluginBase): ...@@ -33,6 +34,7 @@ class ToolpathSimulation(pycam.Plugins.PluginBase):
def setup(self): def setup(self):
if self.gui: if self.gui:
self._gtk_handlers = []
speed_factor_widget = self.gui.get_object("SimulationSpeedFactor") speed_factor_widget = self.gui.get_object("SimulationSpeedFactor")
self.core.add_item("simulation_speed_factor", self.core.add_item("simulation_speed_factor",
lambda: pow(10, speed_factor_widget.get_value()), lambda: pow(10, speed_factor_widget.get_value()),
...@@ -48,21 +50,27 @@ class ToolpathSimulation(pycam.Plugins.PluginBase): ...@@ -48,21 +50,27 @@ class ToolpathSimulation(pycam.Plugins.PluginBase):
complete = self.core.get("simulation_complete_distance") complete = self.core.get("simulation_complete_distance")
partial = widget.get_value() / 100.0 * complete partial = widget.get_value() / 100.0 * complete
self.core.set("simulation_current_distance", partial) self.core.set("simulation_current_distance", partial)
simulation_progress.connect("value-changed", update_simulation_progress) self._gtk_handlers.append((simulation_progress, "value-changed",
update_simulation_progress))
# update the speed factor label # update the speed factor label
speed_factor_widget.connect("value-changed", lambda widget: \ self._gtk_handlers.append((speed_factor_widget, "value-changed",
self.gui.get_object("SimulationSpeedFactorValueLabel").\ lambda widget: self.gui.get_object(
set_label("%.2f" % self.core.get("simulation_speed_factor"))) "SimulationSpeedFactorValueLabel").set_label("%.2f" % \
self.core.get("simulation_speed_factor"))))
self.simulation_window = self.gui.get_object("SimulationDialog") self.simulation_window = self.gui.get_object("SimulationDialog")
self.simulation_window.connect("delete-event", self._gtk_handlers.append((self.simulation_window, "delete-event",
self.finish_toolpath_simulation) self.finish_toolpath_simulation))
sim_detail_obj = self.gui.get_object("SimulationDetailsValue") sim_detail_obj = self.gui.get_object("SimulationDetailsValue")
self.core.add_item("simulation_details_level", self.core.add_item("simulation_details_level",
sim_detail_obj.get_value, sim_detail_obj.set_value) sim_detail_obj.get_value, sim_detail_obj.set_value)
self.register_gtk_handlers(self._gtk_handlers)
return True return True
def teardown(self): def teardown(self):
pass if self.gui:
for name in ("simulation_speed_factor", "simulation_details_level"):
self.core.add_item(name, None, lambda value: None)
self.unregister_gtk_handlers(self._gtk_handlers)
def finish_toolpath_simulation(self, widget=None, data=None): def finish_toolpath_simulation(self, widget=None, data=None):
# hide the simulation tab # hide the simulation tab
......
...@@ -38,6 +38,7 @@ class Toolpaths(pycam.Plugins.ListPluginBase): ...@@ -38,6 +38,7 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
self.tp_box = self.gui.get_object("ToolpathsBox") self.tp_box = self.gui.get_object("ToolpathsBox")
self.tp_box.unparent() self.tp_box.unparent()
self.core.register_ui("main", "Toolpaths", self.tp_box, weight=50) self.core.register_ui("main", "Toolpaths", self.tp_box, weight=50)
self._gtk_handlers = []
self._modelview = self.gui.get_object("ToolpathTable") self._modelview = self.gui.get_object("ToolpathTable")
self._treemodel = self.gui.get_object("ToolpathListModel") self._treemodel = self.gui.get_object("ToolpathListModel")
self._treemodel.clear() self._treemodel.clear()
...@@ -58,20 +59,19 @@ class Toolpaths(pycam.Plugins.ListPluginBase): ...@@ -58,20 +59,19 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
self.core.register_ui_section("toolpath_handling", self.core.register_ui_section("toolpath_handling",
add_toolpath_handling_item, clear_toolpath_handling_obj) add_toolpath_handling_item, clear_toolpath_handling_obj)
# handle table changes # handle table changes
self._modelview.connect("row-activated", self._gtk_handlers.extend((
self._list_action_toggle_custom, self.COLUMN_VISIBLE) (self._modelview, "row-activated",
self._modelview.connect("row-activated", self._list_action_toggle_custom, self.COLUMN_VISIBLE),
lambda *args: self.core.emit_event("toolpath-changed")) (self._modelview, "row-activated", "toolpath-changed"),
(self.gui.get_object("ToolpathNameCell"), "edited",
self._edit_toolpath_name)))
self.gui.get_object("ToolpathVisibleColumn").set_cell_data_func( self.gui.get_object("ToolpathVisibleColumn").set_cell_data_func(
self.gui.get_object("ToolpathVisibleSymbol"), self.gui.get_object("ToolpathVisibleSymbol"),
self._visualize_visible_state) self._visualize_visible_state)
self.gui.get_object("ToolpathNameCell").connect("edited",
self._edit_toolpath_name)
# handle selection changes # handle selection changes
selection = self._modelview.get_selection() selection = self._modelview.get_selection()
selection.connect("changed", self._gtk_handlers.append((selection, "changed",
lambda widget, event: self.core.emit_event(event), "toolpath-selection-changed"))
"toolpath-selection-changed")
selection.set_mode(gtk.SELECTION_MULTIPLE) selection.set_mode(gtk.SELECTION_MULTIPLE)
# model handling # model handling
def update_model(): def update_model():
...@@ -89,14 +89,13 @@ class Toolpaths(pycam.Plugins.ListPluginBase): ...@@ -89,14 +89,13 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
"Toolpath #%d" % index, True)) "Toolpath #%d" % index, True))
self.core.emit_event("toolpath-list-changed") self.core.emit_event("toolpath-list-changed")
self.register_model_update(update_model) self.register_model_update(update_model)
self.core.register_event("toolpath-changed", self._event_handlers = (
self._update_widgets) ("toolpath-changed", self._update_widgets),
self.core.register_event("toolpath-list-changed", ("toolpath-list-changed", self._update_widgets),
self._update_widgets) ("toolpath-changed", "visual-item-updated"),
self.core.register_event("toolpath-changed", ("toolpath-list-changed", "visual-item-updated"))
lambda: self.core.emit_event("visual-item-updated")) self.register_gtk_handlers(self._gtk_handlers)
self.core.register_event("toolpath-list-changed", self.register_event_handlers(self._event_handlers)
lambda: self.core.emit_event("visual-item-updated"))
self._trigger_toolpath_time_update() self._trigger_toolpath_time_update()
self._update_widgets() self._update_widgets()
self.core.set("toolpaths", self) self.core.set("toolpaths", self)
...@@ -105,10 +104,8 @@ class Toolpaths(pycam.Plugins.ListPluginBase): ...@@ -105,10 +104,8 @@ class Toolpaths(pycam.Plugins.ListPluginBase):
def teardown(self): def teardown(self):
if self.gui: if self.gui:
self.core.unregister_ui("main", self.gui.get_object("ToolpathsBox")) self.core.unregister_ui("main", self.gui.get_object("ToolpathsBox"))
self.core.unregister_event("toolpath-changed", self.unregister_gtk_handlers(self._gtk_handlers)
self._update_widgets) self.unregister_event_handlers(self._event_handlers)
self.core.unregister_event("toolpath-list-changed",
self._update_widgets)
self.core.set("toolpaths", None) self.core.set("toolpaths", None)
def get_selected(self): def get_selected(self):
......
...@@ -40,6 +40,7 @@ class Tools(pycam.Plugins.ListPluginBase): ...@@ -40,6 +40,7 @@ class Tools(pycam.Plugins.ListPluginBase):
tool_frame = self.gui.get_object("ToolBox") tool_frame = self.gui.get_object("ToolBox")
tool_frame.unparent() tool_frame.unparent()
self.core.register_ui("main", "Tools", tool_frame, weight=10) self.core.register_ui("main", "Tools", tool_frame, weight=10)
self._gtk_handlers = []
self.core.register_chain("get_toolpath_information", self.core.register_chain("get_toolpath_information",
self.get_toolpath_information) self.get_toolpath_information)
self._modelview = self.gui.get_object("ToolEditorTable") self._modelview = self.gui.get_object("ToolEditorTable")
...@@ -48,7 +49,8 @@ class Tools(pycam.Plugins.ListPluginBase): ...@@ -48,7 +49,8 @@ class Tools(pycam.Plugins.ListPluginBase):
(self.ACTION_DELETE, "ToolDelete")): (self.ACTION_DELETE, "ToolDelete")):
self.register_list_action_button(action, self._modelview, self.register_list_action_button(action, self._modelview,
self.gui.get_object(obj_name)) self.gui.get_object(obj_name))
self.gui.get_object("ToolNew").connect("clicked", self._tool_new) self._gtk_handlers.append((self.gui.get_object("ToolNew"),
"clicked", self._tool_new))
# parameters # parameters
parameters_box = self.gui.get_object("ToolParameterBox") parameters_box = self.gui.get_object("ToolParameterBox")
def clear_parameter_widgets(): def clear_parameter_widgets():
...@@ -84,10 +86,10 @@ class Tools(pycam.Plugins.ListPluginBase): ...@@ -84,10 +86,10 @@ class Tools(pycam.Plugins.ListPluginBase):
cell = self.gui.get_object("ToolTableShapeCell") cell = self.gui.get_object("ToolTableShapeCell")
self.gui.get_object("ToolTableShapeColumn").set_cell_data_func( self.gui.get_object("ToolTableShapeColumn").set_cell_data_func(
cell, self._render_tool_shape) cell, self._render_tool_shape)
self.gui.get_object("ToolTableIDCell").connect("edited", self._gtk_handlers.append((self.gui.get_object("ToolTableIDCell"),
self._edit_tool_id) "edited", self._edit_tool_id))
self.gui.get_object("ToolTableNameCell").connect("edited", self._gtk_handlers.append((self.gui.get_object("ToolTableNameCell"),
self._edit_tool_name) "edited", self._edit_tool_name))
self._treemodel = self.gui.get_object("ToolList") self._treemodel = self.gui.get_object("ToolList")
self._treemodel.clear() self._treemodel.clear()
def update_model(): def update_model():
...@@ -104,23 +106,20 @@ class Tools(pycam.Plugins.ListPluginBase): ...@@ -104,23 +106,20 @@ class Tools(pycam.Plugins.ListPluginBase):
self._treemodel.append(cache[id(item)]) self._treemodel.append(cache[id(item)])
self.core.emit_event("tool-list-changed") self.core.emit_event("tool-list-changed")
# selector # selector
selection = self._modelview.get_selection() self._gtk_handlers.append((self._modelview.get_selection(),
selection.connect("changed", "changed", "tool-selection-changed"))
lambda widget, event: self.core.emit_event(event),
"tool-selection-changed")
# shape selector # shape selector
shape_selector = self.gui.get_object("ToolShapeSelector") self._gtk_handlers.append((
shape_selector.connect("changed", lambda widget: \ self.gui.get_object("ToolShapeSelector"), "changed",
self.core.emit_event("tool-shape-changed")) "tool-shape-changed"))
self.core.register_event("tool-shape-list-changed", self._event_handlers = (
self._update_widgets) ("tool-shape-list-changed", self._update_widgets),
self.core.register_event("tool-selection-changed", ("tool-selection-changed", self._tool_switch),
self._tool_switch) ("tool-changed", self._store_tool_settings),
self.core.register_event("tool-changed", ("tool-shape-changed", self._store_tool_settings))
self._store_tool_settings)
self.core.register_event("tool-shape-changed",
self._store_tool_settings)
self.register_model_update(update_model) self.register_model_update(update_model)
self.register_gtk_handlers(self._gtk_handlers)
self.register_event_handlers(self._event_handlers)
self._update_widgets() self._update_widgets()
self._tool_switch() self._tool_switch()
self.core.set("tools", self) self.core.set("tools", self)
...@@ -129,11 +128,13 @@ class Tools(pycam.Plugins.ListPluginBase): ...@@ -129,11 +128,13 @@ class Tools(pycam.Plugins.ListPluginBase):
def teardown(self): def teardown(self):
if self.gui: if self.gui:
self.core.unregister_ui("main", self.gui.get_object("ToolBox")) self.core.unregister_ui("main", self.gui.get_object("ToolBox"))
self.core.unregister_event("tool-selection-changed", self.unregister_gtk_handlers(self._gtk_handlers)
self._tool_switch) self.unregister_event_handlers(self._event_handlers)
self.core.unregister_chain("get_toolpath_information", self.core.unregister_chain("get_toolpath_information",
self.get_toolpath_information) self.get_toolpath_information)
self.core.set("tools", None) self.core.set("tools", None)
while len(self) > 0:
self.pop()
return True return True
def get_selected(self, index=False): def get_selected(self, index=False):
......
...@@ -30,33 +30,41 @@ class Units(pycam.Plugins.PluginBase): ...@@ -30,33 +30,41 @@ class Units(pycam.Plugins.PluginBase):
def setup(self): def setup(self):
if self.gui: if self.gui:
self._gtk_handlers = []
unit_pref_box = self.gui.get_object("UnitPrefBox") unit_pref_box = self.gui.get_object("UnitPrefBox")
unit_pref_box.unparent() unit_pref_box.unparent()
self.core.register_ui("preferences_general", "Units", self.core.register_ui("preferences_general", "Units",
unit_pref_box, 20) unit_pref_box, 20)
# unit control (mm/inch) # unit control (mm/inch)
unit_field = self.gui.get_object("unit_control") unit_field = self.gui.get_object("unit_control")
unit_field.connect("changed", self.change_unit_init) self._gtk_handlers.append((unit_field, "changed",
self.change_unit_init))
def set_unit(text): def set_unit(text):
unit_field.set_active(0 if text == "mm" else 1) unit_field.set_active(0 if text == "mm" else 1)
self._last_unit = text self._last_unit = text
self.core.add_item("unit", unit_field.get_active_text, set_unit) self.core.add_item("unit", unit_field.get_active_text, set_unit)
# other plugins should use "unit_string" for human readable output # other plugins should use "unit_string" for human readable output
self.core.add_item("unit_string", unit_field.get_active_text) self.core.add_item("unit_string", unit_field.get_active_text)
self.gui.get_object("UnitChangeSelectAll").connect("clicked", self._gtk_handlers.extend((
self.change_unit_set_selection, True) (self.gui.get_object("UnitChangeSelectAll"), "clicked",
self.gui.get_object("UnitChangeSelectNone").connect("clicked", self.change_unit_set_selection, True),
self.change_unit_set_selection, False) (self.gui.get_object("UnitChangeSelectNone"), "clicked",
self.change_unit_set_selection, False)))
# "unit change" window # "unit change" window
self.unit_change_window = self.gui.get_object("UnitChangeDialog") self.unit_change_window = self.gui.get_object("UnitChangeDialog")
self.gui.get_object("UnitChangeApply").connect("clicked", self.change_unit_apply) self._gtk_handlers.extend((
self.unit_change_window.connect("delete_event", self.change_unit_apply, False) (self.gui.get_object("UnitChangeApply"), "clicked",
self.change_unit_apply),
(self.unit_change_window, "delete_event",
self.change_unit_apply, False)))
self.register_gtk_handlers(self._gtk_handlers)
return True return True
def teardown(self): def teardown(self):
if self.gui: if self.gui:
self.core.unregister_ui("preferences_general", self.core.unregister_ui("preferences_general",
self.gui.get_object("UnitPrefBox")) self.gui.get_object("UnitPrefBox"))
self.unregister_gtk_handlers(self._gtk_handlers)
# TODO: reset setting "unit" back to a default value? # TODO: reset setting "unit" back to a default value?
def change_unit_init(self, widget=None): def change_unit_init(self, widget=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