1 |
bh |
1520 |
# Copyright (C) 2001, 2002, 2003 by Intevation GmbH |
2 |
bh |
6 |
# 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 |
dpinte |
2700 |
The main entry point for the Thuban GUI. |
11 |
bh |
6 |
""" |
12 |
|
|
|
13 |
|
|
__version__ = "$Revision$" |
14 |
|
|
|
15 |
|
|
import sys |
16 |
bh |
1968 |
import getopt |
17 |
bh |
6 |
|
18 |
dpinte |
2689 |
import application |
19 |
jonathan |
1308 |
import Thuban.version |
20 |
bh |
6 |
|
21 |
bh |
1968 |
|
22 |
|
|
class options: |
23 |
|
|
|
24 |
|
|
attribute_editing_enabled = False |
25 |
|
|
|
26 |
|
|
|
27 |
bh |
6 |
def main(): |
28 |
|
|
"""Instantiate the application object and run the application""" |
29 |
jonathan |
540 |
|
30 |
|
|
if verify_versions(): |
31 |
dpinte |
2689 |
app = application.ThubanApplication(0) |
32 |
bh |
1968 |
opts, args = getopt.getopt(sys.argv[1:], '', |
33 |
|
|
['enable-attribute-editing']) |
34 |
|
|
for optchar, value in opts: |
35 |
|
|
if optchar == '--enable-attribute-editing': |
36 |
|
|
options.attribute_editing_enabled = True |
37 |
|
|
else: |
38 |
|
|
print >>sys.stderr, "Unknown option", optchar |
39 |
|
|
|
40 |
|
|
# If there was a non-flag argument it's the name of a thuban |
41 |
|
|
# file. |
42 |
|
|
if args: |
43 |
|
|
app.OpenSession(args[0]) |
44 |
|
|
|
45 |
jonathan |
540 |
app.MainLoop() |
46 |
jonathan |
1505 |
# sys.excepthook is set in ThubanApplication.OnInit() |
47 |
jonathan |
1392 |
sys.excepthook = sys.__excepthook__ |
48 |
jonathan |
540 |
|
49 |
bh |
1968 |
|
50 |
jonathan |
540 |
def verify_versions(): |
51 |
|
|
"""Check some library versions. |
52 |
|
|
|
53 |
|
|
Print a message containing any libraries which are wrong. |
54 |
|
|
Return True if everything is OK, otherwise False. |
55 |
|
|
""" |
56 |
dpinte |
2700 |
|
57 |
jonathan |
1308 |
errors = Thuban.version.verify_versions() |
58 |
jonathan |
540 |
|
59 |
|
|
if len(errors) > 0: |
60 |
|
|
msg = " The following version errors were detected:" |
61 |
|
|
|
62 |
|
|
for e in errors: |
63 |
|
|
msg += "\n " + e |
64 |
|
|
|
65 |
|
|
# if use_msg_box: |
66 |
|
|
# # XXX: use a message box to display the errors |
67 |
|
|
# pass |
68 |
|
|
|
69 |
|
|
print "\n*******************************************************" |
70 |
|
|
print msg |
71 |
|
|
print "*******************************************************\n" |
72 |
|
|
|
73 |
|
|
return False |
74 |
|
|
|
75 |
|
|
return True |