From 70c637bf90ef673695c9302db7bb51d19b0a3da8 Mon Sep 17 00:00:00 2001 From: Ashley Kleynhans Date: Thu, 11 Apr 2024 23:19:16 +0200 Subject: [PATCH] Fix saving of UI defaults to settings.yaml - Fixes #5592 (#5794) --- modules/ui.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index 56b1518c..a84378b1 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -233,14 +233,16 @@ def save_settings(state, preset, extensions_list, show_controls, theme_state): # Save extension values in the UI for extension_name in extensions_list: - extension = getattr(extensions, extension_name).script - if hasattr(extension, 'params'): - params = getattr(extension, 'params') - for param in params: - _id = f"{extension_name}-{param}" - # Only save if different from default value - if param not in shared.default_settings or params[param] != shared.default_settings[param]: - output[_id] = params[param] + extension = getattr(extensions, extension_name, None) + if extension: + extension = extension.script + if hasattr(extension, 'params'): + params = getattr(extension, 'params') + for param in params: + _id = f"{extension_name}-{param}" + # Only save if different from default value + if param not in shared.default_settings or params[param] != shared.default_settings[param]: + output[_id] = params[param] # Do not save unchanged settings for key in list(output.keys()):