Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2021-06-03 18:02:05 +0300
committerGhostkeeper <rubend@tutanota.com>2021-06-03 18:13:22 +0300
commit3dc1dbbbdbce695732b4fd5fdc2b4fda1f1a9f64 (patch)
tree07b038cf3dc8b9466934a5dfb61de429c59b5182 /plugins/3MFReader
parent00796b6c9958c5999690e94ba84506eccc59ea9e (diff)
Load profile from ContainerRegistry if the stack refers to it
We encountered a case where the version upgrade changed the quality profile to a new one which was specific to the printer rather than a global profile. As the upgraded stack was being read from the project file, it would go look for the new quality profile in the workspace. That ID wouldn't be present in there, and so it would crash and pretend the project file is plain 3MF. This change makes it fallback to the built-in profiles, for precisely such cases as when a version upgrade changes the stack. Contributes to issue CURA-8212.
Diffstat (limited to 'plugins/3MFReader')
-rwxr-xr-xplugins/3MFReader/ThreeMFWorkspaceReader.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py
index c4170ebfcf..d0442e083b 100755
--- a/plugins/3MFReader/ThreeMFWorkspaceReader.py
+++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Ultimaker B.V.
+# Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from configparser import ConfigParser
@@ -412,7 +412,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
quality_container_id = parser["containers"][str(_ContainerIndexes.Quality)]
quality_type = "empty_quality"
if quality_container_id not in ("empty", "empty_quality"):
- quality_type = instance_container_info_dict[quality_container_id].parser["metadata"]["quality_type"]
+ if quality_container_id in instance_container_info_dict:
+ quality_type = instance_container_info_dict[quality_container_id].parser["metadata"]["quality_type"]
+ else: # If a version upgrade changed the quality profile in the stack, we'll need to look for it in the built-in profiles instead of the workspace.
+ quality_matches = ContainerRegistry.getInstance().findContainersMetadata(id = quality_container_id)
+ if quality_matches: # If there's no profile with this ID, leave it empty_quality.
+ quality_type = quality_matches[0]["quality_type"]
# Get machine info
serialized = archive.open(global_stack_file).read().decode("utf-8")