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