From 5d4cceb47c080b8efbbc25c7f6a998c3f2a8ed42 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 13 Jan 2016 16:16:00 +0100 Subject: [PATCH] Don't add a setting if it's the default If the imported setting is the default in the new Cura, don't add it to the profile. Contributes to issue CURA-37. --- plugins/LegacyProfileReader/LegacyProfileReader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/LegacyProfileReader/LegacyProfileReader.py b/plugins/LegacyProfileReader/LegacyProfileReader.py index 5d89a85978..e5a4f575b3 100644 --- a/plugins/LegacyProfileReader/LegacyProfileReader.py +++ b/plugins/LegacyProfileReader/LegacyProfileReader.py @@ -74,7 +74,7 @@ class LegacyProfileReader(ProfileReader): try: with open(os.path.join(PluginRegistry.getInstance().getPluginPath("LegacyProfileReader"), "DictionaryOfDoom.json"), "r", -1, "utf-8") as f: - dict_of_doom = json.load(f) #Parse the Dictionary of Doom. + dict_of_doom = json.load(f) #Parse the Dictionary of Doom. except IOError as e: Logger.log("e", "Could not open DictionaryOfDoom.json for reading: %s", str(e)) return None @@ -97,6 +97,7 @@ class LegacyProfileReader(ProfileReader): old_setting_expression = dict_of_doom["translation"][new_setting] compiled = compile(old_setting_expression, new_setting, "eval") new_value = eval(compiled, {"math": math}, legacy_settings) #Pass the legacy settings as local variables to allow access to in the evaluation. - profile.setSettingValue(new_setting, new_value) #Store the setting in the profile! + if profile.getSettingValue(new_setting) != new_value: #Not equal to the default. + profile.setSettingValue(new_setting, new_value) #Store the setting in the profile! return profile \ No newline at end of file