diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-09-27 06:57:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 06:57:16 +0000 |
commit | dbe072dcffd20c1d17d25b0cdde765cb9e7c74aa (patch) | |
tree | 34ee857142e1143ee3588eaf4a597fc207ce999d | |
parent | adbd26a68ff3e4fdfd410859048a3b12f2d80ff6 (diff) | |
parent | e4145c84537b563a4b0ad7d225764f8c446479b5 (diff) | |
download | stable-diffusion-webui-gfx803-dbe072dcffd20c1d17d25b0cdde765cb9e7c74aa.tar.gz stable-diffusion-webui-gfx803-dbe072dcffd20c1d17d25b0cdde765cb9e7c74aa.tar.bz2 stable-diffusion-webui-gfx803-dbe072dcffd20c1d17d25b0cdde765cb9e7c74aa.zip |
Merge pull request #1126 from AUTOMATIC1111/notification-sound
adds support for a notification.mp3 in the root directory that will play upon completion (fixes #1013)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | javascript/notification.js | 3 | ||||
-rw-r--r-- | modules/ui.py | 9 |
3 files changed, 10 insertions, 3 deletions
@@ -20,4 +20,5 @@ __pycache__ /interrogate /user.css /.idea +notification.mp3 /SwinIR diff --git a/javascript/notification.js b/javascript/notification.js index e8159a7e..bdf614ad 100644 --- a/javascript/notification.js +++ b/javascript/notification.js @@ -25,6 +25,9 @@ onUiUpdate(function(){ lastHeadImg = headImg; + // play notification sound if available + gradioApp().querySelector('#audio_notification audio')?.play(); + if (document.hasFocus()) return; // Multiple copies of the images are in the DOM when one is selected. Dedup with a Set to get the real number generated. diff --git a/modules/ui.py b/modules/ui.py index d2402e28..efd46708 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -564,13 +564,13 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with gr.TabItem('Inpaint', id='inpaint'):
init_img_with_mask = gr.Image(label="Image for inpainting with mask", show_label=False, elem_id="img2maskimg", source="upload", interactive=True, type="pil", tool="sketch", image_mode="RGBA")
- init_img_inpaint = gr.Image(label="Image for img2img", show_label=False, source="upload", interactive=True, type="pil", visible=False)
- init_mask_inpaint = gr.Image(label="Mask", source="upload", interactive=True, type="pil", visible=False)
+ init_img_inpaint = gr.Image(label="Image for img2img", show_label=False, source="upload", interactive=True, type="pil", visible=False, elem_id="img_inpaint_base")
+ init_mask_inpaint = gr.Image(label="Mask", source="upload", interactive=True, type="pil", visible=False, elem_id="img_inpaint_mask")
mask_blur = gr.Slider(label='Mask blur', minimum=0, maximum=64, step=1, value=4)
with gr.Row():
- mask_mode = gr.Radio(label="Mask mode", show_label=False, choices=["Draw mask", "Upload mask"], type="index", value="Draw mask")
+ mask_mode = gr.Radio(label="Mask mode", show_label=False, choices=["Draw mask", "Upload mask"], type="index", value="Draw mask", elem_id="mask_mode")
inpainting_mask_invert = gr.Radio(label='Masking mode', show_label=False, choices=['Inpaint masked', 'Inpaint not masked'], value='Inpaint masked', type="index")
inpainting_fill = gr.Radio(label='Masked content', choices=['fill', 'original', 'latent noise', 'latent nothing'], value='fill', type="index")
@@ -970,6 +970,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): for interface, label, ifid in interfaces:
with gr.TabItem(label, id=ifid):
interface.render()
+
+ if os.path.exists(os.path.join(script_path, "notification.mp3")):
+ audio_notification = gr.Audio(interactive=False, value=os.path.join(script_path, "notification.mp3"), elem_id="audio_notification", visible=False)
text_settings = gr.Textbox(elem_id="settings_json", value=lambda: opts.dumpjson(), visible=False)
settings_submit.click(
|