/[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 540 by jonathan, Wed Mar 19 15:37:24 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.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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26