diff --git a/beat/editor/backend/assetmodel.py b/beat/editor/backend/assetmodel.py index 17388b7996dd6ba0af3567d176811297176c32e2..4235009921358ae029effa61be7b3a1589cc8b82 100644 --- a/beat/editor/backend/assetmodel.py +++ b/beat/editor/backend/assetmodel.py @@ -25,25 +25,28 @@ import os +from enum import Enum + from PyQt5.QtCore import pyqtSignal from PyQt5.QtCore import pyqtSlot from PyQt5.QtCore import pyqtProperty -from PyQt5.QtCore import Q_ENUMS from PyQt5.QtCore import QStringListModel -class AssetType: +class AssetType(Enum): """All possible assets available on the BEAT platform""" - Unknown = 0 - Algorithm = 1 - Database = 2 - Dataformat = 3 - Experiment = 4 - Library = 5 - Plotter = 6 - PlotterParameters = 7 - Toolchain = 8 + ( + Unknown, + Algorithm, + Database, + Dataformat, + Experiment, + Library, + Plotter, + PlotterParameters, + Toolchain, + ) = range(9) @classmethod def path(cls, type_): @@ -68,11 +71,9 @@ class AssetType: return path -class AssetModel(QStringListModel, AssetType): +class AssetModel(QStringListModel): """The asset model present a list of available asset from a given type""" - Q_ENUMS(AssetType) - assetTypeChanged = pyqtSignal(AssetType) prefixPathChanged = pyqtSignal(str) diff --git a/beat/editor/test/test_models.py b/beat/editor/test/test_models.py index 44c4a420b1f5081632a9e1583a0632c4028747ab..da67253247232f1c0992edc1b5d7c487156bec48 100644 --- a/beat/editor/test/test_models.py +++ b/beat/editor/test/test_models.py @@ -23,7 +23,7 @@ # # ############################################################################### -from ..backend.assetmodel import AssetModel +from ..backend.assetmodel import AssetModel, AssetType class TestAssetModel: @@ -31,7 +31,7 @@ class TestAssetModel: def test_model_load(self, qtbot, test_prefix): model = AssetModel() - asset_type = AssetModel.Dataformat + asset_type = AssetType.Dataformat with qtbot.waitSignals( [model.assetTypeChanged, model.prefixPathChanged] @@ -48,7 +48,7 @@ class TestAssetModel: def test_experiment_model_load(self, qtbot, test_prefix): model = AssetModel() - asset_type = AssetModel.Experiment + asset_type = AssetType.Experiment with qtbot.waitSignals( [model.assetTypeChanged, model.prefixPathChanged]