From d1cfcef933470c36989cc9c75b3f3f78272dd3c8 Mon Sep 17 00:00:00 2001 From: DenOfEquity <166248528+DenOfEquity@users.noreply.github.com> Date: Mon, 2 Dec 2024 21:39:21 +0000 Subject: [PATCH] Setting to hide toprow on specified tabs (#2402) an option for any tab combination, rather than hardcoded for Spaces only --- modules/shared_options.py | 1 + modules/ui.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/shared_options.py b/modules/shared_options.py index c205da1a..f16d7e05 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -339,6 +339,7 @@ options_templates.update(options_section(('ui', "User interface", "ui"), { "quick_setting_list": OptionInfo([], "Quicksettings list", ui_components.DropdownMulti, lambda: {"choices": list(shared.opts.data_labels.keys())}).js("info", "settingsHintsShowQuicksettings").info("setting entries that appear at the top of page rather than in settings tab").needs_reload_ui(), "ui_tab_order": OptionInfo([], "UI tab order", ui_components.DropdownMulti, lambda: {"choices": list(shared.tab_names)}).needs_reload_ui(), "hidden_tabs": OptionInfo([], "Hidden UI tabs", ui_components.DropdownMulti, lambda: {"choices": list(shared.tab_names)}).needs_reload_ui(), + "tabs_without_quick_settings_bar": OptionInfo(["Spaces"], "UI tabs without Quicksettings bar (top row)", ui_components.DropdownMulti, lambda: {"choices": list(shared.tab_names)}), "ui_reorder_list": OptionInfo([], "UI item order for txt2img/img2img tabs", ui_components.DropdownMulti, lambda: {"choices": list(shared_items.ui_reorder_categories())}).info("selected items appear first").needs_reload_ui(), "gradio_theme": OptionInfo("Default", "Gradio theme", ui_components.DropdownEditable, lambda: {"choices": ["Default"] + shared_gradio_themes.gradio_hf_hub_themes}).info("you can also manually enter any of themes from the gallery.").needs_reload_ui(), "gradio_themes_cache": OptionInfo(True, "Cache gradio themes locally").info("disable to update the selected Gradio theme"), diff --git a/modules/ui.py b/modules/ui.py index 7bc8dd94..7eb550e3 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -969,8 +969,6 @@ def create_ui(): extensions_interface = ui_extensions.create_ui() interfaces += [(extensions_interface, "Extensions", "extensions")] - interface_names_without_quick_setting_bars = ["Spaces"] - shared.tab_names = [] for _interface, label, _ifid in interfaces: shared.tab_names.append(label) @@ -998,7 +996,8 @@ def create_ui(): loadsave.setup_ui() def tab_changed(evt: gr.SelectData): - return gr.update(visible=evt.value not in interface_names_without_quick_setting_bars) + no_quick_setting = getattr(shared.opts, "tabs_without_quick_settings_bar", []) + return gr.update(visible=evt.value not in no_quick_setting) tabs.select(tab_changed, outputs=[quicksettings_row], show_progress=False, queue=False)