added option to disable/enable the extension by default in settings

This commit is contained in:
Tom Haelbich
2023-08-27 20:02:36 +02:00
parent d7abf002f0
commit 93852dfb20

View File

@@ -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)