diff --git a/system/project.py b/system/project.py index f3ff054..5356b55 100644 --- a/system/project.py +++ b/system/project.py @@ -57,21 +57,22 @@ class Project: self.data_tree.foreach(is_obj, retval) return retval[-1] - def add_data(self, parent, data): + def add_data(self, parent, data, fun='Function'): """Adds a set of data and plots to the navigator. This method is usually called after a Function in a workflow has finished and returns its output.""" parent_iter = self.get_data_iter(parent) + it = self.data_tree_insert(parent_iter, fun, None) for d in data: if isinstance(d, dataset.Dataset): self.add_dataset(d) - self.data_tree_insert(parent_iter, d.get_name(), d) + self.data_tree_insert(it, d.get_name(), d) elif isinstance(d, plots.Plot): # self.add_view(d) - self.data_tree_insert(parent_iter, d.get_title(), d) + self.data_tree_insert(it, d.get_title(), d) d.set_project(self) self.attach(d, 'selection_update') @@ -81,6 +82,7 @@ class Project: tree.set_value(it, 0, text) tree.set_value(it, 1, type(data)) tree.set_value(it, 2, data) + return it def add_dataset(self,dataset): """Appends a new Dataset to the project.""" @@ -101,3 +103,4 @@ class Project: def set_current_data(self, obj): self.current_data = obj + diff --git a/system/workflow.py b/system/workflow.py index 582cac9..62dc41d 100644 --- a/system/workflow.py +++ b/system/workflow.py @@ -120,7 +120,7 @@ class WorkflowView (gtk.VBox): new_data = function.run(project.current_data) if new_data != None: - project.add_data(parent_data, new_data) + project.add_data(parent_data, new_data, function.name) logger.log('debug', 'Function ended: %s' % function.name) diff --git a/workflows/go_workflow.py b/workflows/go_workflow.py index 82df27e..97d7908 100644 --- a/workflows/go_workflow.py +++ b/workflows/go_workflow.py @@ -117,7 +117,9 @@ class DatasetLog(workflow.Function): logger.log('notice', 'Taking the log of dataset %s' % data.get_name()) d = data.asarray() d = log(d) - return [dataset.Dataset(d)] + new_data_name = 'log(%s)' % data.get_name() + ds = dataset.Dataset(d, name=new_data_name) + return [ds] class DatasetLoadFunction(workflow.Function): """Loader for previously pickled Datasets."""