Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

* The New project toolbar button now works. A druid will display the

available workflows and ask you to select one of them. There are still
   a couple of unresolved issues, but it works, so i upload it to ease
   the use of the program.
This commit is contained in:
Einar Ryeng 2006-04-22 21:46:44 +00:00
parent 357cd1a1a6
commit efcdafe843
7 changed files with 253 additions and 58 deletions

50
fluent
View File

@ -4,6 +4,7 @@ import sys
sys.path.append('system')
sys.path.append('workflows')
import dialogs
import pygtk
pygtk.require('2.0')
import gtk
@ -18,7 +19,7 @@ import dataset
import logger
import plots
import navigator
import go_workflow
#import go_workflow
#import pca_workflow
import scipy
@ -30,25 +31,23 @@ class FluentApp:
def __init__(self):
# Application variables
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.project = None
self.current_data = None
gtk.glade.set_custom_handler(self.custom_object_factory)
self.widget_tree = gtk.glade.XML(GLADEFILENAME, 'appwindow')
# self.workflow = pca_workflow.PCAWorkflow(self)
self.workflow = go_workflow.EinarsWorkflow(self)
self.workflow = workflow.EmptyWorkflow(self)
# self.workflow.add_project(self.project)
def set_project(self, project):
logger.log('notice', 'Creating a new project')
self.project = project
self.workflow.add_project(self.project)
self.navigator_view.add_project(self.project)
def set_workflow(self, workflow):
self.workflow = workflow
self.wf_menu.set_workflow(self.workflow)
def custom_object_factory(self, glade, function_name, widget_name,\
str1, str2, int1, int2):
@ -77,8 +76,8 @@ class FluentApp:
return self.large_view
def create_navigator_view(self, str1, str2, int1, int2):
tree = self.project.data_tree
self.navigator_view = navigator.NavigatorView(self.project, self)
# tree = self.project.data_tree
self.navigator_view = navigator.NavigatorView(None, self)
self.navigator_view.show()
return self.navigator_view
@ -89,9 +88,9 @@ class FluentApp:
self['appwindow'].set_size_request(800, 600)
# Set up workflow
wf_menu = workflow.WorkflowView(self.workflow)
wf_menu.show()
self['workflow_vbox'].pack_end(wf_menu)
self.wf_menu = workflow.WorkflowView(self.workflow)
self.wf_menu.show()
self['workflow_vbox'].pack_end(self.wf_menu)
# Set up plot toolbar
# self['plot_toolbar_dock'].add(plot.get_toolbar(self.app))
@ -100,7 +99,9 @@ class FluentApp:
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)}
'on_zoom_out_button_clicked' : (self.on_multiple_view),
'on_new1_activated' : (self.on_create_project),
'on_button_new_clicked' : (self.on_create_project)}
self.widget_tree.signal_autoconnect(signals)
# Log that we've set up the app now
@ -121,6 +122,11 @@ class FluentApp:
def __getitem__(self, key):
return self.widget_tree.get_widget(key)
def on_create_project(self, *rest):
logger.log('error', 'FIXME: Create project')
d = dialogs.CreateProjectDruid(self)
d.run()
if __name__ == '__main__':
gnome.program_init(PROGRAM_NAME, VERSION)
app = FluentApp()

View File

@ -225,13 +225,14 @@
<property name="show_arrow">False</property>
<child>
<widget class="GtkToolButton" id="toolbutton1">
<widget class="GtkToolButton" id="button_new">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Ny fil</property>
<property name="stock_id">gtk-new</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_button_new_clicked" last_modification_time="Fri, 21 Apr 2006 13:46:38 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
@ -268,30 +269,6 @@
<property name="homogeneous">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="placement">BONOBO_DOCK_TOP</property>
<property name="band">1</property>
<property name="position">0</property>
<property name="offset">2</property>
<property name="behavior">BONOBO_DOCK_ITEM_BEH_NORMAL</property>
</packing>
</child>
<child>
<widget class="BonoboDockItem" id="bonobodockitem3">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<widget class="GtkToolbar" id="toolbar2">
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
<property name="tooltips">True</property>
<property name="show_arrow">False</property>
<child>
<widget class="GtkToolButton" id="zoom_in_button">
@ -322,18 +299,14 @@
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
<packing>
<property name="placement">BONOBO_DOCK_TOP</property>
<property name="band">1</property>
<property name="position">1</property>
<property name="offset">0</property>
<property name="position">0</property>
<property name="offset">2</property>
<property name="behavior">BONOBO_DOCK_ITEM_BEH_NORMAL</property>
</packing>
</child>
@ -350,7 +323,7 @@
<packing>
<property name="placement">BONOBO_DOCK_TOP</property>
<property name="band">1</property>
<property name="position">2</property>
<property name="position">1</property>
<property name="offset">0</property>
<property name="behavior">BONOBO_DOCK_ITEM_BEH_NORMAL</property>
</packing>
@ -580,4 +553,188 @@
</child>
</widget>
<widget class="GtkWindow" id="new_project_druid">
<property name="visible">True</property>
<property name="title" translatable="yes">Create project</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">550</property>
<property name="default_height">320</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GnomeDruid" id="druid">
<property name="border_width">3</property>
<property name="width_request">510</property>
<property name="height_request">228</property>
<property name="visible">True</property>
<property name="show_help">False</property>
<child>
<widget class="GnomeDruidPageEdge" id="druidpagestart1">
<property name="visible">True</property>
<property name="position">GNOME_EDGE_START</property>
<property name="title" translatable="yes">Create new project</property>
<property name="text" translatable="yes">You have to select the workflow you want the new project to be based on.
A workflow is a collection of steps that are commonly needed to accomplish a task. For each step a set of relevant functions are available.
The functions of the workflow you select will be available on the right part of the application window.</property>
</widget>
</child>
<child>
<widget class="GnomeDruidPageStandard" id="druidpagestandard1">
<property name="visible">True</property>
<property name="title" translatable="yes">Select workflow</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="druid-vbox1">
<property name="border_width">16</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="workflow_list">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
<signal name="select_cursor_row" handler="on_workflow_list_select_cursor_row" last_modification_time="Sat, 22 Apr 2006 19:34:03 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVSeparator" id="vseparator1">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">10</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="workflow_info">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GnomeDruidPageEdge" id="druidpagefinish1">
<property name="visible">True</property>
<property name="position">GNOME_EDGE_FINISH</property>
<property name="title" translatable="yes">Finished</property>
<property name="text" translatable="yes">A project will now be created.</property>
<signal name="finish" handler="on_druidpagefinish1_finish" last_modification_time="Sat, 22 Apr 2006 19:28:28 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
<widget class="GtkAboutDialog" id="aboutdialog">
<property name="visible">True</property>
<property name="destroy_with_parent">True</property>
<property name="name" translatable="yes">Fluent</property>
<property name="copyright" translatable="yes">Copyright (C) 2006 the Fluents Team
</property>
<property name="comments" translatable="yes">From WordNet (r) 2.0 [wn]: fluent (adj)
1: easy and graceful in shape; &quot;a yacht with long, fluent curves&quot;
2: smooth and unconstrained in movement; &quot;a long, smooth stride&quot;; &quot;the fluid motion of a cat&quot;; &quot;the liquid grace of a ballerina&quot;; &quot;liquid prose&quot; [syn:{flowing}, {fluid}, {liquid}, {smooth}]
3: expressing yourself readily, clearly, effectively; &quot;able to dazzle with his facile tongue&quot;; &quot;silver speech&quot; [syn: {eloquent}, {facile}, {silver}, {silver-tongued}, {smooth-spoken}]
</property>
<property name="license" translatable="yes"></property>
<property name="wrap_license">False</property>
<property name="website">https://dev.pvv.ntnu.no/projects/fluent</property>
<property name="website_label" translatable="yes">The Fluent project website</property>
<property name="authors">Arnar Flatberg
Einar Ryeng
Truls A. Tangstad</property>
<property name="translator_credits" translatable="yes" comments="TRANSLATORS: Replace this string with your names, one name per line.">translator-credits</property>
</widget>
</glade-interface>

View File

@ -9,10 +9,13 @@ import project
class NavigatorView (gtk.TreeView):
def __init__(self, project, app):
self.project = project
self.data_tree = project.data_tree
self.app = app
if project:
self.data_tree = project.data_tree
else:
self.data_tree = None
gtk.TreeView.__init__(self, self.data_tree)
gtk.TreeView.__init__(self) #, self.data_tree)
self.set_headers_visible(False)
self.connect('cursor_changed', self.cursor_changed_handler)
@ -24,6 +27,11 @@ class NavigatorView (gtk.TreeView):
logger.log('debug', 'Initializing navigator window.')
def add_project(self, project):
self.project = project
self.data_tree = project.data_tree
self.set_model(project.data_tree)
def cursor_changed_handler(self, widget):
selection = widget.get_selection()
model, tree_iter = selection.get_selected()

View File

@ -172,7 +172,7 @@ class Plot (gtk.Frame):
project.attach(self,'selection_update')
def on_button_press(self, *rest):
logger.log('debug', 'button pressed in plot')
# logger.log('debug', 'button pressed in plot')
self.mark_active(True)
def mark_active(self, active):

View File

@ -10,8 +10,9 @@ class Workflow:
task.
"""
name = "Workflow"
def __init__(self, app):
self.name = ''
self.stages = []
self.stages_by_id = {}
self.app = app
@ -30,6 +31,12 @@ class Workflow:
def add_project(self,project):
self.project = project
class EmptyWorkflow(Workflow):
name = 'Empty Workflow'
def __init__(self, app):
Workflow.__init__(self, None)
class Stage:
"""A stage is a part of the data analysis process.
@ -70,7 +77,9 @@ class WorkflowView (gtk.VBox):
def __init__(self, wf):
gtk.VBox.__init__(self)
self.workflow = wf
self.setup_workflow(wf)
def setup_workflow(self, wf):
# Add stage in the process
for stage in wf.stages:
exp = gtk.Expander(stage.name)
@ -90,6 +99,19 @@ class WorkflowView (gtk.VBox):
exp.show()
self.pack_start(exp, expand=False, fill=False)
def remove_workflow(self):
print self.get_children()
for c in self.get_children():
c.hide()
self.remove(c)
def set_workflow(self, workflow):
self.workflow = workflow
self.remove_workflow()
self.setup_workflow(workflow)
print workflow
logger.log('notice', 'Created new workflow')
def run_function(self, function):
logger.log('debug', 'Starting function: %s' % function.name)
project = self.workflow.app.project

0
workflows/__init__.py Normal file
View File

View File

@ -144,3 +144,5 @@ class LoadMoothaData(Function):
sample_def = ['samples', sample_names]
X = dataset.Dataset(x,[sample_def,gene_def]) # samples x genes
return [X]
PCAWorkflow.name = 'PCA Workflow'