From 240d05cfb8a37a90ae4de03528d22b0320877a90 Mon Sep 17 00:00:00 2001 From: mmueller Date: Tue, 19 Nov 2024 11:39:02 +0100 Subject: [PATCH] run black, also check for positive prompt on settings change --- ai_diffusion/ui/custom_workflow.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ai_diffusion/ui/custom_workflow.py b/ai_diffusion/ui/custom_workflow.py index c5be5fecc..a2c354952 100644 --- a/ai_diffusion/ui/custom_workflow.py +++ b/ai_diffusion/ui/custom_workflow.py @@ -247,8 +247,16 @@ class PromptParamWidget(TextPromptWidget): value_changed = pyqtSignal() def __init__(self, param: CustomParam, parent: QWidget | None = None): - line_count = settings.prompt_line_count if param.kind is ParamKind.prompt_positive else TextPromptWidget._line_count - super().__init__(is_negative=param.kind is ParamKind.prompt_negative, line_count=line_count, parent=parent) + line_count = ( + settings.prompt_line_count + if param.kind is ParamKind.prompt_positive + else TextPromptWidget._line_count + ) + super().__init__( + is_negative=param.kind is ParamKind.prompt_negative, + line_count=line_count, + parent=parent, + ) assert isinstance(param.default, str) self.param = param @@ -270,9 +278,10 @@ def value(self, value: str): self.text = value def update_settings(self, key: str, value): - if key == "prompt_line_count": + if key == "prompt_line_count" and self.param.kind is ParamKind.prompt_positive: self.line_count = value + class ChoiceParamWidget(QComboBox): value_changed = pyqtSignal() @@ -717,7 +726,7 @@ def __init__(self): def _update_layout(self): stretch = 1 if self._outputs.is_visible else 0 self._layout.setStretchFactor(self._outputs, stretch) - + def _show_settings(self): Krita.instance().action("ai_diffusion_settings").trigger()