mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-01 12:25:06 +08:00
make existing image browser extension not break
This commit is contained in:
parent
af547f63c3
commit
2922d8144f
@ -51,7 +51,14 @@ def image_from_url_text(filedata):
|
|||||||
|
|
||||||
|
|
||||||
def add_paste_fields(tabname, init_img, fields):
|
def add_paste_fields(tabname, init_img, fields):
|
||||||
paste_fields[tabname] = {"init_img":init_img, "fields": fields}
|
paste_fields[tabname] = {"init_img": init_img, "fields": fields}
|
||||||
|
|
||||||
|
# backwards compatibility for existing extensions
|
||||||
|
import modules.ui
|
||||||
|
if tabname == 'txt2img':
|
||||||
|
modules.ui.txt2img_paste_fields = fields
|
||||||
|
elif tabname == 'img2img':
|
||||||
|
modules.ui.img2img_paste_fields = fields
|
||||||
|
|
||||||
|
|
||||||
def create_buttons(tabs_list):
|
def create_buttons(tabs_list):
|
||||||
@ -154,7 +161,8 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def connect_paste(button, paste_fields, input_comp):
|
|
||||||
|
def connect_paste(button, paste_fields, input_comp, jsfunc=None):
|
||||||
def paste_func(prompt):
|
def paste_func(prompt):
|
||||||
if not prompt and not shared.cmd_opts.hide_ui_dir_config:
|
if not prompt and not shared.cmd_opts.hide_ui_dir_config:
|
||||||
filename = os.path.join(script_path, "params.txt")
|
filename = os.path.join(script_path, "params.txt")
|
||||||
@ -192,6 +200,7 @@ def connect_paste(button, paste_fields, input_comp):
|
|||||||
|
|
||||||
button.click(
|
button.click(
|
||||||
fn=paste_func,
|
fn=paste_func,
|
||||||
|
_js=jsfunc,
|
||||||
inputs=[input_comp],
|
inputs=[input_comp],
|
||||||
outputs=[x[0] for x in paste_fields],
|
outputs=[x[0] for x in paste_fields],
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user