diff --git a/ai_diffusion/language/new_language.json.template b/ai_diffusion/language/new_language.json.template index cbf397817..b95111c5f 100644 --- a/ai_diffusion/language/new_language.json.template +++ b/ai_diffusion/language/new_language.json.template @@ -150,6 +150,7 @@ "Document must be saved before generating an animation.": null, "Document:": null, "Documentation and Support": null, + "Double Click": null, "Download and Install": null, "Downloading package...": null, "Dump Workflow": null, @@ -160,6 +161,7 @@ "Edit canvas with text instructions": null, "Edit custom presets": null, "Enable Automatic Updates": null, + "Enable double clicking the preview to apply it.": null, "Enable SAG / Self-Attention Guidance": null, "Enable text completion for tags from the selected files": null, "Enable this if the checkpoint is a v-prediction model which requires zero terminal SNR noise schedule": null, @@ -592,4 +594,4 @@ "supported": null, "{count} jobs queued.": null } -} \ No newline at end of file +} diff --git a/ai_diffusion/settings.py b/ai_diffusion/settings.py index cb14366c2..db48b0276 100644 --- a/ai_diffusion/settings.py +++ b/ai_diffusion/settings.py @@ -363,6 +363,11 @@ class Settings(QObject): "Apply Region Behavior (Live)", ApplyRegionBehavior.replace ) + preview_double_click_apply: bool + _preview_double_click_apply = Setting( + _("Double Click"), True, _("Enable double clicking the preview to apply it.") + ) + show_builtin_styles: bool _show_builtin_styles = Setting(_("Show pre-installed styles"), True) diff --git a/ai_diffusion/ui/custom_workflow.py b/ai_diffusion/ui/custom_workflow.py index 2bf3af183..d247c0f7e 100644 --- a/ai_diffusion/ui/custom_workflow.py +++ b/ai_diffusion/ui/custom_workflow.py @@ -965,8 +965,9 @@ def _splitter_moved(self, pos: int, index: int): self.model.custom.params_ui_height = self._splitter.sizes()[0] def apply_result(self, item: QListWidgetItem): - job_id, index = self._history.item_info(item) - self.model.apply_generated_result(job_id, index) + if settings.preview_double_click_apply: + job_id, index = self._history.item_info(item) + self.model.apply_generated_result(job_id, index) def apply_live_result(self): image, params = self.model.custom.live_result diff --git a/ai_diffusion/ui/generation.py b/ai_diffusion/ui/generation.py index 4393476c3..9dfa13ae7 100644 --- a/ai_diffusion/ui/generation.py +++ b/ai_diffusion/ui/generation.py @@ -859,8 +859,9 @@ def model(self, model: Model): self.update_generate_options() def apply_result(self, item: QListWidgetItem): - job_id, index = self.history.item_info(item) - self.model.apply_generated_result(job_id, index) + if settings.preview_double_click_apply: + job_id, index = self.history.item_info(item) + self.model.apply_generated_result(job_id, index) _inpaint_text: ClassVar[dict[InpaintMode, str]] = { InpaintMode.automatic: _("Default (Auto-detect)"), diff --git a/ai_diffusion/ui/settings.py b/ai_diffusion/ui/settings.py index 18c4270f7..0752c6b9f 100644 --- a/ai_diffusion/ui/settings.py +++ b/ai_diffusion/ui/settings.py @@ -734,6 +734,7 @@ def __init__(self): "generation_finished_action", ComboBoxSetting(S._generation_finished_action, parent=self), ) + self.add("preview_double_click_apply", SwitchSetting(S._preview_double_click_apply, parent=self)) self.add("apply_behavior", ComboBoxSetting(S._apply_behavior, parent=self)) self.add("apply_region_behavior", ComboBoxSetting(S._apply_region_behavior, parent=self)) self.add("apply_behavior_live", ComboBoxSetting(S._apply_behavior_live, parent=self))