Commit c620eef3 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][experimenteditor] Use instance of ExperimentResource and implement refresh

parent 57e9c74a
......@@ -59,8 +59,8 @@ from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import AssetModel
from ..backend.resourcemodels import AlgorithmResourceModel
from ..backend.resourcemodels import ExperimentResources
from ..backend.resourcemodels import QueueResourceModel
from ..backend.resourcemodels import experiment_resources
from ..decorators import frozen
from ..utils import is_Qt_equal_or_higher
from .dialogs import AssetCreationDialog
......@@ -205,7 +205,7 @@ class DatasetModel(QStringListModel):
def __init__(self, parent=None):
super().__init__(parent)
def update(self):
def reload(self):
asset_model = AssetModel()
asset_model.asset_type = AssetType.DATABASE
asset_model.prefix_path = self.prefix_path
......@@ -227,7 +227,7 @@ class DatasetModel(QStringListModel):
def setPrefixPath(self, prefix_path):
self.prefix_path = prefix_path
self.update()
self.reload()
# ------------------------------------------------------------------------------
......@@ -1088,8 +1088,6 @@ class ExperimentEditor(AbstractAssetEditor):
self.setObjectName(self.__class__.__name__)
self.set_title(self.tr("Experiment"))
self.resource_model = ExperimentResources()
self.processing_env_model = EnvironmentModel()
self.dataset_model = DatasetModel()
......@@ -1131,8 +1129,6 @@ class ExperimentEditor(AbstractAssetEditor):
@pyqtSlot()
def __update(self):
self.resource_model.setContext(self.context)
for object_ in [
self.algorithm_model,
self.dataset_model,
......@@ -1159,6 +1155,13 @@ class ExperimentEditor(AbstractAssetEditor):
algorithms.add(editor.evaluator_properties_editor.algorithm)
self.globalparameters_widget.setup(algorithms)
def _asset_models(self):
"""Reimpl"""
# Here we use the fact that Python is weakly typed and reload
# the dataset model as well
return [self.algorithm_model, self.dataset_model]
def _createNewAsset(self, creation_type, asset_info):
"""Re-implement"""
......@@ -1277,7 +1280,7 @@ class ExperimentEditor(AbstractAssetEditor):
def _load_json(self, json_object):
"""Load the json object passed as parameter"""
self.resource_model.refresh()
experiment_resources.refresh()
for widget in [
self.datasets_widget,
......
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