/[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 230 by bh, Fri Jul 19 13:21:14 2002 UTC revision 1232 by jonathan, Wed Jun 18 14:47:06 2003 UTC
# Line 17  import sys Line 17  import sys
17    
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      app = ThubanApplication(0)  
28      if len(sys.argv) > 1:      if verify_versions():
29          app.OpenSession(sys.argv[1])          app = ThubanApplication(0)
30      app.top.ShowSessionTree()          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.230  
changed lines
  Added in v.1232

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26