From 5c28f97770315c789b9211b2380c520f123110ba Mon Sep 17 00:00:00 2001 From: Ezekiel-Rage <37027067+Ezekiel-Rage@users.noreply.github.com> Date: Mon, 5 Jun 2023 13:31:21 -0700 Subject: [PATCH 1/2] "All" tab knock-on bug fix The addition of the All tab introduced a bug in which an "All" folder is created in the root stable diffusion directory. This PR prevent the folder from being created. --- scripts/image_browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/image_browser.py b/scripts/image_browser.py index ec474d6..c82d71b 100644 --- a/scripts/image_browser.py +++ b/scripts/image_browser.py @@ -1130,7 +1130,7 @@ def create_tab(tab: ImageBrowserTab, current_gr_tab: gr.Tab): if standard_ui: dir_name = str(Path(dir_name)) - if not os.path.exists(dir_name): + if not os.path.exists(dir_name) and os.path.basename(os.path.normpath(dir_name)) != "All": os.makedirs(dir_name) with gr.Row(): From 26ab8d4e962423284818e59acf2e90907ec741f6 Mon Sep 17 00:00:00 2001 From: Ezekiel-Rage <37027067+Ezekiel-Rage@users.noreply.github.com> Date: Mon, 5 Jun 2023 14:57:21 -0700 Subject: [PATCH 2/2] disabled open folder button on All tab I need to investigate further to determine the best way to handle the button when an image is selected. For now it's disabled entirely on the All tab since it's non-functional. --- scripts/image_browser.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/image_browser.py b/scripts/image_browser.py index c82d71b..889546a 100644 --- a/scripts/image_browser.py +++ b/scripts/image_browser.py @@ -1130,7 +1130,7 @@ def create_tab(tab: ImageBrowserTab, current_gr_tab: gr.Tab): if standard_ui: dir_name = str(Path(dir_name)) - if not os.path.exists(dir_name) and os.path.basename(os.path.normpath(dir_name)) != "All": + if not os.path.exists(dir_name) and tab.name != "All": os.makedirs(dir_name) with gr.Row(): @@ -1233,10 +1233,13 @@ def create_tab(tab: ImageBrowserTab, current_gr_tab: gr.Tab): with gr.Row() as filetime_panel: img_file_time= gr.HTML() with gr.Row() as open_folder_panel: - open_folder_button = gr.Button(folder_symbol, visible=standard_ui or others_dir) - gr.HTML(" ") - gr.HTML(" ") - gr.HTML(" ") + if tab.name == "All": + open_folder_button = gr.Button(folder_symbol, visible=False) + else: + open_folder_button = gr.Button(folder_symbol, visible=standard_ui or others_dir) + gr.HTML(" ") + gr.HTML(" ") + gr.HTML(" ") with gr.Row(elem_id=f"{tab.base_tag}_image_browser_button_panel", visible=False) as button_panel: with gr.Column(): with gr.Row():