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

[widgets][experimenteditor] Add output filter to DatasetModel

This will allow only datasets with matching outputs to
be listed when configuring an experiment.
parent 1299c119
......@@ -205,6 +205,8 @@ class DatasetModel(QStringListModel):
def __init__(self, parent=None):
super().__init__(parent)
self.outputs = []
def reload(self):
asset_model = AssetModel()
asset_model.asset_type = AssetType.DATABASE
......@@ -219,16 +221,27 @@ class DatasetModel(QStringListModel):
if not db.valid:
continue
for protocol in db.protocol_names:
for set_name in db.set_names(protocol):
for set_name, set_data in db.sets(protocol).items():
if (
self.outputs
and list(set_data["outputs"].keys()) != self.outputs
):
continue
available_set_names.append(
"{}/{}/{}".format(database, protocol, set_name)
)
self.setStringList(available_set_names)
def setPrefixPath(self, prefix_path):
self.prefix_path = prefix_path
self.reload()
def setupOuputFilter(self, output_filter):
self.outputs = output_filter
self.reload()
# ------------------------------------------------------------------------------
......
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