Fix ConvexHull{Decorator,Job} to work with the new profile structure

This commit is contained in:
Arjen Hiemstra 2015-09-01 15:03:29 +02:00
parent 712ec6acdf
commit 47e96a9e2a
2 changed files with 26 additions and 19 deletions

View file

@ -14,18 +14,10 @@ class ConvexHullDecorator(SceneNodeDecorator):
self._convex_hull_node = None
self._convex_hull_job = None
settings = Application.getInstance().getMachineManager().getActiveMachineInstance()
print_sequence_setting = settings.getSettingByKey("print_sequence")
if print_sequence_setting:
print_sequence_setting.valueChanged.connect(self._onPrintSequenceSettingChanged)
def _onPrintSequenceSettingChanged(self, setting):
if self._convex_hull_job:
self._convex_hull_job.cancel()
self.setConvexHull(None)
if self._convex_hull_node:
self._convex_hull_node.setParent(None)
self._convex_hull_node = None
self._profile = None
Application.getInstance().getMachineManager().activeProfileChanged.connect(self._onActiveProfileChanged)
self._onActiveProfileChanged()
def getConvexHull(self):
return self._convex_hull
@ -61,4 +53,20 @@ class ConvexHullDecorator(SceneNodeDecorator):
def setConvexHullNode(self, node):
self._convex_hull_node = node
def _onActiveProfileChanged(self):
if self._profile:
self._profile.settingValueChanged.disconnect(self._onSettingValueChanged)
self._profile = Application.getInstance().getMachineManager().getActiveProfile()
if self._profile:
self._profile.settingValueChanged.connect(self._onSettingValueChanged)
def _onSettingValueChanged(self, setting):
if setting == "print_sequence":
if self._convex_hull_job:
self._convex_hull_job.cancel()
self.setConvexHull(None)
if self._convex_hull_node:
self._convex_hull_node.setParent(None)
self._convex_hull_node = None