FIX save_model_settings function to also update shared.model_config (#2282)

This commit is contained in:
Gabriel Terrien 2023-05-24 15:01:07 +02:00 committed by GitHub
parent d37a28730d
commit fc116711b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,11 +289,16 @@ def save_model_settings(model, state):
user_config = {} user_config = {}
model_regex = model + '$' # For exact matches model_regex = model + '$' # For exact matches
for _dict in [user_config, shared.model_config]:
if model_regex not in _dict:
_dict[model_regex] = {}
if model_regex not in user_config: if model_regex not in user_config:
user_config[model_regex] = {} user_config[model_regex] = {}
for k in ui.list_model_elements(): for k in ui.list_model_elements():
user_config[model_regex][k] = state[k] user_config[model_regex][k] = state[k]
shared.model_config[model_regex][k] = state[k]
with open(p, 'w') as f: with open(p, 'w') as f:
f.write(yaml.dump(user_config)) f.write(yaml.dump(user_config))