/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/main.py
ViewVC logotype

Contents of /branches/WIP-pyshapelib-bramz/Thuban/UI/main.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 540 - (show annotations)
Wed Mar 19 15:37:24 2003 UTC (21 years, 11 months ago) by jonathan
Original Path: trunk/thuban/Thuban/UI/main.py
File MIME type: text/x-python
File size: 2463 byte(s)
(verify_versions): New. Checks the versions of Python, wxPython,
and some other libraries.

1 #! /usr/bin/python
2 # Copyright (C) 2001, 2002 by Intevation GmbH
3 # 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 from application import ThubanApplication
19
20 from wxPython.wx import wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER,\
21 wxPlatform
22 import wxproj
23
24
25 def main():
26 """Instantiate the application object and run the application"""
27
28 if verify_versions():
29 app = ThubanApplication(0)
30 if len(sys.argv) > 1:
31 app.OpenSession(sys.argv[1])
32 app.top.ShowSessionTree()
33 app.MainLoop()
34
35
36 def wxCHECK_VERSION(major,minor,release): \
37 return (wxMAJOR_VERSION > (major) or \
38 (wxMAJOR_VERSION == (major) \
39 and wxMINOR_VERSION > (minor)) or \
40 (wxMAJOR_VERSION == (major) \
41 and wxMINOR_VERSION == (minor) \
42 and wxRELEASE_NUMBER >= (release)))
43
44 def verify_versions():
45 """Check some library versions.
46
47 Print a message containing any libraries which are wrong.
48 Return True if everything is OK, otherwise False.
49
50 Specifically, check the following libraries:
51
52 wxPython >= v2.4.0
53 Python >= v2.2.1
54 proj >= v4.4.5
55 gtk > v1.2.0
56 """
57
58 errors = []
59
60 if not wxCHECK_VERSION(2, 4, 0):
61 errors.append("wxPython < 2.4.0")
62
63 if sys.hexversion < 0x0202010f:
64 errors.append("Python < 2.2.1")
65
66 #
67 # This only tells someone that they COMPILED thuban with the wrong
68 # version of proj. If they are running prebuilt binaries
69 # check_version should always return true.
70 #
71 if not wxproj.check_version(4, 4, 5):
72 errors.append("proj < 4.4.5")
73
74 if wxPlatform == "__WXGTK__":
75 if not wxproj.check_version_gtk(1, 2, 0):
76 errors.append("gtk < 1.2")
77
78 if len(errors) > 0:
79 msg = " The following version errors were detected:"
80
81 for e in errors:
82 msg += "\n " + e
83
84 # if use_msg_box:
85 # # XXX: use a message box to display the errors
86 # pass
87
88 print "\n*******************************************************"
89 print msg
90 print "*******************************************************\n"
91
92 return False
93
94 return True

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26