QualityChangesGroup.py 1.2 KB

12345678910111213141516171819202122232425262728
  1. # Copyright (c) 2018 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from UM.Application import Application
  4. from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
  5. from .QualityGroup import QualityGroup
  6. class QualityChangesGroup(QualityGroup):
  7. def __init__(self, name: str, quality_type: str, parent = None):
  8. super().__init__(name, quality_type, parent)
  9. self._container_registry = Application.getInstance().getContainerRegistry()
  10. def addNode(self, node: "QualityNode"):
  11. extruder_position = node.metadata.get("position")
  12. if extruder_position is None and self.node_for_global is not None or extruder_position in self.nodes_for_extruders: #We would be overwriting another node.
  13. ConfigurationErrorMessage.getInstance().addFaultyContainers(node.metadata["id"])
  14. return
  15. if extruder_position is None: #Then we're a global quality changes profile.
  16. self.node_for_global = node
  17. else: #This is an extruder's quality changes profile.
  18. self.nodes_for_extruders[extruder_position] = node
  19. def __str__(self) -> str:
  20. return "%s[<%s>, available = %s]" % (self.__class__.__name__, self.name, self.is_available)