Skip to content

Commit 63d763b

Browse files
authored
Merge pull request #39 from Aljaz-R/styling
Added another check to see if pipeline is set up correctly.
2 parents 5607374 + 29d4f37 commit 63d763b

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

niaaml_gui/main.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,27 @@ def __init__(self):
6666
self.errorMessage.setStandardButtons(QMessageBox.StandardButton.Ok)
6767

6868
def run_pipeline(self):
69+
70+
invalid_blocks = []
71+
72+
for block, info in self.pipelineCanvas.block_data.items():
73+
label = info.get("label", "")
74+
if hasattr(block, "get_value"):
75+
value = block.get_value()
76+
elif hasattr(block, "dropdown"):
77+
value = block.dropdown.currentText()
78+
else:
79+
value = info.get("path") or getattr(block, "value", None)
80+
81+
if not value or (isinstance(value, str) and not value.strip()):
82+
invalid_blocks.append(label)
83+
84+
if invalid_blocks:
85+
msg = "Pipeline isn't set up correctly. Missing components:\n\n" + "\n".join(f"- {label}" for label in invalid_blocks)
86+
self.errorMessage.setText(msg)
87+
self.errorMessage.exec()
88+
return
89+
6990
blocks = self.pipelineCanvas.block_data
7091
if not blocks:
7192
self.errorMessage.setText("Pipeline is empty!")
@@ -175,7 +196,7 @@ def validate_pipeline_ready(self):
175196
value = block.dropdown.currentText()
176197
else:
177198
value = info.get("path") or getattr(block, "value", None)
178-
199+
179200
if not value or (isinstance(value, str) and not value.strip()):
180201
all_valid = False
181202
break

tests/test_pipeline_canvas.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ def test_pipeline_ready_false_when_empty(canvas):
2020
canvas.block_data.clear()
2121
canvas.scene.clear()
2222

23-
print("Block data keys:", canvas.block_data.keys())
24-
2523
assert len(canvas.block_data) == 0
2624
assert not canvas.is_pipeline_ready()
2725

0 commit comments

Comments
 (0)