From 29d4f3733019e6ef6c6964a2dbdc0f8aaf5113ab Mon Sep 17 00:00:00 2001 From: AljazRant Date: Tue, 5 Aug 2025 11:08:24 +0200 Subject: [PATCH] Added another check to see if pipeline is set up correctly. --- niaaml_gui/main.py | 23 ++++++++++++++++++++++- tests/test_pipeline_canvas.py | 2 -- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/niaaml_gui/main.py b/niaaml_gui/main.py index 6b0f415..0207768 100644 --- a/niaaml_gui/main.py +++ b/niaaml_gui/main.py @@ -66,6 +66,27 @@ def __init__(self): self.errorMessage.setStandardButtons(QMessageBox.StandardButton.Ok) def run_pipeline(self): + + invalid_blocks = [] + + for block, info in self.pipelineCanvas.block_data.items(): + label = info.get("label", "") + if hasattr(block, "get_value"): + value = block.get_value() + elif hasattr(block, "dropdown"): + value = block.dropdown.currentText() + else: + value = info.get("path") or getattr(block, "value", None) + + if not value or (isinstance(value, str) and not value.strip()): + invalid_blocks.append(label) + + if invalid_blocks: + msg = "Pipeline isn't set up correctly. Missing components:\n\n" + "\n".join(f"- {label}" for label in invalid_blocks) + self.errorMessage.setText(msg) + self.errorMessage.exec() + return + blocks = self.pipelineCanvas.block_data if not blocks: self.errorMessage.setText("Pipeline is empty!") @@ -175,7 +196,7 @@ def validate_pipeline_ready(self): value = block.dropdown.currentText() else: value = info.get("path") or getattr(block, "value", None) - + if not value or (isinstance(value, str) and not value.strip()): all_valid = False break diff --git a/tests/test_pipeline_canvas.py b/tests/test_pipeline_canvas.py index 2899591..9110d2f 100644 --- a/tests/test_pipeline_canvas.py +++ b/tests/test_pipeline_canvas.py @@ -20,8 +20,6 @@ def test_pipeline_ready_false_when_empty(canvas): canvas.block_data.clear() canvas.scene.clear() - print("Block data keys:", canvas.block_data.keys()) - assert len(canvas.block_data) == 0 assert not canvas.is_pipeline_ready()