Warn when user uses bad ui setting

This commit is contained in:
CookieHCl 2022-10-16 05:09:11 +09:00 committed by AUTOMATIC1111
parent b65a3101ce
commit 9258a33e37
1 changed files with 3 additions and 1 deletions

View File

@ -1717,7 +1717,9 @@ Requested path was: {f}
saved_value = ui_settings.get(key, None) saved_value = ui_settings.get(key, None)
if saved_value is None: if saved_value is None:
ui_settings[key] = getattr(obj, field) ui_settings[key] = getattr(obj, field)
elif condition is None or condition(saved_value): elif condition and not condition(saved_value):
print(f'Warning: Bad ui setting value: {key}: {saved_value}; Default value "{getattr(obj, field)}" will be used instead.')
else:
setattr(obj, field, saved_value) setattr(obj, field, saved_value)
if type(x) in [gr.Slider, gr.Radio, gr.Checkbox, gr.Textbox, gr.Number] and x.visible: if type(x) in [gr.Slider, gr.Radio, gr.Checkbox, gr.Textbox, gr.Number] and x.visible: