einarr
a45743c31e
- Navigator - Aplication - Workflow - Project - Options Corresponding changes have been added in lots of other files to account for this, but the access to these objects should now be a lot easier.
84 lines
1.8 KiB
Python
Executable File
84 lines
1.8 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
from getopt import getopt
|
|
import os
|
|
import sys
|
|
from fluents import fluents, project, workflow, main
|
|
import workflows
|
|
import cfgparse, optparse
|
|
|
|
PROGRAM_NAME = 'fluents'
|
|
VERSION = '0.1.0'
|
|
|
|
def list_workflows():
|
|
print 'fluents %s' % VERSION
|
|
print
|
|
print 'Available workflows:'
|
|
|
|
wfs = workflow.workflow_list()
|
|
for wf in wfs:
|
|
print ' %s (%s)' % (wf.ident, wf.name)
|
|
print
|
|
|
|
def parse_options():
|
|
conf_files = ['/etc/fluentsrc',
|
|
os.path.join(os.environ['HOME'], '.fluents')]
|
|
|
|
cp = cfgparse.ConfigParser()
|
|
|
|
cp.add_option('home', type='string',
|
|
default=os.environ['HOME'])
|
|
|
|
cp.add_option('datadir', type='string',
|
|
default=os.environ['HOME'])
|
|
cp.parse()
|
|
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')
|
|
|
|
for cf in conf_files:
|
|
if os.path.isfile(cf):
|
|
cp.add_file(cf)
|
|
|
|
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
|
|
|
|
|
|
main.set_workflow(selected_wf())
|
|
main.set_options(options)
|
|
app = fluents.FluentApp()
|
|
|
|
main.set_application(app)
|
|
main.set_project(project.Project())
|
|
|
|
|
|
app.set_project(main.project)
|
|
app.show()
|
|
gtk.main()
|
|
|