/[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 539 by bh, Fri Jul 19 13:21:14 2002 UTC revision 540 by jonathan, Wed Mar 19 15:37:24 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.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.539  
changed lines
  Added in v.540

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26