1 |
#! /usr/bin/python |
#! /usr/bin/python |
2 |
# Copyright (C) 2001 by Intevation GmbH |
# Copyright (C) 2001, 2002 by Intevation GmbH |
3 |
# Authors: |
# Authors: |
4 |
# Jan-Oliver Wagner <[email protected]> |
# Jan-Oliver Wagner <[email protected]> |
5 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
15 |
|
|
16 |
import sys |
import sys |
17 |
|
|
|
# import wxPython.wx here to get the side effects of the wxPython |
|
|
# import, especially setting the locale to the user's defaults throught |
|
|
# GTK. We then set the locale again to the user's defaults, but this |
|
|
# time we're going through the standard python locale module, so all the |
|
|
# magic necessary to make python work properly is done. Without this, |
|
|
# something harmless like float("1.2") may fail when run under a non-C |
|
|
# locale like de_DE |
|
|
import wxPython.wx |
|
|
import locale |
|
|
locale.setlocale(locale.LC_ALL, "") |
|
|
|
|
18 |
from application import ThubanApplication |
from application import ThubanApplication |
19 |
|
import Thuban.version |
20 |
|
|
21 |
def main(): |
def main(): |
22 |
"""Instantiate the application object and run the application""" |
"""Instantiate the application object and run the application""" |
23 |
global app |
|
24 |
app = ThubanApplication(0) |
if verify_versions(): |
25 |
if len(sys.argv) > 1: |
app = ThubanApplication(0) |
26 |
app.OpenSession(sys.argv[1]) |
if len(sys.argv) > 1: |
27 |
app.MainLoop() |
app.OpenSession(sys.argv[1]) |
28 |
|
app.MainLoop() |
29 |
|
|
30 |
|
def verify_versions(): |
31 |
|
"""Check some library versions. |
32 |
|
|
33 |
|
Print a message containing any libraries which are wrong. |
34 |
|
Return True if everything is OK, otherwise False. |
35 |
|
""" |
36 |
|
|
37 |
|
errors = Thuban.version.verify_versions() |
38 |
|
|
39 |
|
if len(errors) > 0: |
40 |
|
msg = " The following version errors were detected:" |
41 |
|
|
42 |
|
for e in errors: |
43 |
|
msg += "\n " + e |
44 |
|
|
45 |
|
# if use_msg_box: |
46 |
|
# # XXX: use a message box to display the errors |
47 |
|
# pass |
48 |
|
|
49 |
|
print "\n*******************************************************" |
50 |
|
print msg |
51 |
|
print "*******************************************************\n" |
52 |
|
|
53 |
|
return False |
54 |
|
|
55 |
|
return True |