Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0
This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
laydi/fluent

131 lines
3.7 KiB
Plaintext
Raw Normal View History

#!/usr/bin/python
import sys
sys.path.append('system')
sys.path.append('workflows')
import pygtk
pygtk.require('2.0')
import gtk
import gtk.gdk
import gtk.glade
import gnome
import gnome.ui
import pango
2006-04-19 21:59:55 +02:00
import project
import workflow
import dataset
import logger
import plots
import navigator
import go_workflow
2006-04-21 11:55:50 +02:00
#import pca_workflow
import scipy
PROGRAM_NAME = 'fluent'
VERSION = '0.1.0'
GLADEFILENAME = 'system/fluent.glade'
class FluentApp:
def __init__(self):
# Application variables
2006-04-19 21:59:55 +02:00
self.project = project.Project()
# add test data ##################
x = scipy.rand(200,3)
def_list = [ ['samples',[]], ['genes',['a','b','c']] ]
test_data1 = dataset.Dataset(x,def_list)
self.project.add_dataset(test_data1)
#y = scipy.rand(200,2)
#def_list = [ ['samples',[]], ['yclasses',['C','N']] ]
#test_data2 = dataset.Dataset(y,def_list)
####################
self.current_data = None
gtk.glade.set_custom_handler(self.custom_object_factory)
2006-04-19 21:59:55 +02:00
self.widget_tree = gtk.glade.XML(GLADEFILENAME, 'appwindow')
2006-04-21 11:55:50 +02:00
# self.workflow = pca_workflow.PCAWorkflow(self)
self.workflow = go_workflow.EinarsWorkflow(self)
2006-04-20 17:30:29 +02:00
self.workflow.add_project(self.project)
def custom_object_factory(self, glade, function_name, widget_name,\
str1, str2, int1, int2):
handler = getattr(self, function_name)
return handler(str1, str2, int1, int2)
def create_logview(self, str1, str2, int1, int2):
# Set up log view
self.log_view = logger.LogView(logger.logger)
self.log_view.show()
return self.log_view
def create_main_view(self, str1, str2, int1, int2):
self.main_view = plots.MainView()
self.main_view.show()
return self.main_view
def create_small_view(self, str1, str2, int1, int2):
self.small_view = plots.SmallView()
self.small_view.show()
return self.small_view
def create_large_view(self, str1, str2, int1, int2,project):
self.large_view = plots.LargeView()
self.large_view.show()
return self.large_view
def create_navigator_view(self, str1, str2, int1, int2):
tree = self.project.data_tree
2006-04-21 11:23:05 +02:00
self.navigator_view = navigator.NavigatorView(self.project, self)
self.navigator_view.show()
return self.navigator_view
def show(self):
self.init_gui()
def init_gui(self):
2006-04-19 21:59:55 +02:00
self['appwindow'].set_size_request(800, 600)
# Set up workflow
wf_menu = workflow.WorkflowView(self.workflow)
wf_menu.show()
2006-04-19 21:59:55 +02:00
self['workflow_vbox'].pack_end(wf_menu)
# Set up plot toolbar
2006-04-19 21:59:55 +02:00
# self['plot_toolbar_dock'].add(plot.get_toolbar(self.app))
# Connect signals
signals = {'on_quit1_activate' : (gtk.main_quit),
'on_appwindow_delete_event' : (gtk.main_quit),
'on_zoom_in_button_clicked' : (self.on_single_view),
'on_zoom_out_button_clicked' : (self.on_multiple_view)}
self.widget_tree.signal_autoconnect(signals)
# Log that we've set up the app now
logger.log('debug', 'Program started')
def change_plot(self, plot):
pt = self.widget_tree.get_widget('main_view')
pt.insert_view(plot)
def on_single_view(self, button):
nb = self.widget_tree.get_widget('main_view')
nb.goto_large()
def on_multiple_view(self, button):
nb = self.widget_tree.get_widget('main_view')
nb.goto_small()
2006-04-19 21:59:55 +02:00
def __getitem__(self, key):
return self.widget_tree.get_widget(key)
if __name__ == '__main__':
gnome.program_init(PROGRAM_NAME, VERSION)
app = FluentApp()
app.show()
gtk.main()
2006-04-18 16:25:46 +02:00