From 71072f56204c300fa294e15eb7d07592edacda16 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sun, 18 Feb 2024 02:47:44 +0900 Subject: [PATCH] re-work open image button settings --- modules/shared_options.py | 3 +-- modules/ui_common.py | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/shared_options.py b/modules/shared_options.py index 7571a7d1d..bb3752ba6 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -284,8 +284,7 @@ options_templates.update(options_section(('ui_gallery', "Gallery", "ui"), { "sd_webui_modal_lightbox_icon_opacity": OptionInfo(1, "Full page image viewer: control icon unfocused opacity", gr.Slider, {"minimum": 0.0, "maximum": 1, "step": 0.01}, onchange=shared.reload_gradio_theme).info('for mouse only').needs_reload_ui(), "sd_webui_modal_lightbox_toolbar_opacity": OptionInfo(0.9, "Full page image viewer: tool bar opacity", gr.Slider, {"minimum": 0.0, "maximum": 1, "step": 0.01}, onchange=shared.reload_gradio_theme).info('for mouse only').needs_reload_ui(), "gallery_height": OptionInfo("", "Gallery height", gr.Textbox).info("can be any valid CSS value, for example 768px or 20em").needs_reload_ui(), - "button_open_image_actual_dir": OptionInfo(True, '"Open images output directory" button opens the actual directory of the image rather than the output root folder'), - "button_open_image_actual_dir_temp": OptionInfo(False, '"Open images output directory" button opens the actual directory even for temp images'), + "open_dir_button_choice": OptionInfo("Subdirectory", "What directory the [📂] button opens", gr.Radio, {"choices": ["Output Root", "Subdirectory", "Subdirectory (even temp dir)"]}), })) options_templates.update(options_section(('ui_alternatives', "UI alternatives", "ui"), { diff --git a/modules/ui_common.py b/modules/ui_common.py index 78481c6fb..cf1b8b32c 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -169,11 +169,9 @@ def create_output_panel(tabname, outdir, toprow=None): return try: - if shared.opts.button_open_image_actual_dir and 0 <= index < len(images): - image = images[index] - image_path = image["name"].rsplit('?', 1)[0] - image_dir = os.path.split(image_path)[0] - if shared.opts.button_open_image_actual_dir_temp or not ui_tempdir.is_gradio_temp_path(image_dir): + if 'Sub' in shared.opts.open_dir_button_choice: + image_dir = os.path.split(images[index]["name"].rsplit('?', 1)[0])[0] + if 'temp' in shared.opts.open_dir_button_choice or not ui_tempdir.is_gradio_temp_path(image_dir): f = image_dir except Exception: pass