From 93852dfb209a9ac0c7fbaee07c12d36072860dbc Mon Sep 17 00:00:00 2001 From: Tom Haelbich Date: Sun, 27 Aug 2023 20:02:36 +0200 Subject: [PATCH] added option to disable/enable the extension by default in settings --- scripts/StyleSelectorXL.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/StyleSelectorXL.py b/scripts/StyleSelectorXL.py index 170e76d..b49d627 100644 --- a/scripts/StyleSelectorXL.py +++ b/scripts/StyleSelectorXL.py @@ -119,12 +119,13 @@ class StyleSelectorXL(scripts.Script): return scripts.AlwaysVisible def ui(self, is_img2img): + enabled = getattr(shared.opts, "enable_styleselector_by_default", True) with gr.Group(): - with gr.Accordion("SDXL Styles", open=True): + with gr.Accordion("SDXL Styles", open=enabled): with FormRow(): with FormColumn(min_width=160): is_enabled = gr.Checkbox( - value=True, label="Enable Style Selector", info="Enable Or Disable Style Selector ") + value=enabled, label="Enable Style Selector", info="Enable Or Disable Style Selector ") with FormColumn(elem_id="Randomize Style"): randomize = gr.Checkbox( value=False, label="Randomize Style", info="This Will Override Selected Style") @@ -213,5 +214,13 @@ def on_ui_settings(): shared.opts.add_option("styles_ui", shared.OptionInfo( "radio-buttons", "How should Style Names Rendered on UI", gr.Radio, {"choices": ["radio-buttons", "select-list"]}, section=section)) - + shared.opts.add_option( + "enable_styleselector_by_default", + shared.OptionInfo( + True, + "enable Style Selector by default", + gr.Checkbox, + section=section + ) + ) script_callbacks.on_ui_settings(on_ui_settings)