This commit is contained in:
Haoming 2026-02-22 00:23:08 +08:00
parent 8d8ce983f2
commit 748fd33b0a
2 changed files with 12 additions and 11 deletions

View File

@ -2,9 +2,9 @@ import gradio as gr
from modules import shared, ui_common, ui_components, styles
styles_edit_symbol = '\U0001f58c\uFE0F' # 🖌️
styles_materialize_symbol = '\U0001f4cb' # 📋
styles_copy_symbol = '\U0001f4dd' # 📝
styles_edit_symbol = "\U0001f58c\ufe0f" # 🖌️
styles_materialize_symbol = "\U0001f4cb" # 📋
styles_copy_symbol = "\U0001f4dd" # 📝
def select_style(name):
@ -39,7 +39,7 @@ def delete_style(name):
shared.prompt_styles.styles.pop(name, None)
shared.prompt_styles.save_styles()
return '', '', ''
return "", "", ""
def materialize_styles(prompt, negative_prompt, styles):
@ -71,15 +71,15 @@ class UiPromptStyles:
self.copy = ui_components.ToolButton(value=styles_copy_symbol, elem_id=f"{tabname}_style_copy", tooltip="Copy main UI prompt to style.")
with gr.Row():
self.prompt = gr.Textbox(label="Prompt", show_label=True, elem_id=f"{tabname}_edit_style_prompt", lines=3, elem_classes=["prompt"])
self.prompt = gr.Textbox(label="Prompt", show_label=True, elem_id=f"{tabname}_edit_style_prompt", lines=4, max_lines=16, elem_classes=["prompt"])
with gr.Row():
self.neg_prompt = gr.Textbox(label="Negative prompt", show_label=True, elem_id=f"{tabname}_edit_style_neg_prompt", lines=3, elem_classes=["prompt"])
self.neg_prompt = gr.Textbox(label="Negative prompt", show_label=True, elem_id=f"{tabname}_edit_style_neg_prompt", lines=4, max_lines=16, elem_classes=["prompt"])
with gr.Row():
self.save = gr.Button('Save', variant='primary', elem_id=f'{tabname}_edit_style_save', visible=False)
self.delete = gr.Button('Delete', variant='primary', elem_id=f'{tabname}_edit_style_delete', visible=False)
self.close = gr.Button('Close', variant='secondary', elem_id=f'{tabname}_edit_style_close')
self.save = gr.Button("Save", variant="primary", elem_id=f"{tabname}_edit_style_save", visible=False)
self.delete = gr.Button("Delete", variant="primary", elem_id=f"{tabname}_edit_style_delete", visible=False)
self.close = gr.Button("Close", variant="secondary", elem_id=f"{tabname}_edit_style_close")
self.selection.change(
fn=select_style,
@ -120,4 +120,4 @@ class UiPromptStyles:
inputs=[self.main_ui_prompt, self.main_ui_negative_prompt, self.dropdown],
outputs=[self.main_ui_prompt, self.main_ui_negative_prompt, self.dropdown],
show_progress=False,
).then(fn=None, _js="function(){update_"+self.tabname+"_tokens(); closePopup();}", show_progress=False)
).then(fn=None, _js="function(){update_" + self.tabname + "_tokens(); closePopup();}", show_progress=False)

View File

@ -1267,7 +1267,8 @@ footer {
}
.popup-dialog {
width: 56em;
width: 60vw;
height: auto;
background: var(--body-background-fill) !important;
padding: 2em !important;
}