47 lines
873 B
Python
Executable File
47 lines
873 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import os
|
|
import sys
|
|
import getopt
|
|
|
|
from Window import *
|
|
from DataStore import *
|
|
|
|
PROGRAM_NAME = 'dwtt'
|
|
|
|
def usage():
|
|
print '''Usage: %s [options] [dbfile]
|
|
Options:
|
|
--help Show this help
|
|
''' % PROGRAM_NAME
|
|
|
|
def main(argv):
|
|
dbfile = os.path.expanduser('~/.%s.db' % PROGRAM_NAME)
|
|
try:
|
|
opts, args = getopt.getopt(argv[1:], "", ["help"])
|
|
except getopt.GetoptError:
|
|
usage()
|
|
return 2
|
|
|
|
for opt, arg in opts:
|
|
if opt == "--help":
|
|
usage()
|
|
sys.exit()
|
|
else:
|
|
usage()
|
|
return 2
|
|
|
|
if len(args) == 1:
|
|
dbfile = args[0]
|
|
elif len(args) > 1:
|
|
usage()
|
|
return 2
|
|
|
|
conf_file = dbfile + '.conf'
|
|
ds = DataStore(dbfile)
|
|
w = Window(ds)
|
|
w.main()
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main(sys.argv))
|