#!/usr/bin/env python

from TGenerator import generator
import sys
import getopt
import gtk
import os

def main():
    """Parse arguments and options, display the GUI."""
    try:
        opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
    except getopt.error, msg:
        print msg
        print "For help use --help"
        sys.exit(2)
    for o, a in opts:
        if o in ("-h", "--help"):
            print __doc__
            sys.exit(0)
    theme=""
    for arg in args:
        if arg[-4:] == ".tgc":
            if os.path.exists(arg):
                theme=arg    
    app = generator.Gui(theme)
    gtk.gdk.threads_init()
    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()

if __name__ == "__main__":
    main()

