added hiding items to ui-config.json

This commit is contained in:
AUTOMATIC 2022-09-25 19:43:42 +03:00
parent 073f6eac22
commit ff107845b4

View file

@ -1041,8 +1041,8 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
def apply_field(obj, field, condition=None): def apply_field(obj, field, condition=None):
key = path + "/" + field key = path + "/" + field
if getattr(obj,'do_not_save_to_config',False): if getattr(obj, 'do_not_save_to_config', False):
return return
saved_value = ui_settings.get(key, None) saved_value = ui_settings.get(key, None)
if saved_value is None: if saved_value is None:
@ -1050,6 +1050,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
elif condition is None or condition(saved_value): elif condition is None or condition(saved_value):
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:
apply_field(x, 'visible')
if type(x) == gr.Slider: if type(x) == gr.Slider:
apply_field(x, 'value') apply_field(x, 'value')
apply_field(x, 'minimum') apply_field(x, 'minimum')