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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 579 - (hide annotations)
Mon Mar 31 18:32:07 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: 2493 byte(s)
Show the legend by default when Thuban starts.

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