78 lines
1.9 KiB
Python
Executable File
78 lines
1.9 KiB
Python
Executable File
#!/usr/bin/python2.4
|
|
|
|
from getopt import getopt
|
|
import sys
|
|
from fluents import fluents, project, workflow
|
|
import workflows
|
|
import cfgparse, optparse
|
|
|
|
PROGRAM_NAME = 'fluents'
|
|
VERSION = '0.1.0'
|
|
|
|
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()
|
|
for wf in wfs:
|
|
print ' %s (%s)' % (wf.ident, wf.name)
|
|
print
|
|
|
|
def parse_options():
|
|
cp = cfgparse.ConfigParser()
|
|
op = optparse.OptionParser()
|
|
|
|
op.add_option('-l', '--list-workflows',
|
|
action='store_true',
|
|
default=False,
|
|
help='List available workflows.')
|
|
|
|
op.add_option('-w', '--workflow',
|
|
default='emptyview',
|
|
help='Start with selected workflow')
|
|
|
|
return cp.parse(op)
|
|
|
|
if __name__ == '__main__':
|
|
options, params = parse_options()
|
|
|
|
if options.list_workflows:
|
|
list_workflows()
|
|
sys.exit(0)
|
|
|
|
import gtk
|
|
import gnome
|
|
|
|
gnome.program_init(PROGRAM_NAME, VERSION)
|
|
|
|
selected_wf = workflow.EmptyWorkflow
|
|
|
|
workflow_list = workflow.workflow_list()
|
|
for wf in workflow_list:
|
|
if wf.ident == options.workflow:
|
|
selected_wf = wf
|
|
|
|
app = fluents.FluentApp(selected_wf)
|
|
fluents.app = app
|
|
|
|
app.set_project(project.Project())
|
|
app.show()
|
|
gtk.main()
|
|
|