1 |
# Copyright (C) 2001, 2002, 2003 by Intevation GmbH |
2 |
# Authors: |
3 |
# Jan-Oliver Wagner <[email protected]> |
4 |
# Bernhard Herzog <[email protected]> |
5 |
# |
6 |
# This program is free software under the GPL (>=v2) |
7 |
# Read the file COPYING coming with Thuban for details. |
8 |
|
9 |
""" |
10 |
The main entry point for the Thuban GUI. |
11 |
""" |
12 |
|
13 |
__version__ = "$Revision$" |
14 |
|
15 |
import sys |
16 |
|
17 |
from application import ThubanApplication |
18 |
import Thuban.version |
19 |
|
20 |
def main(): |
21 |
"""Instantiate the application object and run the application""" |
22 |
|
23 |
if verify_versions(): |
24 |
app = ThubanApplication(0) |
25 |
if len(sys.argv) > 1: |
26 |
app.OpenSession(sys.argv[1]) |
27 |
app.MainLoop() |
28 |
# sys.excepthook is set in ThubanApplication.OnInit() |
29 |
sys.excepthook = sys.__excepthook__ |
30 |
|
31 |
def verify_versions(): |
32 |
"""Check some library versions. |
33 |
|
34 |
Print a message containing any libraries which are wrong. |
35 |
Return True if everything is OK, otherwise False. |
36 |
""" |
37 |
|
38 |
errors = Thuban.version.verify_versions() |
39 |
|
40 |
if len(errors) > 0: |
41 |
msg = " The following version errors were detected:" |
42 |
|
43 |
for e in errors: |
44 |
msg += "\n " + e |
45 |
|
46 |
# if use_msg_box: |
47 |
# # XXX: use a message box to display the errors |
48 |
# pass |
49 |
|
50 |
print "\n*******************************************************" |
51 |
print msg |
52 |
print "*******************************************************\n" |
53 |
|
54 |
return False |
55 |
|
56 |
return True |