This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
laydi/bin/fluents
einarr 04b7cbb872 Lots of changes in structure to make it possible to package the program while
still allowing workflows to be placed in several locations in the file system.

The installation procedure is now ./configure && make install configure will
run m4 on fluents/paths.py.m4, Makefile.m4 and doc/Makefile.m4 so that the
installation system and the program will know where some important directories
are located.

The paths.py.m4 and consequently also pahts.py files are just listings of
directories configured during install.  I did this to separate these from all
other files so that as little as possible is touched by m4. It is still
necessary to do an install now to get the program to run in a clean checkout.

Workflows can now be placed anywhere in the system. This is done by setting the
workflowdir variable in the configuration file. All workflow directories,
separated by semicolons, are added to the python path.

The use of setup.py is now deprecated.
2008-12-05 00:12:49 +00:00

94 lines
2.3 KiB
Python
Executable File

#!/usr/bin/python
from getopt import getopt
import os
import sys
from fluents import fluents, project, workflow, main
#import workflows
from fluents import cfgparse
import 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.add_option('workflowdir', type='string',
default='workflows')
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__':
import gtk
import gnome
gnome.program_init(PROGRAM_NAME, VERSION)
options, params = parse_options()
main.options = options
for dir in main.options.workflowdir.split(';'):
if dir.strip() != "" and os.path.exists(dir):
sys.path.append(dir)
if options.list_workflows:
list_workflows()
sys.exit(0)
print "options.workflow:", options.workflow
selected_wf = workflow.find_workflow(options.workflow)
print selected_wf
if selected_wf == None: 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()