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-09-24 17:32:38 +0300
committerGhostkeeper <rubend@tutanota.com>2021-09-24 17:32:38 +0300
commitef568ce622fc7f91187ce52a253df11f2db809d0 (patch)
tree71694e44852d4703403ceb86c2f003d178722d07 /plugins/VersionUpgrade/VersionUpgrade411to412
parenta08a5625d2cab8476af47cfd904d7cffa89a05bc (diff)
Only get quality-changes fields for quality-changes profiles
And make the upgrade more robust against weird input, too. Contributes to issue CURA-8510.
Diffstat (limited to 'plugins/VersionUpgrade/VersionUpgrade411to412')
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py b/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py
index bc00c3fad8..4fb18486c2 100644
--- a/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py
+++ b/plugins/VersionUpgrade/VersionUpgrade411to412/VersionUpgrade411to412.py
@@ -73,11 +73,11 @@ class VersionUpgrade411to412(VersionUpgrade):
# Update user-made quality profiles of flsun_sr printers to use the flsun_sr-specific qualities instead of the
# global ones as their base
file_base_name = os.path.basename(filename) # Remove any path-related characters from the filename
- old_definition = parser["general"]["definition"]
- old_quality_type = parser["metadata"]["quality_type"]
- if file_base_name.startswith("flsun_sr") and old_definition == "fdmprinter" and parser["metadata"]["type"] == "quality_changes":
- parser["general"]["definition"] = "flsun_sr"
- parser["metadata"]["quality_type"] = self._flsun_quality_type_mapping.get(old_quality_type, "normal")
+ if file_base_name.startswith("flsun_sr_") and parser["metadata"].get("type") == "quality_changes":
+ if "general" in parser and parser["general"].get("definition") == "fdmprinter":
+ old_quality_type = parser["metadata"].get("quality_type", "normal")
+ parser["general"]["definition"] = "flsun_sr"
+ parser["metadata"]["quality_type"] = self._flsun_quality_type_mapping.get(old_quality_type, "normal")
result = io.StringIO()
parser.write(result)