Commit 38ef09fa authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][algorithmeditor] Add support for the two new loop user types

The loop_user type has been changed in sequential and
autonomous types.

This updates fixes the editor to support them.
parent 19172d9a
Pipeline #31884 passed with stage
in 10 minutes and 47 seconds
......@@ -167,9 +167,12 @@ class TestPropertyEditor:
assert editor.canBeSplitable()
assert editor.splittable_checkbox.isEnabled()
# Make the list in an order different than the one they were put in the
# group otherwise, dataChanged won't be emitted
for button in [
editor.sequential_loopuser_radiobutton,
editor.autonomous_loopuser_radiobutton,
editor.autonomous_radiobutton,
editor.loopuser_radiobutton,
editor.sequential_radiobutton,
]:
with qtbot.waitSignal(editor.dataChanged):
......@@ -210,7 +213,8 @@ class TestPropertyEditor:
("sequential", False),
("autonomous", False),
("loop", True),
("loop_user", True),
("autonomous_loop_user", True),
("sequential_loop_user", True),
],
)
def test_has_loop(self, qtbot, algorithm_type, has_loop):
......@@ -231,7 +235,8 @@ class TestPropertyEditor:
("sequential", DEFAULT_SCHEMA_VERSION),
("autonomous", DEFAULT_SCHEMA_VERSION),
("loop", 3),
("loop_user", 3),
("sequential_loop_user", 3),
("autonomous_loop_user", 3),
],
)
def test_schema_version(self, qtbot, algorithm_type, schema_version):
......@@ -385,7 +390,11 @@ class TestGroupEditor:
groups = reference_json.pop("groups", {})
editor = GroupEditor(model)
qtbot.addWidget(editor)
is_loop = reference_json.get("type") in ["loop", "loop_user"]
is_loop = reference_json.get("type") in [
"loop",
"autonomous_loop_user",
"sequential_loop_user",
]
has_no_output = (
reference_json.get("type") == "loop" or "results" in reference_json
)
......@@ -397,7 +406,6 @@ class TestGroupEditor:
editor.setOutputsEnabled(False)
editor.setLoopEnabled(is_loop)
assert editor.dump() == group
......
......@@ -158,8 +158,18 @@ class PropertyEditor(QWidget):
self.sequential_radiobutton.setProperty(ALGORITHM_TYPE, "sequential")
self.autonomous_radiobutton = QRadioButton(self.tr("Autonomous"))
self.autonomous_radiobutton.setProperty(ALGORITHM_TYPE, "autonomous")
self.loopuser_radiobutton = QRadioButton(self.tr("Loop user"))
self.loopuser_radiobutton.setProperty(ALGORITHM_TYPE, "loop_user")
self.sequential_loopuser_radiobutton = QRadioButton(
self.tr("Sequential loop user")
)
self.sequential_loopuser_radiobutton.setProperty(
ALGORITHM_TYPE, "sequential_loop_user"
)
self.autonomous_loopuser_radiobutton = QRadioButton(
self.tr("Autonomous loop user")
)
self.autonomous_loopuser_radiobutton.setProperty(
ALGORITHM_TYPE, "autonomous_loop_user"
)
self.loop_radiobutton = QRadioButton(self.tr("Loop"))
self.loop_radiobutton.setProperty(ALGORITHM_TYPE, "loop")
......@@ -168,7 +178,8 @@ class PropertyEditor(QWidget):
for button in [
self.sequential_radiobutton,
self.autonomous_radiobutton,
self.loopuser_radiobutton,
self.sequential_loopuser_radiobutton,
self.autonomous_loopuser_radiobutton,
self.loop_radiobutton,
]:
self.button_group.addButton(button)
......@@ -185,7 +196,8 @@ class PropertyEditor(QWidget):
for widget in [
self.splittable_checkbox,
self.loopuser_radiobutton,
self.sequential_loopuser_radiobutton,
self.autonomous_loopuser_radiobutton,
self.loop_radiobutton,
]:
self.analyzer_checkbox.toggled.connect(
......@@ -230,7 +242,8 @@ class PropertyEditor(QWidget):
def hasLoop(self):
return self.button_group.checkedButton() in [
self.loop_radiobutton,
self.loopuser_radiobutton,
self.sequential_loopuser_radiobutton,
self.autonomous_loopuser_radiobutton,
]
def canBeSplitable(self):
......@@ -261,7 +274,8 @@ class PropertyEditor(QWidget):
schema_version = self.schema_version
if self.button_group.checkedButton() in [
self.loop_radiobutton,
self.loopuser_radiobutton,
self.sequential_loopuser_radiobutton,
self.autonomous_loopuser_radiobutton,
]:
schema_version = 3
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment