From 3432284118f6b31d56aee17ad5d8eefeb58c9440 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sat, 11 Nov 2023 03:38:55 +0900 Subject: [PATCH] fix added accordion settings options --- modules/ui.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index bf06776e935..3d794b63309 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -4,6 +4,7 @@ import sys from functools import reduce import warnings +from contextlib import ExitStack import gradio as gr import gradio.utils @@ -270,9 +271,10 @@ def create_ui(): extra_tabs.__enter__() with gr.Tab("Generation", id="txt2img_generation") as txt2img_generation_tab, ResizeHandleRow(equal_height=False): - with gr.Accordion("Open for Settings", open=False), gr.Column(variant='compact', elem_id="txt2img_settings") \ - if shared.opts.img2img_settings_accordion else gr.Column(variant='compact', elem_id="txt2img_settings"): - + with ( + gr.Accordion("Open for Settings", open=False) if shared.opts.txt2img_settings_accordion else ExitStack(), + gr.Column(variant='compact', elem_id="txt2img_settings") + ): scripts.scripts_txt2img.prepare_ui() for category in ordered_ui_categories(): @@ -491,8 +493,10 @@ def create_ui(): extra_tabs.__enter__() with gr.Tab("Generation", id="img2img_generation") as img2img_generation_tab, ResizeHandleRow(equal_height=False): - with gr.Accordion("Open for Settings", open=False), gr.Column(variant='compact', elem_id="img2img_settings") \ - if shared.opts.img2img_settings_accordion else gr.Column(variant='compact', elem_id="img2img_settings"): + with ( + gr.Accordion("Open for Settings", open=False) if shared.opts.img2img_settings_accordion else ExitStack(), + gr.Column(variant='compact', elem_id="img2img_settings") + ): copy_image_buttons = [] copy_image_destinations = {}