#!/usr/local/bin/python2.5
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2008 GNS3 Dev Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Contact: contact@gns3.net
#

import sys, os, traceback

# current version of GNS3
VERSION = "0.6.1"
VERSION_INTEGER = 0x000610

try:
    from PyQt4 import QtCore, QtGui
except ImportError:
    sys.stderr.write("Can't import Qt modules, PyQt is probably not installed ...\n")
    sys.exit(False)

if QtCore.QT_VERSION < 0x040300:
    raise RuntimeError, "Need Qt v4.3 or higher, but got v%s" % QtCore.QT_VERSION_STR

if QtCore.PYQT_VERSION < 0x040300:
    raise RuntimeError, "Need PyQt v4.3 or higher, but got v%s" % QtCore.PYQT_VERSION_STR

def exceptionHook(type, value, tb):

    lines = traceback.format_exception(type, value, tb)
    print "---------Traceback lines (saved in exception.log)----------"
    print "\n" . join(lines)
    print "-----------------------------------------------------------"
    logfile = open('exception.log','a')
    logfile.write("\n" . join(lines))
    logfile.close()

# catch exceptions to write them in a file
sys.excepthook=exceptionHook
if __name__ == '__main__' and not hasattr(sys, "frozen"):
    source_path = os.path.dirname(os.path.abspath(__file__)) + os.sep + 'src'
    if os.access(source_path, os.F_OK):
        sys.path.append(source_path)
import GNS3.Main
