Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Automatically load all datasets in the root data directory and add them to

navigator when project is loaded.

Recursion down in data hierarchy is not yet implemented.
This commit is contained in:
Einar Ryeng 2011-06-02 13:16:10 +00:00
parent e21cd7b323
commit 1c0ea0caee
1 changed files with 17 additions and 0 deletions

View File

@ -32,6 +32,23 @@ class ProjectView:
self.selections = [] self.selections = []
self._last_selection = None self._last_selection = None
self._dataset_iter_map = {} self._dataset_iter_map = {}
self._load_datasets()
def _load_datasets(self):
print "load datasets from project..."
print self.project.data.datasets
for ds in self.project.data.datasets:
if isinstance(ds, dataset.GraphDataset):
icon = laydi.icon_factory.get("graph_dataset")
elif isinstance(ds, dataset.CategoryDataset):
icon = laydi.icon_factory.get("category_dataset")
else:
icon = laydi.icon_factory.get("dataset")
self.add_dataset(ds)
self.data_tree_insert(None, ds.get_name(), ds, None, "black", icon)
print "...loaded"
def add_selection_observer(self, observer): def add_selection_observer(self, observer):
self._selection_observers.append(observer) self._selection_observers.append(observer)