* fluent, *.py: Data and plots returned from functions will now show up in
the navigator window.
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
import dataset
|
||||
import plots
|
||||
import scipy
|
||||
import gobject
|
||||
import gtk
|
||||
|
||||
class Project:
|
||||
def __init__(self,name="Testing"):
|
||||
self.data_tree = gtk.TreeStore(gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING,
|
||||
gobject.TYPE_PYOBJECT)
|
||||
|
||||
self.name = name
|
||||
self.dim_names = []
|
||||
self._observers = {}
|
||||
@@ -39,6 +46,26 @@ class Project:
|
||||
"""Returns the current selection object"""
|
||||
return self.sel_obj.current_selection
|
||||
|
||||
def add_data(self, parent, data):
|
||||
"""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."""
|
||||
for d in data:
|
||||
if isinstance(d, dataset.Dataset):
|
||||
self.add_dataset(d)
|
||||
self.data_tree_insert(None, 'data', d)
|
||||
elif isinstance(d, plots.Plot):
|
||||
# self.add_view(d)
|
||||
self.data_tree_insert(None, 'view', d)
|
||||
|
||||
def data_tree_insert(self, parent, text, data):
|
||||
tree = self.data_tree
|
||||
iter = tree.append(parent)
|
||||
tree.set_value(iter, 0, text)
|
||||
tree.set_value(iter, 1, type(data))
|
||||
tree.set_value(iter, 2, data)
|
||||
|
||||
def add_dataset(self,dataset):
|
||||
"""Appends a new Dataset to the project."""
|
||||
self.datasets.append(dataset)
|
||||
@@ -52,6 +79,11 @@ class Project:
|
||||
dim_name = dim_name + "_t"
|
||||
return dim_name
|
||||
|
||||
|
||||
|
||||
def object_at(self, path):
|
||||
"Returns the object at a given path in the tree."
|
||||
iter = self.get_iter(path)
|
||||
object = self.get_value(iter, 2)
|
||||
if object:
|
||||
object.show()
|
||||
return object
|
||||
|
||||
|
Reference in New Issue
Block a user