only make stop_button and skip_button interactive when rendering process starts
fix inconsistency in behaviour of stop_button and skip_button as it was possible to skip or stop other users processes while still being in queue
This commit is contained in:
parent
8f9f020e8f
commit
d3f9156854
20
webui.py
20
webui.py
@ -31,7 +31,9 @@ def generate_clicked(*args):
|
||||
yield gr.update(visible=True, value=modules.html.make_progress_html(1, 'Waiting for task to start ...')), \
|
||||
gr.update(visible=True, value=None), \
|
||||
gr.update(visible=False, value=None), \
|
||||
gr.update(visible=False)
|
||||
gr.update(visible=False), \
|
||||
gr.update(visible=True, interactive=True), \
|
||||
gr.update(visible=True, interactive=True)
|
||||
|
||||
worker.async_tasks.append(task)
|
||||
|
||||
@ -51,17 +53,23 @@ def generate_clicked(*args):
|
||||
yield gr.update(visible=True, value=modules.html.make_progress_html(percentage, title)), \
|
||||
gr.update(visible=True, value=image) if image is not None else gr.update(), \
|
||||
gr.update(), \
|
||||
gr.update(visible=False)
|
||||
gr.update(visible=False), \
|
||||
gr.update(visible=True), \
|
||||
gr.update(visible=True)
|
||||
if flag == 'results':
|
||||
yield gr.update(visible=True), \
|
||||
gr.update(visible=True), \
|
||||
gr.update(visible=True, value=product), \
|
||||
gr.update(visible=False)
|
||||
gr.update(visible=False), \
|
||||
gr.update(visible=True), \
|
||||
gr.update(visible=True)
|
||||
if flag == 'finish':
|
||||
yield gr.update(visible=False), \
|
||||
gr.update(visible=False), \
|
||||
gr.update(visible=False), \
|
||||
gr.update(visible=True, value=product)
|
||||
gr.update(visible=True, value=product), \
|
||||
gr.update(visible=False), \
|
||||
gr.update(visible=False)
|
||||
finished = True
|
||||
|
||||
execution_time = time.perf_counter() - execution_start_time
|
||||
@ -437,10 +445,10 @@ with shared.gradio_root:
|
||||
ctrls += [outpaint_selections, inpaint_input_image]
|
||||
ctrls += ip_ctrls
|
||||
|
||||
generate_button.click(lambda: (gr.update(visible=True, interactive=True), gr.update(visible=True, interactive=True), gr.update(visible=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \
|
||||
generate_button.click(lambda: (gr.update(visible=True, interactive=False), gr.update(visible=True, interactive=False), gr.update(visible=False), []), outputs=[stop_button, skip_button, generate_button, gallery]) \
|
||||
.then(fn=refresh_seed, inputs=[seed_random, image_seed], outputs=image_seed) \
|
||||
.then(advanced_parameters.set_all_advanced_parameters, inputs=adps) \
|
||||
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery]) \
|
||||
.then(fn=generate_clicked, inputs=ctrls, outputs=[progress_html, progress_window, progress_gallery, gallery, stop_button, skip_button]) \
|
||||
.then(lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)), outputs=[generate_button, stop_button, skip_button]) \
|
||||
.then(fn=lambda: None, _js='playNotification').then(fn=lambda: None, _js='refresh_grid_delayed')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user