Commit 6dc3fb3c authored by Lars Kruse's avatar Lars Kruse

enable the first toolpath processor after program initialization

Otherwise the "last" (based on the order of plugin initialization) toolpath
processor is selected. The load order is arbitrary - thus the initial processor
selection not determined. (we don't like this)
parent 9066251e
......@@ -640,6 +640,7 @@ class ProjectGui(object):
# register a logging handler for displaying error messages
pycam.Utils.log.add_gtk_gui(self.window, logging.ERROR)
self.window.show()
self.settings.emit_event("notify-initialization-finished")
def update_all_controls(self):
self.update_ode_settings()
......
......@@ -136,6 +136,8 @@ class ToolpathProcessors(pycam.Plugins.ListPluginBase):
self._event_handlers = (
("toolpath-processor-list-changed", self._update_processors),
("toolpath-selection-changed", self._update_visibility),
("notify-initialization-finished",
self._activate_first_processor),
)
self.register_event_handlers(self._event_handlers)
self._update_processors()
......@@ -148,6 +150,13 @@ class ToolpathProcessors(pycam.Plugins.ListPluginBase):
self.unregister_event_handlers(self._event_handlers)
self.core.get("unregister_parameter_group")("toolpath_processor")
def _activate_first_processor(self):
# run this action as soon as all processors are registered
processors = self.core.get("get_parameter_sets")("toolpath_processor").values()
processors.sort(key=lambda item: item["weight"])
if processors:
self.select(processors[0])
def get_selected(self):
all_processors = self.core.get("get_parameter_sets")("toolpath_processor")
current_name = self._proc_selector.get_value()
......
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