Commit 144af3d7 authored by Samuel GAIST's avatar Samuel GAIST Committed by Samuel GAIST
Browse files

[widgets][algorithmeditor] Use DataFormatModel for dataformats edition

parent ee60f23d
......@@ -32,6 +32,7 @@ from beat.backend.python.algorithm import Algorithm
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..backend.assetmodel import DataFormatModel
from ..widgets.algorithmeditor import ALGORITHM_TYPE
from ..widgets.algorithmeditor import DEFAULT_API_VERSION
from ..widgets.algorithmeditor import DEFAULT_SCHEMA_VERSION
......@@ -70,12 +71,19 @@ def get_valid_algorithm(test_prefix):
@pytest.fixture()
def dataformat_model(test_prefix):
model = AssetModel()
model.asset_type = AssetType.DATAFORMAT
model = DataFormatModel()
model.prefix_path = test_prefix
return model
@pytest.fixture()
def full_dataformat_model(test_prefix):
model = DataFormatModel()
model.prefix_path = test_prefix
model.full_list_enabled = True
return model
@pytest.fixture(autouse=True)
def synced_prefix():
"""Re sync the prefix between test"""
......@@ -292,8 +300,8 @@ class TestResultEditor:
"""Test that the algorithm result editor works as expected"""
@pytest.fixture()
def editor(self, qtbot, dataformat_model):
editor = ResultEditor(dataformat_model)
def editor(self, qtbot, full_dataformat_model):
editor = ResultEditor(full_dataformat_model)
qtbot.addWidget(editor)
return editor
......
......@@ -50,6 +50,7 @@ from beat.backend.python.algorithm import Algorithm
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..backend.assetmodel import DataFormatModel
from ..backend.delegates import AssetItemDelegate
from ..decorators import frozen
from .editor import AbstractAssetEditor
......@@ -610,8 +611,10 @@ class AlgorithmEditor(AbstractAssetEditor):
self.add_result_button = QPushButton(self.tr("+"))
self.add_result_button.setFixedSize(30, 30)
self.dataformat_model = AssetModel()
self.dataformat_model.asset_type = AssetType.DATAFORMAT
self.dataformat_model = DataFormatModel()
self.full_dataformat_model = DataFormatModel()
self.full_dataformat_model.setFullListEnabled(True)
self.library_model = AssetModel()
self.library_model.asset_type = AssetType.LIBRARY
......@@ -696,6 +699,7 @@ class AlgorithmEditor(AbstractAssetEditor):
@pyqtSlot()
def __onContextChanged(self):
self.dataformat_model.setPrefixPath(self.prefix_path)
self.full_dataformat_model.setPrefixPath(self.prefix_path)
self.library_model.setPrefixPath(self.prefix_path)
@pyqtSlot()
......@@ -743,7 +747,7 @@ class AlgorithmEditor(AbstractAssetEditor):
self.parameter_list_widget.addWidget(editor)
def __addResult(self, name, configuration={}):
editor = ResultEditor(self.dataformat_model)
editor = ResultEditor(self.full_dataformat_model)
editor.setName(name)
if configuration:
editor.load(configuration)
......
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