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

[backend][assetmodel] Add option to allow listing of all versions

parent 0b139605
......@@ -167,9 +167,16 @@ class AssetModel(QStringListModel):
super(QStringListModel, self).__init__(parent)
self.__latest_only = True
self.__prefix_path = None
self.__asset_type = AssetType.UNKNOWN
def setLatestOnlyEnabled(self, enabled):
if self.__latest_only == enabled:
return
self.__latest_only = enabled
self.reload()
@pyqtSlot()
def reload(self):
"""Loads the content regarding the asset property from the prefix"""
......@@ -197,11 +204,20 @@ class AssetModel(QStringListModel):
for asset_folder in os.scandir(self.asset_folder):
json_files = _find_json_files(asset_folder)
if json_files:
latest_assets_list.append(
"{name}/{version}".format(
name=asset_folder.name, version=json_files[-1].split(".")[0]
if self.__latest_only:
latest_assets_list.append(
"{name}/{version}".format(
name=asset_folder.name,
version=json_files[-1].split(".")[0],
)
)
)
else:
for item in json_files:
latest_assets_list.append(
"{name}/{version}".format(
name=asset_folder.name, version=item.split(".")[0]
)
)
else:
# Assets belonging to a user
asset_users = os.scandir(self.asset_folder)
......
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