diff --git a/system/dataset.py b/system/dataset.py index d3dc22d..5823980 100644 --- a/system/dataset.py +++ b/system/dataset.py @@ -267,4 +267,4 @@ class Selection: """Handles selected identifiers along each dimension of a dataset""" def __init__(self): self.current_selection={} - + diff --git a/system/fluents.glade b/system/fluents.glade index 4a98dd8..a62b5d8 100644 --- a/system/fluents.glade +++ b/system/fluents.glade @@ -622,8 +622,107 @@ True - Log - False + _Log + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + True + 400 + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + GTK_SHADOW_IN + + + + True + create_selection_tree + 0 + 0 + Fri, 04 Aug 2006 12:42:10 GMT + + + + + + + True + False + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + GTK_SHADOW_IN + + + + True + create_identifier_list + 0 + 0 + Fri, 04 Aug 2006 12:42:25 GMT + + + + + + + True + True + + + + + False + True + + + + + + True + _Selections + True False GTK_JUSTIFY_LEFT False diff --git a/system/fluents.py b/system/fluents.py index 7da59d2..39baab5 100755 --- a/system/fluents.py +++ b/system/fluents.py @@ -12,7 +12,7 @@ import gnome import gnome.ui import scipy import pango -from system import project, workflow, dataset, logger, plots, navigator, dialogs +from system import project, workflow, dataset, logger, plots, navigator, dialogs, selections PROGRAM_NAME = 'fluents' @@ -31,6 +31,7 @@ class FluentApp: gtk.glade.set_custom_handler(self.custom_object_factory) self.widget_tree = gtk.glade.XML(GLADEFILENAME, 'appwindow') self.workflow = wf(self) + self['selection_tree'].set_identifier_list(self['identifier_list']) def init_gui(self): self['appwindow'].set_size_request(800, 600) @@ -69,6 +70,7 @@ class FluentApp: self.project = project self.workflow.add_project(self.project) self.navigator_view.add_project(self.project) + self['selection_tree'].set_project(self.project) def set_workflow(self, workflow): self.workflow = workflow @@ -130,6 +132,16 @@ class FluentApp: self.navigator_view.show() return self.navigator_view + def create_selection_tree(self, str1, str2, int1, int2): + self.selection_tree = selections.SelectionTree() + self.selection_tree.show() + return self.selection_tree + + def create_identifier_list(self, str1, str2, int1, int2): + self.identifier_list = selections.IdentifierList() + self.identifier_list.show() + return self.identifier_list + # Event handlers. # These methods are called by the gtk framework in response to events and # should not be called directly. diff --git a/system/navigator.py b/system/navigator.py index 74bdc61..959d09d 100644 --- a/system/navigator.py +++ b/system/navigator.py @@ -134,3 +134,4 @@ class NavigatorView (gtk.TreeView): else: t = type(obj) logger.log('debug', 'Activated datatype was %s. Don\'t know what to do.' % t) + diff --git a/system/project.py b/system/project.py index c2dfcd4..2d707b4 100644 --- a/system/project.py +++ b/system/project.py @@ -6,26 +6,40 @@ from system import dataset, plots class Project: def __init__(self,name="Testing"): - self.data_tree = gtk.TreeStore(gobject.TYPE_STRING, - gobject.TYPE_STRING, - gobject.TYPE_PYOBJECT,gobject.TYPE_STRING,gobject.TYPE_STRING, gobject.TYPE_DOUBLE) + self.data_tree = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_PYOBJECT, gobject.TYPE_STRING, + gobject.TYPE_STRING, gobject.TYPE_DOUBLE) self.name = name self.dim_names = [] self._selection_observers = [] + self._dataset_observers = [] self.current_data = [] self.datasets = [] self.sel_obj = dataset.Selection() - def notify_selection_listeners(self): + def add_selection_observer(self, observer): + self._selection_observers.append(observer) + observer.selection_changed(self.get_selection()) + + def notify_selection_listeners(self, dim_name): """Notifies observers""" for observer in self._selection_observers: observer.selection_changed(self.get_selection()) - def set_selection(self,dim_name,selection): + def add_dataset_observer(self, observer): + self._dataset_observers.append(observer) + observer.dataset_changed() + + def notify_dataset_listeners(self): + """Notifies observers when new datasets are added""" + for observer in self._dataset_observers: + observer.dataset_changed() + + def set_selection(self, dim_name, selection): """Sets a current selection and notify observers""" self.sel_obj.current_selection[dim_name] = set(selection) - self.notify_selection_listeners() + self.notify_selection_listeners(dim_name) def get_selection(self): """Returns the current selection object""" @@ -79,6 +93,7 @@ class Project: if dim_name not in self.dim_names: self.dim_names.append(dim_name) self.sel_obj.current_selection[dim_name] = set() + self.notify_dataset_listeners() def object_at(self, path): diff --git a/workflows/test_workflow.py b/workflows/test_workflow.py index 616bce7..1293fc2 100644 --- a/workflows/test_workflow.py +++ b/workflows/test_workflow.py @@ -110,8 +110,10 @@ class TestDataFunction(workflow.Function): graph.add_edge(x, y, 3) ds = dataset.GraphDataset(array(networkx.adj_matrix(graph))) ds_plot = plots.NetworkPlot(ds) + print ds.get_dim_name() - return [X, ds, plots.SinePlot(), p, ds_plot] + ds_scatter = plots.ScatterPlot(ds, ds, 'rows_0', 'rows_0', '0_1', '0_2') + return [X, ds, plots.SinePlot(), p, ds_plot, ds_scatter] class DatasetLog(workflow.Function): def __init__(self):