From 87f87e36c8af47ffe06bb400fd20ba40c8956578 Mon Sep 17 00:00:00 2001 From: einarr Date: Fri, 21 Jul 2006 14:30:09 +0000 Subject: [PATCH] * system/fluents.py: Fixed a bug where the the application tried to load a toolbar from None * system/plots.py: Fixed MainView.insert_view that was a no-op when in large view. * system/dataset.py: Changed __str__ of dataset to also show names of dimensions. --- system/dataset.py | 8 +++----- system/fluents.py | 10 ++++++++-- system/plots.py | 5 ++++- workflows/{go_workflow.py => test_workflow.py} | 11 ++++++----- 4 files changed, 21 insertions(+), 13 deletions(-) rename workflows/{go_workflow.py => test_workflow.py} (96%) diff --git a/system/dataset.py b/system/dataset.py index 2362d9b..d4918be 100644 --- a/system/dataset.py +++ b/system/dataset.py @@ -1,4 +1,3 @@ -from system import logger from scipy import atleast_2d,asarray,ArrayType @@ -55,7 +54,6 @@ class Dataset: self.shape = array.shape if shape != None: if self.shape!=shape: - #logger.log("debug","Dataset and input shape mismatch") raise ValueError, "Differing in array and provided. %s != %s" % (self.shape, shape) if identifiers!=None: self._set_identifiers(identifiers,all_dims) @@ -71,8 +69,8 @@ class Dataset: self._all_dims = all_dims - def __str__self(self): - return self._name + def __str__(self): + return self._name + ":" + self._dims.__str__() def __iter__(self): """Returns an iterator over dimensions of dataset.""" @@ -193,7 +191,6 @@ class Dataset: reverse[value] = key return [self._map[dim][key] for key in idents] - class CategoryDataset(Dataset): """The category dataset class. @@ -247,3 +244,4 @@ class Selection: """Handles selected identifiers along each dimension of a dataset""" def __init__(self): self.current_selection={} + diff --git a/system/fluents.py b/system/fluents.py index 9ffa012..7da59d2 100755 --- a/system/fluents.py +++ b/system/fluents.py @@ -97,8 +97,12 @@ class FluentApp: window = self.widget_tree.get_widget('plot_toolbar_dock') if self._plot_toolbar: window.remove(self._plot_toolbar) - - self._plot_toolbar = view.get_toolbar() + + if view: + self._plot_toolbar = view.get_toolbar() + else: + self._plot_toolbar = None + if self._plot_toolbar: window.add(self._plot_toolbar) @@ -127,6 +131,8 @@ class FluentApp: return self.navigator_view # Event handlers. + # These methods are called by the gtk framework in response to events and + # should not be called directly. def on_single_view(self, *ignored): self['main_view'].goto_large() diff --git a/system/plots.py b/system/plots.py index eeac30b..115c8dc 100644 --- a/system/plots.py +++ b/system/plots.py @@ -207,7 +207,10 @@ class MainView (gtk.Notebook): self.set_current_page(0) def insert_view(self, view): - vf = self.get_active_small_view() + if self.get_current_page() == 0: + vf = self.get_active_small_view() + else: + vf = self._large_view vf.set_view(view) def show(self): diff --git a/workflows/go_workflow.py b/workflows/test_workflow.py similarity index 96% rename from workflows/go_workflow.py rename to workflows/test_workflow.py index 3607a23..423fdb0 100644 --- a/workflows/go_workflow.py +++ b/workflows/test_workflow.py @@ -5,11 +5,11 @@ from system import dataset, logger, plots, workflow from scipy import array,randn,log import cPickle -class GOWorkflow (workflow.Workflow): +class TestWorkflow (workflow.Workflow): - name = 'Gene Ontology Workflow' - ident = 'go' - description = 'Gene Ontology Workflow. This workflow currently serves as a general testing workflow.' + name = 'Test Workflow' + ident = 'test' + description = 'Test Gene Ontology Workflow. This workflow currently serves as a general testing workflow.' def __init__(self, app): workflow.Workflow.__init__(self, app) @@ -102,7 +102,8 @@ class TestDataFunction(workflow.Function): logger.log('notice', 'Injecting foo test data') x = randn(20,30) X = dataset.Dataset(x) - return [X, plots.SinePlot()] + p = plots.ScatterPlot(X, X, 'rows', 'rows', '0_1', '0_2') + return [X, plots.SinePlot(), p] class DatasetLog(workflow.Function): def __init__(self):