Commit 59fcfc89 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[backend][assetmodel] Implement has_code setter in AssetType

This will allow handling between asset types with and without
code associated.
parent deb1d791
......@@ -34,6 +34,7 @@ from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import pyqtProperty
from PyQt5.QtCore import QStringListModel
from beat.backend.python import utils
from beat.core.schema import validate
from beat.cmdline import common
......@@ -170,6 +171,14 @@ class AssetType(Enum):
asset_folder = os.path.join(prefix, self.path)
return os.path.join(asset_folder, "{}.json".format(name))
def has_code(self):
"""Returns whether this asset type contains code"""
if self.klass is None:
return False
return issubclass(, utils.CodeStorage)
class AssetModel(QStringListModel):
"""The asset model present a list of available asset from a given type"""
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