/[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 579 by jonathan, Mon Mar 31 18:32:07 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.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.230  
changed lines
  Added in v.579

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26