From a3aeb93fd7387cfe58aabf431b2dbbd1796bffed Mon Sep 17 00:00:00 2001 From: AlUlkesh <99896447+AlUlkesh@users.noreply.github.com> Date: Mon, 31 Jul 2023 22:04:41 +0200 Subject: [PATCH] image_browser_height_auto, #40 --- scripts/image_browser.py | 3 ++- style.css | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/image_browser.py b/scripts/image_browser.py index 849f94d..0f829a9 100644 --- a/scripts/image_browser.py +++ b/scripts/image_browser.py @@ -1162,7 +1162,7 @@ def create_tab(tab: ImageBrowserTab, current_gr_tab: gr.Tab): with gr.Column(scale=4, min_width=20): ranking = gr.Radio(choices=["1", "2", "3", "4", "5", "None"], label="Set ranking to", elem_id=f"{tab.base_tag}_control_image_browser_ranking", interactive=True) with gr.Row(): - image_gallery = gr.Gallery(show_label=False, elem_id=f"{tab.base_tag}_image_browser_gallery").style(grid=opts.image_browser_page_columns) + image_gallery = gr.Gallery(show_label=False, elem_id=f"{tab.base_tag}_image_browser_gallery").style(columns=opts.image_browser_page_columns, height=("max-content" if opts.image_browser_height_auto else None)) with gr.Row() as delete_panel: with gr.Column(scale=1): delete_num = gr.Number(value=1, interactive=True, label="delete next", elem_id=f"{tab.base_tag}_image_browser_del_num") @@ -1687,6 +1687,7 @@ def on_ui_settings(): ("image_browser_page_columns", "images_history_page_columns", 6, "Number of columns on the page"), ("image_browser_page_rows", "images_history_page_rows", 6, "Number of rows on the page"), ("image_browser_pages_perload", "images_history_pages_perload", 20, "Minimum number of pages per load"), + ("image_browser_height_auto", None, False, "Use automatic height for gallery (requires Gradio >= 3.36.0)"), ("image_browser_use_thumbnail", None, False, "Use optimized images in the thumbnail interface (significantly reduces the amount of data transferred)"), ("image_browser_thumbnail_size", None, 200, "Size of the thumbnails (px)"), ("image_browser_swipe", None, False, "Swipe left/right navigates to the next image"), diff --git a/style.css b/style.css index 7f6d00c..ba3ff92 100644 --- a/style.css +++ b/style.css @@ -2,7 +2,7 @@ justify-content: initial; } -.thumbnails.scroll-hide.svelte-g4rw9 { +[id^='image_browser_tab_'] .thumbnails.scroll-hide { justify-content: initial; }