* Changed build behaviour to suit newer Ubuntu releases (at least 9.10).
* Added -c option to generate intial configuration file and directories. This will create the file ~/.laydi and the directories ~/laydi/datasets and ~/laydi/workflows. * Removed debug print statements.
This commit is contained in:
36
bin/laydi
36
bin/laydi
@@ -21,6 +21,29 @@ def list_workflows():
|
||||
print ' %s (%s)' % (wf.ident, wf.name)
|
||||
print
|
||||
|
||||
|
||||
def generate_config():
|
||||
fn = os.path.join(os.environ['HOME'], '.laydi')
|
||||
if not os.path.exists(fn):
|
||||
fd = open(fn, 'w')
|
||||
print >> fd, "home = %s" % os.environ['HOME']
|
||||
print >> fd, "datadir = %%(home)s/laydi/datasets"
|
||||
print >> fd, "workflowdir = %%(home)s/laydi/workflows"
|
||||
fd.close()
|
||||
|
||||
laydidir = os.path.join(os.environ['HOME'], 'laydi')
|
||||
if not os.path.exists(laydidir):
|
||||
os.mkdir(laydidir, 0755)
|
||||
|
||||
datadir = os.path.join(os.environ['HOME'], 'laydi/datasets')
|
||||
if not os.path.exists(datadir):
|
||||
os.mkdir(datadir, 0755)
|
||||
|
||||
workflowdir = os.path.join(os.environ['HOME'], 'laydi/workflows')
|
||||
if not os.path.exists(workflowdir):
|
||||
os.mkdir(workflowdir, 0755)
|
||||
|
||||
|
||||
def parse_options():
|
||||
conf_files = ['/etc/laydirc',
|
||||
os.path.join(os.environ['HOME'], '.laydi')]
|
||||
@@ -43,9 +66,13 @@ def parse_options():
|
||||
help='List available workflows.')
|
||||
|
||||
op.add_option('-w', '--workflow',
|
||||
default='emptyview',
|
||||
default='chemometric',
|
||||
help='Start with selected workflow')
|
||||
|
||||
op.add_option('-c', '--generate-config',
|
||||
action='store_true',
|
||||
help='Generate configuration file ~/.laydi if it does not exist.')
|
||||
|
||||
for cf in conf_files:
|
||||
if os.path.isfile(cf):
|
||||
cp.add_file(cf)
|
||||
@@ -69,9 +96,11 @@ if __name__ == '__main__':
|
||||
list_workflows()
|
||||
sys.exit(0)
|
||||
|
||||
print "options.workflow:", options.workflow
|
||||
if options.generate_config:
|
||||
generate_config()
|
||||
sys.exit(0)
|
||||
|
||||
selected_wf = workflow.find_workflow(options.workflow)
|
||||
print selected_wf
|
||||
if selected_wf == None: selected_wf = workflow.EmptyWorkflow
|
||||
|
||||
# workflow_list = workflow.workflow_list()
|
||||
@@ -86,7 +115,6 @@ if __name__ == '__main__':
|
||||
main.set_application(app)
|
||||
main.set_project(project.Project())
|
||||
|
||||
|
||||
app.set_project(main.project)
|
||||
app.show()
|
||||
gtk.main()
|
||||
|
||||
Reference in New Issue
Block a user