From ff107845b4814402a4722941d669e72055384771 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 25 Sep 2022 19:43:42 +0300 Subject: [PATCH] added hiding items to ui-config.json --- modules/ui.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index 91f07cd5..05d33563 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1041,8 +1041,8 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): def apply_field(obj, field, condition=None): key = path + "/" + field - if getattr(obj,'do_not_save_to_config',False): - return + if getattr(obj, 'do_not_save_to_config', False): + return saved_value = ui_settings.get(key, 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): 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: apply_field(x, 'value') apply_field(x, 'minimum')