Commit 0a43524a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[backend][assetmodel][AssetType] Changed enum keys to upper case to follow Python standard

parent 121f9bb6
......@@ -37,35 +37,35 @@ class AssetType(Enum):
"""All possible assets available on the BEAT platform"""
(
Unknown,
Algorithm,
Database,
Dataformat,
Experiment,
Library,
Plotter,
PlotterParameters,
Toolchain,
UNKNOWN,
ALGORITHM,
DATABASE,
DATAFORMAT,
EXPERIMENT,
LIBRARY,
PLOTTER,
PLOTTERPARAMETERS,
TOOLCHAIN,
) = range(9)
@classmethod
def path(cls, type_):
path = "unknown"
if type_ == cls.Algorithm:
if type_ == cls.ALGORITHM:
path = "algorithms"
elif type_ == cls.Database:
elif type_ == cls.DATABASE:
path = "databases"
elif type_ == cls.Dataformat:
elif type_ == cls.DATAFORMAT:
path = "dataformats"
elif type_ == cls.Experiment:
elif type_ == cls.EXPERIMENT:
path = "experiments"
elif type_ == cls.Library:
elif type_ == cls.LIBRARY:
path = "libraries"
elif type_ == cls.Plotter:
elif type_ == cls.PLOTTER:
path = "plotters"
elif type_ == cls.PlotterParameters:
elif type_ == cls.PLOTTERPARAMETERS:
path = "plotterparameters"
elif type_ == cls.Toolchain:
elif type_ == cls.TOOLCHAIN:
path = "toolchains"
return path
......@@ -83,13 +83,13 @@ class AssetModel(QStringListModel):
super(QStringListModel, self).__init__(parent)
self.__prefix_path = None
self.__asset_type = AssetType.Unknown
self.__asset_type = AssetType.UNKNOWN
@pyqtSlot()
def reload(self):
"""Loads the content regarding the asset property from the prefix"""
if not self.__prefix_path or self.__asset_type == AssetType.Unknown:
if not self.__prefix_path or self.__asset_type == AssetType.UNKNOWN:
return
asset_folder = os.path.join(
......@@ -100,7 +100,7 @@ class AssetModel(QStringListModel):
latest_assets_list = []
for asset_user in asset_users:
for asset_folder in os.scandir(asset_user):
if self.asset_type == AssetType.Experiment:
if self.asset_type == AssetType.EXPERIMENT:
for root, dirs, files in os.walk(asset_folder, topdown=False):
if dirs:
continue
......
......@@ -31,7 +31,7 @@ class TestAssetModel:
def test_model_load(self, qtbot, test_prefix):
model = AssetModel()
asset_type = AssetType.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 = AssetType.Experiment
asset_type = AssetType.EXPERIMENT
with qtbot.waitSignals(
[model.assetTypeChanged, model.prefixPathChanged]
......
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