Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Added command line options to create a new project based on a given workflow.

This commit is contained in:
Einar Ryeng 2006-04-25 12:19:25 +00:00
parent 16820cf29e
commit 251f9d6cf4
5 changed files with 74 additions and 20 deletions

68
fluents Executable file
View File

@ -0,0 +1,68 @@
#!/usr/bin/python
from getopt import getopt
import sys
from system import fluents, project, workflow
import workflows
PROGRAM_NAME = 'fluents'
VERSION = '0.1.0'
parameters = {'workflow': workflow.EmptyWorkflow}
def show_help():
print 'fluent %s' % VERSION
print 'This software is released under the GNU General Public Licence'
print
print 'Usage: fluent [options]'
print
print 'Description:'
print ' Fluent is a lightweight data analysis application for bilinear models.'
print
print 'Options:'
print ' -h --help Show this help text'
print ' -l --list-workflows Lists available workflows'
print ' -w --workflow=<wf> Generates a new project based on workflow wf.'
print
def list_workflows():
print 'fluent %s' % VERSION
print
print 'Workflows:'
wfs = workflow.workflow_list()
names = [wf.name for wf in wfs]
names.sort()
for n in names:
print ' %s (%s)' % (n.id, n.name)
def parse_options():
short_opts = 'hlw:'
long_opts = ['help', 'list-workflows', 'workflow=']
options, params = getopt(sys.argv[1:], short_opts, long_opts)
for opt, val in options:
if opt in ['-h', '--help']:
show_help()
elif opt in ['-l', '--list-workflows']:
list_workflows()
elif opt in ['-w', '--workflow']:
wfs = workflow.workflow_list()
for wf in wfs:
if wf.ident == val:
parameters['workflow'] = wf
parameters['workflow']
if __name__ == '__main__':
parse_options()
import gtk
import gnome
gnome.program_init(PROGRAM_NAME, VERSION)
app = fluents.FluentApp(parameters['workflow'])
app.set_project(project.Project())
app.show()
gtk.main()

View File

@ -20,14 +20,14 @@ GLADEFILENAME = 'system/fluent.glade'
class FluentApp:
def __init__(self):
def __init__(self, wf):
# Application variables
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 = workflow.EmptyWorkflow(self)
self.workflow = wf(self)
def set_project(self, project):
logger.log('notice', 'Creating a new project')
@ -93,8 +93,7 @@ class FluentApp:
'on_zoom_out_button_clicked' : (self.on_multiple_view),
'on_new1_activate' : (self.on_create_project),
'on_button_new_clicked' : (self.on_create_project),
'on_about1_activate' : (self.on_help_about),
'on_workflow_refresh_clicked' : (self.on_workflow_refresh_clicked)}
'on_about1_activate' : (self.on_help_about)}
self.widget_tree.signal_autoconnect(signals)
# Log that we've set up the app now
@ -124,19 +123,3 @@ class FluentApp:
about = widget_tree.get_widget('aboutdialog')
about.run()
def on_workflow_refresh_clicked(self, *ignored):
try:
reload(sys.modules[self.workflow.__class__.__module__])
except Exception, e:
logger.log('error', 'Relading workflow failed.')
logger.log('error', e)
else:
logger.log('notice', 'Successfully reloaded workflow.')
if __name__ == '__main__':
gnome.program_init(PROGRAM_NAME, VERSION)
app = FluentApp()
app.show()
gtk.main()

View File

@ -53,6 +53,7 @@ class Workflow:
"""
name = "Workflow"
ident = None
description = "Workflow Description"
def __init__(self, app):

View File

@ -9,6 +9,7 @@ import cPickle
class EinarsWorkflow (workflow.Workflow):
name = 'Test Workflow'
ident = 'go'
description = 'Gene Ontology Workflow. This workflow currently serves as a general testing workflow.'
def __init__(self, app):
workflow.Workflow.__init__(self, app)

View File

@ -8,6 +8,7 @@ from system import dataset, logger, plots
class PCAWorkflow(wf.Workflow):
name = 'PCA Workflow'
ident = 'pca'
description = 'PCA workflow. Uses real microarray data from a study of diabetes (Mootha et al.).'
def __init__(self, app):