Skip to content

Commit

Permalink
Fix live mode polling after document is closed #538
Browse files Browse the repository at this point in the history
- also set live buttons (play/record) to their correct state when switching documents
  • Loading branch information
Acly committed Mar 29, 2024
1 parent fac4ea2 commit 9458cc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ai_diffusion/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def handle_job_finished(self, job: Job):
eventloop.run(_report_errors(self._model, self._continue_generating()))

async def _continue_generating(self):
while self.is_active:
while self.is_active and self._model.document.is_active:
new_input = await self._model._generate_live(self._last_input)
if new_input is not None: # frame was scheduled
self._last_input = new_input
Expand Down
2 changes: 2 additions & 0 deletions ai_diffusion/ui/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def model(self, model: Model):
model.progress_changed.connect(self.update_progress),
model.live.result_available.connect(self.show_result),
]
self.update_is_active()
self.update_is_recording()
self.control_list.model = model
self.preview_area.clear()

Expand Down

0 comments on commit 9458cc5

Please sign in to comment.