From 63ac8412e639e0fc6c959f076678c90fab527e0c Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 29 Jan 2018 11:17:27 +0100 Subject: [PATCH] Fix importing legacy INI quality profiles CURA-4876 --- plugins/LegacyProfileReader/LegacyProfileReader.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/LegacyProfileReader/LegacyProfileReader.py b/plugins/LegacyProfileReader/LegacyProfileReader.py index 07cd8b0aad..73a305a0f5 100644 --- a/plugins/LegacyProfileReader/LegacyProfileReader.py +++ b/plugins/LegacyProfileReader/LegacyProfileReader.py @@ -125,7 +125,10 @@ class LegacyProfileReader(ProfileReader): Logger.log("e", "Dictionary of Doom has no translation. Is it the correct JSON file?") return None current_printer_definition = global_container_stack.definition - profile.setDefinition(current_printer_definition.getId()) + quality_definition = current_printer_definition.getMetaDataEntry("quality_definition") + if not quality_definition: + quality_definition = current_printer_definition.getId() + profile.setDefinition(quality_definition) for new_setting in dict_of_doom["translation"]: # Evaluate all new settings that would get a value from the translations. old_setting_expression = dict_of_doom["translation"][new_setting] compiled = compile(old_setting_expression, new_setting, "eval") @@ -162,6 +165,10 @@ class LegacyProfileReader(ProfileReader): data = stream.getvalue() profile.deserialize(data) + # The definition can get reset to fdmprinter during the deserialization's upgrade. Here we set the definition + # again. + profile.setDefinition(quality_definition) + #We need to return one extruder stack and one global stack. global_container_id = container_registry.uniqueName("Global Imported Legacy Profile") global_profile = profile.duplicate(new_id = global_container_id, new_name = profile_id) #Needs to have the same name as the extruder profile.