#!/usr/bin/python
# -*-Python-*-

import sys

import traceback

guiException = None

try:
    import dtkmain
except:
    from PyritePublisher import dtkmain

try:
    import gui_wxwin
except:
    try:
        from PyritePublisher import gui_wxwin
    except:
        guiException = sys.exc_info()

if len(sys.argv) == 1:
    if guiException != None:
        print >>sys.stderr, "No arguments given, but error starting GUI (is python-wxgtk3.0 installed?)"
        traceback.print_exception(guiException[0],guiException[1],guiException[2])
        sys.exit(1)
    try:
        app = gui_wxwin.PPApp(0)
        app.MainLoop()
        sys.exit()
    except SystemExit:
        pass
    except:
        traceback.print_exc()
        sys.exit(1)
        
dtkmain.PPCLI()(sys.argv)
