mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-10 07:18:59 +08:00
Fix getting settings from JSON file
When reading a node of a JSON file, apparently it only lists the keys instead of key-value pairs. You have to get the values separately. Contributes to issue CURA-37.
This commit is contained in:
parent
6bde0e3404
commit
99a13ba3aa
@ -84,7 +84,8 @@ class LegacyProfileReader(ProfileReader):
|
||||
if "translation" not in dict_of_doom:
|
||||
Logger.log("e", "Dictionary of Doom has no translation. Is it the correct JSON file?")
|
||||
return None
|
||||
for new_setting, old_setting_expression in dict_of_doom["translation"]: #Evaluate all new settings that would get a value from the translations.
|
||||
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")
|
||||
new_value = eval(compiled, {}, 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!
|
||||
|
Loading…
x
Reference in New Issue
Block a user