Skip to content

Commit

Permalink
run black, also check for positive prompt on settings change
Browse files Browse the repository at this point in the history
  • Loading branch information
mmuellerdm committed Nov 19, 2024
1 parent c22c89d commit 240d05c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions ai_diffusion/ui/custom_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()

Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 240d05c

Please sign in to comment.