mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
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.
This commit is contained in:
parent
3195684892
commit
5d4cceb47c
1 changed files with 3 additions and 2 deletions
|
@ -74,7 +74,7 @@ class LegacyProfileReader(ProfileReader):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(PluginRegistry.getInstance().getPluginPath("LegacyProfileReader"), "DictionaryOfDoom.json"), "r", -1, "utf-8") as f:
|
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:
|
except IOError as e:
|
||||||
Logger.log("e", "Could not open DictionaryOfDoom.json for reading: %s", str(e))
|
Logger.log("e", "Could not open DictionaryOfDoom.json for reading: %s", str(e))
|
||||||
return None
|
return None
|
||||||
|
@ -97,6 +97,7 @@ class LegacyProfileReader(ProfileReader):
|
||||||
old_setting_expression = dict_of_doom["translation"][new_setting]
|
old_setting_expression = dict_of_doom["translation"][new_setting]
|
||||||
compiled = compile(old_setting_expression, new_setting, "eval")
|
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.
|
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
|
return profile
|
Loading…
Add table
Add a link
Reference in a new issue