* fluent, *.py: Data and plots returned from functions will now show up in
the navigator window.
This commit is contained in:
parent
78ecadb3ab
commit
c09f2ceb92
8
fluent
8
fluent
|
@ -24,8 +24,6 @@ import scipy
|
||||||
PROGRAM_NAME = 'fluent'
|
PROGRAM_NAME = 'fluent'
|
||||||
VERSION = '0.1.0'
|
VERSION = '0.1.0'
|
||||||
GLADEFILENAME = 'system/fluent.glade'
|
GLADEFILENAME = 'system/fluent.glade'
|
||||||
WF_BOX = 'workflow_vbox'
|
|
||||||
DATA_BOX = 'data_vbox'
|
|
||||||
|
|
||||||
class FluentApp:
|
class FluentApp:
|
||||||
|
|
||||||
|
@ -44,8 +42,6 @@ class FluentApp:
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
|
||||||
|
|
||||||
self.navigator = navigator.NavigatorStore(self.project)
|
|
||||||
self.current_data = None
|
self.current_data = None
|
||||||
gtk.glade.set_custom_handler(self.custom_object_factory)
|
gtk.glade.set_custom_handler(self.custom_object_factory)
|
||||||
self.widget_tree = gtk.glade.XML(GLADEFILENAME, 'appwindow')
|
self.widget_tree = gtk.glade.XML(GLADEFILENAME, 'appwindow')
|
||||||
|
@ -78,7 +74,8 @@ class FluentApp:
|
||||||
return self.large_view
|
return self.large_view
|
||||||
|
|
||||||
def create_navigator_view(self, str1, str2, int1, int2):
|
def create_navigator_view(self, str1, str2, int1, int2):
|
||||||
self.navigator_view = navigator.NavigatorView(self.navigator, self)
|
tree = self.project.data_tree
|
||||||
|
self.navigator_view = navigator.NavigatorView(tree, self)
|
||||||
self.navigator_view.show()
|
self.navigator_view.show()
|
||||||
return self.navigator_view
|
return self.navigator_view
|
||||||
|
|
||||||
|
@ -128,4 +125,3 @@ if __name__ == '__main__':
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,29 +4,6 @@ import gobject
|
||||||
import plots
|
import plots
|
||||||
import logger
|
import logger
|
||||||
|
|
||||||
class NavigatorStore (gtk.TreeStore):
|
|
||||||
def __init__(self,project):
|
|
||||||
gtk.TreeStore.__init__(self, gobject.TYPE_STRING, plots.Plot)
|
|
||||||
self.project = project
|
|
||||||
iter = self.append(None)
|
|
||||||
self.set_value(iter, 0, ('Sine Plot'))
|
|
||||||
self.set_value(iter, 1, (plots.SinePlot(project)))
|
|
||||||
|
|
||||||
iter = self.append(None)
|
|
||||||
self.set_value(iter, 0, ('Scatter Plot'))
|
|
||||||
self.set_value(iter, 1, (plots.ScatterPlot(project)))
|
|
||||||
|
|
||||||
iter = self.append(None)
|
|
||||||
self.set_value(iter, 0, ('Scatter Plot 2'))
|
|
||||||
self.set_value(iter, 1, (plots.ScatterPlot(project)))
|
|
||||||
|
|
||||||
def plot_at(self, path):
|
|
||||||
iter = self.get_iter(path)
|
|
||||||
plot = self.get_value(iter, 1)
|
|
||||||
if plot:
|
|
||||||
plot.show()
|
|
||||||
return plot
|
|
||||||
|
|
||||||
class NavigatorView (gtk.TreeView):
|
class NavigatorView (gtk.TreeView):
|
||||||
def __init__(self, nav, app):
|
def __init__(self, nav, app):
|
||||||
gtk.TreeView.__init__(self, nav)
|
gtk.TreeView.__init__(self, nav)
|
||||||
|
@ -43,6 +20,8 @@ class NavigatorView (gtk.TreeView):
|
||||||
logger.log('debug', 'Initializing naviagor window')
|
logger.log('debug', 'Initializing naviagor window')
|
||||||
|
|
||||||
def row_activated_handler(self, widget, path, column):
|
def row_activated_handler(self, widget, path, column):
|
||||||
plot = self.navigator.plot_at(path)
|
|
||||||
|
iter = self.navigator.get_iter(path)
|
||||||
|
object = self.navigator.get_value(iter, 2)
|
||||||
logger.log('notice', 'Button pressed')
|
logger.log('notice', 'Button pressed')
|
||||||
self.app.change_plot(plot)
|
self.app.change_plot(object)
|
||||||
|
|
|
@ -73,7 +73,6 @@ class SmallView (gtk.Table):
|
||||||
def set_child(self, child, col, row):
|
def set_child(self, child, col, row):
|
||||||
cur_widget = self.child_views[col][row]
|
cur_widget = self.child_views[col][row]
|
||||||
cur_widget.disconnect(cur_widget.parent_signalling)
|
cur_widget.disconnect(cur_widget.parent_signalling)
|
||||||
print cur_widget
|
|
||||||
self.remove(cur_widget)
|
self.remove(cur_widget)
|
||||||
self.attach(child, col, col+1, row, row+1)
|
self.attach(child, col, col+1, row, row+1)
|
||||||
child.parent_signalling = child.connect('button_press_event', self.__view_button_event__)
|
child.parent_signalling = child.connect('button_press_event', self.__view_button_event__)
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
import dataset
|
import dataset
|
||||||
|
import plots
|
||||||
import scipy
|
import scipy
|
||||||
|
import gobject
|
||||||
|
import gtk
|
||||||
|
|
||||||
class Project:
|
class Project:
|
||||||
def __init__(self,name="Testing"):
|
def __init__(self,name="Testing"):
|
||||||
|
self.data_tree = gtk.TreeStore(gobject.TYPE_STRING,
|
||||||
|
gobject.TYPE_STRING,
|
||||||
|
gobject.TYPE_PYOBJECT)
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.dim_names = []
|
self.dim_names = []
|
||||||
self._observers = {}
|
self._observers = {}
|
||||||
|
@ -39,6 +46,26 @@ class Project:
|
||||||
"""Returns the current selection object"""
|
"""Returns the current selection object"""
|
||||||
return self.sel_obj.current_selection
|
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):
|
def add_dataset(self,dataset):
|
||||||
"""Appends a new Dataset to the project."""
|
"""Appends a new Dataset to the project."""
|
||||||
self.datasets.append(dataset)
|
self.datasets.append(dataset)
|
||||||
|
@ -52,6 +79,11 @@ class Project:
|
||||||
dim_name = dim_name + "_t"
|
dim_name = dim_name + "_t"
|
||||||
return dim_name
|
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
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ class WorkflowView (gtk.VBox):
|
||||||
project = self.workflow.app.project
|
project = self.workflow.app.project
|
||||||
new_data = function.run(project.current_data)
|
new_data = function.run(project.current_data)
|
||||||
if new_data != None:
|
if new_data != None:
|
||||||
project.current_data = new_data
|
project.add_data(None, new_data)
|
||||||
logger.log('debug', 'Function ended: %s' % function.name)
|
logger.log('debug', 'Function ended: %s' % function.name)
|
||||||
|
|
||||||
def button_click_handler(self, button):
|
def button_click_handler(self, button):
|
||||||
|
|
|
@ -2,6 +2,7 @@ import gtk
|
||||||
import logger
|
import logger
|
||||||
from annotations import Annotations
|
from annotations import Annotations
|
||||||
from workflow import *
|
from workflow import *
|
||||||
|
import plots
|
||||||
#import geneontology
|
#import geneontology
|
||||||
#import gostat
|
#import gostat
|
||||||
from scipy import array
|
from scipy import array
|
||||||
|
@ -14,6 +15,7 @@ class EinarsWorkflow (Workflow):
|
||||||
|
|
||||||
load = Stage('load', 'Load Data')
|
load = Stage('load', 'Load Data')
|
||||||
load.add_function(Function('load', 'Load Microarrays'))
|
load.add_function(Function('load', 'Load Microarrays'))
|
||||||
|
load.add_function(TestDataFunction())
|
||||||
self.add_stage(load)
|
self.add_stage(load)
|
||||||
|
|
||||||
preproc = Stage('preprocess', 'Preprocessing')
|
preproc = Stage('preprocess', 'Preprocessing')
|
||||||
|
@ -83,3 +85,12 @@ class GODistanceFunction(Function):
|
||||||
|
|
||||||
return gene_distances
|
return gene_distances
|
||||||
|
|
||||||
|
class TestDataFunction(Function):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Function.__init__(self, 'test_data', 'Generate Test Data')
|
||||||
|
|
||||||
|
def run(self, data):
|
||||||
|
logger.log('notice', 'Injecting foo test data')
|
||||||
|
return [plots.SinePlot(None)]
|
||||||
|
|
||||||
|
|
Reference in New Issue