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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by bh, Tue Aug 28 15:41:52 2001 UTC revision 579 by jonathan, Mon Mar 31 18:32:07 2003 UTC
# Line 1  Line 1 
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]>
# Line 15  __version__ = "$Revision$" Line 15  __version__ = "$Revision$"
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    
20    from wxPython.wx import wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER,\
21                            wxPlatform
22    import wxproj
23    
24    
25  def main():  def main():
26      """Instantiate the application object and run the application"""      """Instantiate the application object and run the application"""
27      global app  
28      app = ThubanApplication(0)      if verify_versions():
29      if len(sys.argv) > 1:          app = ThubanApplication(0)
30          app.OpenSession(sys.argv[1])          if len(sys.argv) > 1:
31      app.MainLoop()              app.OpenSession(sys.argv[1])
32            #app.top.ShowSessionTree()
33            app.top.ShowLegend()
34            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

Legend:
Removed from v.6  
changed lines
  Added in v.579

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26