Commit 7ffaec4f authored by Samuel GAIST's avatar Samuel GAIST

[widgets][experimenteditor] Renamed prefix modeling classes

The names are now less confusing with regard to their usage.
parent d0adcf6c
......@@ -60,8 +60,8 @@ from ..widgets.experimenteditor import EnvironmentModel
from ..widgets.experimenteditor import ExperimentEditor
from ..widgets.experimenteditor import typed_user_property
from ..widgets.experimenteditor import PrefixModel
from ..widgets.experimenteditor import AlgorithmModel
from ..widgets.experimenteditor import ExperimentResources
from ..widgets.experimenteditor import AlgorithmResourceModel
from .conftest import prefix
from .conftest import sync_prefix
......@@ -157,11 +157,11 @@ def choice_parameter_name(request):
# Tests
class TestPrefixModel:
class TestExperimentResources:
"""Test that the prefix modelisation generates the expected data"""
def test_model(self, beat_context):
model = PrefixModel(beat_context)
model = ExperimentResources(beat_context)
model = QSqlTableModel()
model.setTable("algorithms")
......@@ -177,15 +177,15 @@ class TestPrefixModel:
assert analyzer_count < total
class TestAlgorithmModel:
class TestAlgorithmResourceModel:
"""Test the model used to generate suitable algorithm selections"""
@pytest.fixture
def prefix_model(self, beat_context):
return PrefixModel(beat_context)
return ExperimentResources(beat_context)
def test_default(self, prefix_model):
algorithm_model = AlgorithmModel()
algorithm_model = AlgorithmResourceModel()
query = QSqlQuery()
assert query.exec_(
......@@ -197,7 +197,7 @@ class TestAlgorithmModel:
assert algorithm_model.rowCount() == query.value("cnt")
def test_analyzers(self, prefix_model):
algorithm_model = AlgorithmModel()
algorithm_model = AlgorithmResourceModel()
algorithm_model.setAnalyzerEnabled(True)
query = QSqlQuery()
......@@ -210,7 +210,7 @@ class TestAlgorithmModel:
assert algorithm_model.rowCount() == query.value("cnt")
def test_types(self, prefix_model):
algorithm_model = AlgorithmModel()
algorithm_model = AlgorithmResourceModel()
algorithm_model.setTypes(
[Algorithm.LEGACY, Algorithm.SEQUENTIAL, Algorithm.AUTONOMOUS]
)
......@@ -225,7 +225,7 @@ class TestAlgorithmModel:
assert algorithm_model.rowCount() == query.value("cnt")
def test_output_count(self, prefix_model):
algorithm_model = AlgorithmModel()
algorithm_model = AlgorithmResourceModel()
algorithm_model.setOutputCount(2)
query = QSqlQuery()
......@@ -238,7 +238,7 @@ class TestAlgorithmModel:
assert algorithm_model.rowCount() == query.value("cnt")
def test_input_count(self, prefix_model):
algorithm_model = AlgorithmModel()
algorithm_model = AlgorithmResourceModel()
algorithm_model.setInputCount(2)
query = QSqlQuery()
......@@ -251,7 +251,7 @@ class TestAlgorithmModel:
assert algorithm_model.rowCount() == query.value("cnt")
def test_input_output_count(self, prefix_model):
algorithm_model = AlgorithmModel()
algorithm_model = AlgorithmResourceModel()
algorithm_model.setInputCount(1)
algorithm_model.setOutputCount(1)
......@@ -265,7 +265,7 @@ class TestAlgorithmModel:
assert algorithm_model.rowCount() == query.value("cnt")
def test_input_output_count_and_types(self, prefix_model):
algorithm_model = AlgorithmModel()
algorithm_model = AlgorithmResourceModel()
algorithm_model.setInputCount(1)
algorithm_model.setOutputCount(1)
algorithm_model.setTypes([Algorithm.SEQUENTIAL])
......@@ -714,11 +714,11 @@ class TestExecutionPropertiesEditor(PropertiesEditorTestMixin, ParameterTestMixi
@pytest.fixture(autouse=True)
def prefix_model(self, beat_context):
return PrefixModel(beat_context)
return ExperimentResources(beat_context)
@pytest.fixture()
def algorithm_model(self):
return AlgorithmModel()
return AlgorithmResourceModel()
@pytest.fixture()
def properties_editor(self, beat_context, test_prefix, algorithm_model):
......@@ -726,7 +726,7 @@ class TestExecutionPropertiesEditor(PropertiesEditorTestMixin, ParameterTestMixi
environment_model.setContext(beat_context)
editor = self.editor_klass(test_prefix)
editor.setAlgorithmModel(algorithm_model)
editor.setAlgorithmResourceModel(algorithm_model)
editor.setEnvironmentModel(environment_model)
editor.setQueueModel(QStringListModel(["Test"]))
return editor
......
......@@ -224,7 +224,7 @@ class DatasetModel(QStringListModel):
# Prefix modelization
class PrefixModel:
class ExperimentResources:
def __init__(self, context=None):
self.context = context
......@@ -295,7 +295,7 @@ class PrefixModel:
)
class AlgorithmModel(QSqlTableModel):
class AlgorithmResourceModel(QSqlTableModel):
def __init__(self, parent=None):
super().__init__(parent=parent)
......@@ -794,7 +794,7 @@ class ExecutionPropertiesEditor(AbstractBaseEditor):
algorithm = pyqtProperty(str, fget=algorithm, notify=algorithmChanged)
def setAlgorithmModel(self, model):
def setAlgorithmResourceModel(self, model):
self.algorithm_model = model
self.algorithm_combobox.setModel(self.algorithm_model)
......@@ -885,7 +885,7 @@ class AbstractBlockEditor(AbstractBaseEditor):
self.block_name = block_name
def setAlgorithmModel(self, model):
def setAlgorithmResourceModel(self, model):
"""Set algorithm model"""
raise NotImplementedError
......@@ -905,14 +905,14 @@ class BlockEditor(AbstractBlockEditor):
def __init__(self, block_name, prefix_path, parent=None):
super().__init__(block_name, prefix_path, parent)
self.algorithm_model = AlgorithmModel()
self.algorithm_model = AlgorithmResourceModel()
self.algorithm_model.setAnalyzerEnabled(False)
self.algorithm_model.setTypes(
[Algorithm.LEGACY, Algorithm.SEQUENTIAL, Algorithm.AUTONOMOUS]
)
self.properties_editor = ExecutionPropertiesEditor(prefix_path)
self.properties_editor.setAlgorithmModel(self.algorithm_model)
self.properties_editor.setAlgorithmResourceModel(self.algorithm_model)
layout = QVBoxLayout(self)
layout.addWidget(QLabel(self.block_name))
......@@ -953,22 +953,22 @@ class LoopBlockEditor(AbstractBlockEditor):
def __init__(self, block_name, prefix_path, parent=None):
super().__init__(block_name, prefix_path, parent)
self.processor_model = AlgorithmModel()
self.processor_model = AlgorithmResourceModel()
self.processor_model.setAnalyzerEnabled(False)
self.processor_model.setTypes(
[Algorithm.AUTONOMOUS_LOOP_PROCESSOR, Algorithm.SEQUENTIAL_LOOP_PROCESSOR]
)
self.evaluator_model = AlgorithmModel()
self.evaluator_model = AlgorithmResourceModel()
self.evaluator_model.setAnalyzerEnabled(False)
self.evaluator_model.setTypes(
[Algorithm.AUTONOMOUS_LOOP_EVALUATOR, Algorithm.SEQUENTIAL_LOOP_EVALUATOR]
)
self.processor_properties_editor = ExecutionPropertiesEditor(prefix_path)
self.processor_properties_editor.setAlgorithmModel(self.processor_model)
self.processor_properties_editor.setAlgorithmResourceModel(self.processor_model)
self.evaluator_properties_editor = ExecutionPropertiesEditor(prefix_path)
self.evaluator_properties_editor.setAlgorithmModel(self.evaluator_model)
self.evaluator_properties_editor.setAlgorithmResourceModel(self.evaluator_model)
self.evaluator_properties_editor.setQueueEnabled(False)
processor_groupbox = QGroupBox(self.tr("Processor"))
......@@ -1193,7 +1193,7 @@ class ExperimentEditor(AbstractAssetEditor):
self.setObjectName(self.__class__.__name__)
self.set_title(self.tr("Experiment"))
self.prefix_model = PrefixModel()
self.prefix_model = ExperimentResources()
self.processing_env_model = EnvironmentModel()
self.queue_model = QStringListModel()
......
Markdown is supported
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