#!/usr/bin/env python
# Qt GUI for Synopsis
# Copyright (c) 2001 by Stephen Davies
#
# Tested on Debian unstable with python2.2-qt3 package (and dependencies)
# You may need to add asgard.debian.org to your sources.list.
# Qt 2.0 uses a different API in places and is NOT supported

from Synopsis.UI.Qt.main import *
from Synopsis.Formatter import ASCII
from Synopsis.Core import Project

if __name__ == "__main__":
    # This is usually set in ASCII's parse_args function.. but we can set it to
    # something more appropriate
    ASCII.comment_str = '<font color="purple">// %s</font>\n'

    app = QApplication(sys.argv)
    app.setDesktopSettingsAware(1) # doesnt work with Qt 2
    # So I prefer the windows style to motif.. shoot me :)
    #app.setStyle(QWindowsStyle())
    #app.setStyle(QPlatinumStyle())
    app.setFont(QFont('Helvetica', 10))

    # Parse args
    load_file = None
    for arg in sys.argv[1:]:
	if arg and arg[0] != '-':
	    load_file = arg

    # Load files
    ast = None
    main = MainWindow()
    app.setMainWidget(main)
    main.show()

    if load_file:
	if Project.is_project_file(load_file):
	    main.do_open_project(load_file)
	else:
	    main.do_open_file(load_file)

    app.exec_loop()

