1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == "__main__":
import argparse, sys, os
parser = argparse.ArgumentParser(description="Laborejo Collection Editor Qt")
parser.add_argument('infiles', help="One or more lbj files to load.", nargs="*")
parser.add_argument("-n", "--new", help="Start with an empty file (additionally to loaded files)", action="store_true")
parser.add_argument("-c", "--config", help="The configuration dir for user scripts, templates and configs etc. Default=~/.laborejo/", type=str)
args = parser.parse_args()
import laborejocollection #initialize the GUI. We do this after parse init because if it were just --help we don't need to start the whole Qt chain.
if args.config:
p = os.path.realpath(args.config) + "/"
print ("Starting Laborejo Collection Editor Qt with config directory", p)
laborejocollection.api._getSession().configdir = p
laborejocollection.main = laborejocollection.StartQT4()
laborejocollection.listener.main = laborejocollection.main
#Switch backend into slave mode.
#We only override one listener here. If someone actually achieves to use a notation command in the collection editor it will just result in "pass".
laborejocollection.api.STANDALONE = False
laborejocollection.api.l_collections = laborejocollection.listener.ListenerCollections()
#load command line files. A new empty file can also be opened, does not conflict with loading files.
if args.infiles:
laborejocollection.main.loadGuiDialog(directFileList = args.infiles)
if args.new:
laborejocollection.api.newCollection()
#else it is just an empty program start
sys.exit(laborejocollection.app.exec_())
|