diff --git a/fluent b/fluent
index be66d8b..53b4916 100755
--- a/fluent
+++ b/fluent
@@ -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()
diff --git a/system/fluent.glade b/system/fluent.glade
index 627ff15..e141597 100644
--- a/system/fluent.glade
+++ b/system/fluent.glade
@@ -225,13 +225,14 @@
False
-
+
True
Ny fil
gtk-new
True
True
False
+
False
@@ -268,30 +269,6 @@
True
-
-
-
-
- BONOBO_DOCK_TOP
- 1
- 0
- 2
- BONOBO_DOCK_ITEM_BEH_NORMAL
-
-
-
-
-
- True
- GTK_SHADOW_OUT
-
-
-
- True
- GTK_ORIENTATION_HORIZONTAL
- GTK_TOOLBAR_ICONS
- True
- False
@@ -322,18 +299,14 @@
True
-
-
-
-
BONOBO_DOCK_TOP
1
- 1
- 0
+ 0
+ 2
BONOBO_DOCK_ITEM_BEH_NORMAL
@@ -350,7 +323,7 @@
BONOBO_DOCK_TOP
1
- 2
+ 1
0
BONOBO_DOCK_ITEM_BEH_NORMAL
@@ -580,4 +553,188 @@
+
+ True
+ Create project
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_NONE
+ True
+ 550
+ 320
+ True
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_NORMAL
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+
+
+
+ 3
+ 510
+ 228
+ True
+ False
+
+
+
+ True
+ GNOME_EDGE_START
+ Create new project
+ 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.
+
+
+
+
+
+ True
+ Select workflow
+
+
+
+ 16
+ True
+ False
+ 6
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ GTK_POLICY_NEVER
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ 2
+ True
+ True
+ True
+ False
+ False
+ True
+ False
+ False
+ False
+
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+
+
+ 10
+ False
+ True
+
+
+
+
+
+ True
+ True
+ GTK_POLICY_NEVER
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ True
+ False
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ GTK_WRAP_WORD
+ True
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
+
+
+
+ True
+ GNOME_EDGE_FINISH
+ Finished
+ A project will now be created.
+
+
+
+
+
+
+
+
+ True
+ True
+ Fluent
+ Copyright (C) 2006 the Fluents Team
+
+ From WordNet (r) 2.0 [wn]: fluent (adj)
+
+1: easy and graceful in shape; "a yacht with long, fluent curves"
+
+2: smooth and unconstrained in movement; "a long, smooth stride"; "the fluid motion of a cat"; "the liquid grace of a ballerina"; "liquid prose" [syn:{flowing}, {fluid}, {liquid}, {smooth}]
+
+3: expressing yourself readily, clearly, effectively; "able to dazzle with his facile tongue"; "silver speech" [syn: {eloquent}, {facile}, {silver}, {silver-tongued}, {smooth-spoken}]
+
+
+ False
+ https://dev.pvv.ntnu.no/projects/fluent
+ The Fluent project website
+ Arnar Flatberg
+Einar Ryeng
+Truls A. Tangstad
+ translator-credits
+
+
diff --git a/system/navigator.py b/system/navigator.py
index d6abe38..1ac7fe1 100644
--- a/system/navigator.py
+++ b/system/navigator.py
@@ -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()
diff --git a/system/plots.py b/system/plots.py
index 9c40b77..ee79a71 100644
--- a/system/plots.py
+++ b/system/plots.py
@@ -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):
diff --git a/system/workflow.py b/system/workflow.py
index 8d15b21..171495a 100644
--- a/system/workflow.py
+++ b/system/workflow.py
@@ -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
diff --git a/workflows/__init__.py b/workflows/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/workflows/pca_workflow.py b/workflows/pca_workflow.py
index 9033bf9..6de0c53 100644
--- a/workflows/pca_workflow.py
+++ b/workflows/pca_workflow.py
@@ -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'