Emit propertiesChanged on the global stack from the extruder stack

But only when the setting that changed has a relation that is not
settable per extruder.

Fixes CURA-3521
This commit is contained in:
Arjen Hiemstra 2017-07-11 12:02:44 +02:00
parent 458c9ac540
commit 95b825a4c5

View file

@ -25,6 +25,8 @@ class ExtruderStack(CuraContainerStack):
self.addMetaDataEntry("type", "extruder_train") # For backward compatibility
self.propertiesChanged.connect(self._onPropertiesChanged)
## Overridden from ContainerStack
#
# This will set the next stack and ensure that we register this stack as an extruder.
@ -85,6 +87,22 @@ class ExtruderStack(CuraContainerStack):
if stacks:
self.setNextStack(stacks[0])
def _onPropertiesChanged(self, key, properties):
# When there is a setting that is not settable per extruder that depends on a value from a setting that is,
# we do not always get properly informed that we should re-evaluate the setting. So make sure to indicate
# something changed for those settings.
definitions = self.getNextStack().definition.findDefinitions(key = key)
if definitions:
has_global_dependencies = False
for relation in definitions[0].relations:
if not getattr(relation.target, "settable_per_extruder", True):
has_global_dependencies = True
break
if has_global_dependencies:
self.getNextStack().propertiesChanged.emit(key, properties)
extruder_stack_mime = MimeType(
name = "application/x-cura-extruderstack",
comment = "Cura Extruder Stack",