mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 10:15:11 +08:00
Use container tree to determine quality_definition of profile and printer
To see if they match. Contributes to issue CURA-6600.
This commit is contained in:
parent
24fd67c360
commit
ae77f9124c
@ -178,6 +178,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
global_stack = Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if not global_stack:
|
if not global_stack:
|
||||||
return {"status": "error", "message": catalog.i18nc("@info:status Don't translate the XML tags <filename>!", "Can't import profile from <filename>{0}</filename> before a printer is added.", file_name)}
|
return {"status": "error", "message": catalog.i18nc("@info:status Don't translate the XML tags <filename>!", "Can't import profile from <filename>{0}</filename> before a printer is added.", file_name)}
|
||||||
|
container_tree = ContainerTree.getInstance()
|
||||||
|
|
||||||
machine_extruders = []
|
machine_extruders = []
|
||||||
for position in sorted(global_stack.extruders):
|
for position in sorted(global_stack.extruders):
|
||||||
@ -227,7 +228,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
# Make sure we have a profile_definition in the file:
|
# Make sure we have a profile_definition in the file:
|
||||||
if profile_definition is None:
|
if profile_definition is None:
|
||||||
break
|
break
|
||||||
machine_definitions = self.findDefinitionContainers(id = profile_definition)
|
machine_definitions = self.findContainers(id = profile_definition)
|
||||||
if not machine_definitions:
|
if not machine_definitions:
|
||||||
Logger.log("e", "Incorrect profile [%s]. Unknown machine type [%s]", file_name, profile_definition)
|
Logger.log("e", "Incorrect profile [%s]. Unknown machine type [%s]", file_name, profile_definition)
|
||||||
return {"status": "error",
|
return {"status": "error",
|
||||||
@ -237,8 +238,8 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
|
|
||||||
# Get the expected machine definition.
|
# Get the expected machine definition.
|
||||||
# i.e.: We expect gcode for a UM2 Extended to be defined as normal UM2 gcode...
|
# i.e.: We expect gcode for a UM2 Extended to be defined as normal UM2 gcode...
|
||||||
profile_definition = getMachineDefinitionIDForQualitySearch(machine_definition)
|
profile_definition = container_tree.machines[machine_definition.getId()].quality_definition
|
||||||
expected_machine_definition = getMachineDefinitionIDForQualitySearch(global_stack.definition)
|
expected_machine_definition = container_tree.machines[global_stack.definition.getId()].quality_definition
|
||||||
|
|
||||||
# And check if the profile_definition matches either one (showing error if not):
|
# And check if the profile_definition matches either one (showing error if not):
|
||||||
if profile_definition != expected_machine_definition:
|
if profile_definition != expected_machine_definition:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user