mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 20:45:57 +08:00
Check before adding quality changes node
So you don't end up with half a node if we have to abort early. When this happens, show the configuration error message. Contributes to issue CURA-5045.
This commit is contained in:
parent
027f4b44bb
commit
7af941541b
@ -2,6 +2,7 @@
|
|||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
|
||||||
|
|
||||||
from .QualityGroup import QualityGroup
|
from .QualityGroup import QualityGroup
|
||||||
|
|
||||||
@ -13,14 +14,14 @@ class QualityChangesGroup(QualityGroup):
|
|||||||
|
|
||||||
def addNode(self, node: "QualityNode"):
|
def addNode(self, node: "QualityNode"):
|
||||||
extruder_position = node.metadata.get("position")
|
extruder_position = node.metadata.get("position")
|
||||||
|
|
||||||
|
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.
|
||||||
|
ConfigurationErrorMessage.getInstance().addFaultyContainers(node.metadata["id"])
|
||||||
|
return
|
||||||
|
|
||||||
if extruder_position is None: #Then we're a global quality changes profile.
|
if extruder_position is None: #Then we're a global quality changes profile.
|
||||||
if self.node_for_global is not None:
|
|
||||||
raise RuntimeError("{group} tries to overwrite the existing node_for_global {original_global} with {new_global}".format(group = self, original_global = self.node_for_global, new_global = node))
|
|
||||||
self.node_for_global = node
|
self.node_for_global = node
|
||||||
else: #This is an extruder's quality changes profile.
|
else: #This is an extruder's quality changes profile.
|
||||||
if extruder_position in self.nodes_for_extruders:
|
|
||||||
raise RuntimeError("%s tries to overwrite the existing nodes_for_extruders position [%s] %s with %s" %
|
|
||||||
(self, extruder_position, self.node_for_global, node))
|
|
||||||
self.nodes_for_extruders[extruder_position] = node
|
self.nodes_for_extruders[extruder_position] = node
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user