forgot to clear neg prompt after moving to back. Add tooltip to hints

This commit is contained in:
papuSpartan 2022-10-21 17:24:04 -05:00
parent 0c7cf08b3d
commit 700340448b
3 changed files with 10 additions and 9 deletions

View file

@ -17,6 +17,7 @@ titles = {
"\u2199\ufe0f": "Read generation parameters from prompt or last generation if prompt is empty into user interface.",
"\u{1f4c2}": "Open images output directory",
"\u{1f4be}": "Save style",
"\U0001F5D1": "Clear prompt"
"\u{1f4cb}": "Apply selected styles to current prompt",
"Inpaint a part of image": "Draw a mask over an image, and the script will regenerate the masked area with content according to prompt",

View file

@ -162,7 +162,7 @@ function selected_tab_id() {
}
function clear_prompt(_, confirmed,_steps) {
function clear_prompt(_, _prompt_neg, confirmed,_steps) {
if(confirm("Delete prompt?")) {
confirmed = true
@ -176,7 +176,7 @@ return [_, confirmed]
update_token_counter("txt2img_token_button")
}
return [_, confirmed,_steps]
return [_, _prompt_neg, confirmed,_steps]
}

View file

@ -429,19 +429,19 @@ def create_seed_inputs():
return seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox
def clear_prompt(_prompt, confirmed, _token_counter):
def clear_prompt(_prompt, _prompt_neg, confirmed, _token_counter):
"""Given confirmation from a user on the client-side, go ahead with clearing prompt"""
if confirmed:
return ["", confirmed, update_token_counter("", 1)]
return ["", "", confirmed, update_token_counter("", 1)]
def connect_clear_prompt(button, prompt, _dummy_confirmed, token_counter):
def connect_clear_prompt(button, prompt, prompt_neg, _dummy_confirmed, token_counter):
"""Given clear button, prompt, and token_counter objects, setup clear prompt button click event"""
button.click(
_js="clear_prompt",
fn=clear_prompt,
inputs=[prompt, _dummy_confirmed, token_counter],
outputs=[prompt, _dummy_confirmed, token_counter],
inputs=[prompt, prompt_neg, _dummy_confirmed, token_counter],
outputs=[prompt, prompt_neg, _dummy_confirmed, token_counter],
)
@ -723,7 +723,7 @@ def create_ui(wrap_gradio_gpu_call):
connect_reuse_seed(seed, reuse_seed, generation_info, dummy_component, is_subseed=False)
connect_reuse_seed(subseed, reuse_subseed, generation_info, dummy_component, is_subseed=True)
connect_clear_prompt(clear_prompt_button, txt2img_prompt, dummy_component, token_counter)
connect_clear_prompt(clear_prompt_button, txt2img_prompt, txt2img_negative_prompt, dummy_component, token_counter)
txt2img_args = dict(
fn=wrap_gradio_gpu_call(modules.txt2img.txt2img),
@ -961,7 +961,7 @@ def create_ui(wrap_gradio_gpu_call):
connect_reuse_seed(seed, reuse_seed, generation_info, dummy_component, is_subseed=False)
connect_reuse_seed(subseed, reuse_subseed, generation_info, dummy_component, is_subseed=True)
connect_clear_prompt(clear_prompt_button, img2img_prompt, dummy_component, token_counter)
connect_clear_prompt(clear_prompt_button, img2img_prompt, img2img_negative_prompt, dummy_component, token_counter)
img2img_prompt_img.change(
fn=modules.images.image_data,