Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ai_diffusion/language/new_language.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -592,4 +594,4 @@
"supported": null,
"{count} jobs queued.": null
}
}
}
5 changes: 5 additions & 0 deletions ai_diffusion/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 3 additions & 2 deletions ai_diffusion/ui/custom_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested it, but this looks like it would prevent applying an image completely, not just via double click, but also the apply button

Instead the conditional should be at the point where the handler is registered, ie. in HistoryWidget.__init__ where it says self.itemDoubleClicked

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
Expand Down
5 changes: 3 additions & 2 deletions ai_diffusion/ui/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"),
Expand Down
1 change: 1 addition & 0 deletions ai_diffusion/ui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down