Skip to content

Commit

Permalink
Simplified stopping generate forever
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonRide303 committed Oct 16, 2023
1 parent 20b13b6 commit 4e1441c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions javascript/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ var appendContextMenuOption = initResponse[0];
var removeContextMenuOption = initResponse[1];
var addContextMenuEventListener = initResponse[2];

let cancelGenerateForever = function() {
clearInterval(window.generateOnRepeatInterval);
};

(function() {
//Start example Context Menu Items
let generateOnRepeat = function(genbuttonid, interruptbuttonid) {
Expand All @@ -154,13 +158,8 @@ var addContextMenuEventListener = initResponse[2];
appendContextMenuOption('#generate_button', 'Generate forever', generateOnRepeatForButtons);
appendContextMenuOption('#stop_button', 'Generate forever', generateOnRepeatForButtons);

let cancelGenerateForever = function() {
clearInterval(window.generateOnRepeatInterval);
};

appendContextMenuOption('#stop_button', 'Cancel generate forever', cancelGenerateForever);
appendContextMenuOption('#generate_button', 'Cancel generate forever', cancelGenerateForever);

// appendContextMenuOption('#stop_button', 'Cancel generate forever', cancelGenerateForever);
// appendContextMenuOption('#generate_button', 'Cancel generate forever', cancelGenerateForever);
})();
//End example Context Menu Items

Expand Down
2 changes: 1 addition & 1 deletion webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def skip_clicked():
model_management.interrupt_current_processing()
return

stop_button.click(stop_clicked, outputs=[skip_button, stop_button], queue=False)
stop_button.click(stop_clicked, outputs=[skip_button, stop_button], queue=False, _js='cancelGenerateForever')
skip_button.click(skip_clicked, queue=False)
with gr.Row(elem_classes='advanced_check_row'):
input_image_checkbox = gr.Checkbox(label='Input Image', value=False, container=False, elem_classes='min_check')
Expand Down

0 comments on commit 4e1441c

Please sign in to comment.