/[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 19 by bh, Tue Sep 4 15:11:27 2001 UTC revision 1232 by jonathan, Wed Jun 18 14:47:06 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  
 try:  
     import locale  
     locale.setlocale(locale.LC_ALL, "")  
 except ImportError:  
     # the locale module may not be available on some systems  
     pass  
   
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.MainLoop()
33    
34    
35    def wxCHECK_VERSION(major,minor,release): \
36        return (wxMAJOR_VERSION > (major) or \
37            (wxMAJOR_VERSION == (major) \
38                and wxMINOR_VERSION > (minor)) or \
39            (wxMAJOR_VERSION == (major) \
40                and wxMINOR_VERSION == (minor) \
41                and wxRELEASE_NUMBER >= (release)))
42    
43    def verify_versions():
44        """Check some library versions.
45    
46        Print a message containing any libraries which are wrong.
47        Return True if everything is OK, otherwise False.
48    
49        Specifically, check the following libraries:
50    
51            wxPython >= v2.4.0
52            Python >= v2.2.1
53            proj >= v4.4.5
54            gtk > v1.2.0
55        """
56        
57        errors = []
58    
59        if not wxCHECK_VERSION(2, 4, 0):
60            errors.append("wxPython < 2.4.0")
61    
62        if sys.hexversion < 0x0202010f:
63            errors.append("Python < 2.2.1")
64    
65        #
66        # This only tells someone that they COMPILED thuban with the wrong
67        # version of proj. If they are running prebuilt binaries
68        # check_version should always return true.
69        #
70        if not wxproj.check_version(4, 4, 5):
71            errors.append("proj < 4.4.5")
72    
73        if wxPlatform == "__WXGTK__":
74            if not wxproj.check_version_gtk(1, 2, 0):
75                errors.append("gtk < 1.2")
76    
77        if len(errors) > 0:
78            msg = " The following version errors were detected:"
79    
80            for e in errors:
81                msg += "\n     " + e
82    
83    #       if use_msg_box:
84    #           # XXX: use a message box to display the errors
85    #           pass
86    
87            print "\n*******************************************************"
88            print msg
89            print "*******************************************************\n"
90    
91            return False
92    
93        return True

Legend:
Removed from v.19  
changed lines
  Added in v.1232

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26