From 373e3172d00419e15610f776faad82b8c53b4844 Mon Sep 17 00:00:00 2001 From: Acly Date: Sun, 10 Dec 2023 13:55:25 +0100 Subject: [PATCH] Add option to disable auto-preview on canvas #201 --- ai_diffusion/model.py | 2 +- ai_diffusion/settings.py | 5 +++++ ai_diffusion/ui/settings.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ai_diffusion/model.py b/ai_diffusion/model.py index 0fffb0efce..03d1e54773 100644 --- a/ai_diffusion/model.py +++ b/ai_diffusion/model.py @@ -261,7 +261,7 @@ def handle_message(self, message: ClientMessage): self.jobs.notify_finished(job) if job.kind is not JobKind.diffusion: self.jobs.remove(job) - elif job.kind is JobKind.diffusion and self._layer is None and job.id: + elif settings.auto_preview and self._layer is None and job.id: self.jobs.select(job.id, 0) elif message.event is ClientEvent.interrupted: job.state = JobState.cancelled diff --git a/ai_diffusion/settings.py b/ai_diffusion/settings.py index a1ececc977..cc76269ba6 100644 --- a/ai_diffusion/settings.py +++ b/ai_diffusion/settings.py @@ -125,6 +125,11 @@ class Settings(QObject): "Negative Prompt", False, "Show text editor to describe things to avoid" ) + auto_preview: bool + _auto_preview = Setting( + "Auto Preview", True, "Automatically preview the first generated result on the canvas" + ) + show_control_end: bool _show_control_end = Setting("Control ending step", False, "Show control ending step ratio") diff --git a/ai_diffusion/ui/settings.py b/ai_diffusion/ui/settings.py index dbd4872e91..0ce7846103 100644 --- a/ai_diffusion/ui/settings.py +++ b/ai_diffusion/ui/settings.py @@ -945,6 +945,7 @@ def __init__(self): self.add("prompt_line_count", SpinBoxSetting(S._prompt_line_count, self, 1, 10)) self.add("show_negative_prompt", CheckBoxSetting(S._show_negative_prompt, "Show", self)) self.add("show_control_end", CheckBoxSetting(S._show_control_end, "Show", self)) + self.add("auto_preview", CheckBoxSetting(S._auto_preview, "Enable", self)) self._layout.addStretch()