2006-04-27 12:06:30 +02:00
|
|
|
#!/usr/bin/python2.4
|
2006-04-25 14:19:25 +02:00
|
|
|
|
|
|
|
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()
|
2006-04-25 14:36:38 +02:00
|
|
|
for wf in wfs:
|
|
|
|
print ' %s (%s)' % (wf.ident, wf.name)
|
|
|
|
print
|
2006-04-25 14:19:25 +02:00
|
|
|
|
|
|
|
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()
|
2006-04-25 14:36:38 +02:00
|
|
|
sys.exit(0)
|
2006-04-25 14:19:25 +02:00
|
|
|
elif opt in ['-l', '--list-workflows']:
|
|
|
|
list_workflows()
|
2006-04-25 14:36:38 +02:00
|
|
|
sys.exit(0)
|
2006-04-25 14:19:25 +02:00
|
|
|
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()
|