feat: refactor

This commit is contained in:
Anthony Fu 2023-10-16 15:00:17 +08:00
parent 8aa13d5dce
commit 3d15e58b0a
2 changed files with 13 additions and 7 deletions

View File

@ -77,12 +77,12 @@ class State:
log.info("Received skip request") log.info("Received skip request")
def interrupt(self): def interrupt(self):
if shared.opts.interrupt_after_current and self.job_count > 1: self.interrupted = True
self.interrupted_next = True log.info("Received interrupt request")
log.info("Received interrupt request, interrupt after current job")
else: def interrupt_next(self):
self.interrupted = True self.interrupted_next = True
log.info("Received interrupt request") log.info("Received interrupt request, interrupt after current job")
def nextjob(self): def nextjob(self):
if shared.opts.live_previews_enable and shared.opts.show_progress_every_n_steps == -1: if shared.opts.live_previews_enable and shared.opts.show_progress_every_n_steps == -1:

View File

@ -216,8 +216,14 @@ class Toprow:
outputs=[], outputs=[],
) )
def interrupt_fn():
if shared.state.job_count > 1 and shared.opts.interrupt_after_current:
shared.state.interrupt_next()
else:
shared.state.interrupt()
self.interrupt.click( self.interrupt.click(
fn=lambda: shared.state.interrupt(), fn=interrupt_fn,
inputs=[], inputs=[],
outputs=[], outputs=[],
) )