From 11dcb3e6bc35183de462529d498ab6beef585733 Mon Sep 17 00:00:00 2001 From: Acly Date: Mon, 28 Oct 2024 14:18:32 +0100 Subject: [PATCH] Fix custom workflow UI reserving space for text outputs when there are none --- ai_diffusion/resources.py | 2 +- ai_diffusion/ui/custom_workflow.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ai_diffusion/resources.py b/ai_diffusion/resources.py index 94b04bb33..be4d3f839 100644 --- a/ai_diffusion/resources.py +++ b/ai_diffusion/resources.py @@ -39,7 +39,7 @@ class CustomNode(NamedTuple): "External Tooling Nodes", "comfyui-tooling-nodes", "https://github.com/Acly/comfyui-tooling-nodes", - "19337dcc0e9ec56b3b4eca463090de55335a94fe", + "e86973fedfba49f48786ed6d9b8f0e5e1d093f25", ["ETN_LoadImageBase64", "ETN_LoadMaskBase64", "ETN_SendImageWebSocket", "ETN_Translate"], ), CustomNode( diff --git a/ai_diffusion/ui/custom_workflow.py b/ai_diffusion/ui/custom_workflow.py index 0dfe4b6a8..c8e5357ad 100644 --- a/ai_diffusion/ui/custom_workflow.py +++ b/ai_diffusion/ui/custom_workflow.py @@ -415,6 +415,10 @@ def value(self, value: dict[str, TextOutput]): self._value = value self._update() + @property + def is_visible(self): + return self._scroll_area.isVisible() + def _update(self): if len(self._value) == 0: self.expander.hide() @@ -422,7 +426,7 @@ def _update(self): return elif not self.expander.isVisible(): self.expander.show() - self._scroll_area.show() + self._scroll_area.setVisible(self.expander.isChecked()) widget = QWidget(self._scroll_area) layout = QGridLayout() @@ -618,7 +622,7 @@ def __init__(self): self._layout.addLayout(actions_layout) self._layout.addWidget(self._progress_bar) self._layout.addWidget(self._error_text) - self._layout.addWidget(self._outputs, stretch=1) + self._layout.addWidget(self._outputs, stretch=0) self._layout.addWidget(self._history, stretch=3) self._layout.addWidget(self._live_preview, stretch=5) self.setLayout(self._layout) @@ -626,7 +630,7 @@ def __init__(self): self._update_ui() def _update_layout(self): - stretch = 1 if self._outputs.expander.isChecked() else 0 + stretch = 1 if self._outputs.is_visible else 0 self._layout.setStretchFactor(self._outputs, stretch) @property @@ -642,6 +646,7 @@ def model(self, model: Model): bind(model, "workspace", self._workspace_select, "value", Bind.one_way), bind_combo(model.custom, "workflow_id", self._workflow_select, Bind.one_way), bind(model.custom, "outputs", self._outputs, "value", Bind.one_way), + model.custom.outputs_changed.connect(self._update_layout), model.workspace_changed.connect(self._cancel_name), model.custom.graph_changed.connect(self._update_current_workflow), model.error_changed.connect(self._error_text.setText),