/[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 1766 by jan, Wed Oct 1 09:52:28 2003 UTC
# Line 1  Line 1 
1  #! /usr/bin/python  # Copyright (C) 2001, 2002, 2003 by Intevation GmbH
 # Copyright (C) 2001 by Intevation GmbH  
2  # Authors:  # Authors:
3  # Jan-Oliver Wagner <[email protected]>  # Jan-Oliver Wagner <[email protected]>
4  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
# Line 15  __version__ = "$Revision$" Line 14  __version__ = "$Revision$"
14    
15  import sys  import sys
16    
 # 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, "")  
   
17  from application import ThubanApplication  from application import ThubanApplication
18    import Thuban.version
19    
20  def main():  def main():
21      """Instantiate the application object and run the application"""      """Instantiate the application object and run the application"""
22      global app  
23      app = ThubanApplication(0)      if verify_versions():
24      if len(sys.argv) > 1:          app = ThubanApplication(0)
25          app.OpenSession(sys.argv[1])          if len(sys.argv) > 1:
26      app.MainLoop()              app.OpenSession(sys.argv[1])
27            app.MainLoop()
28            # sys.excepthook is set in ThubanApplication.OnInit()
29            sys.excepthook = sys.__excepthook__
30    
31    def verify_versions():
32        """Check some library versions.
33    
34        Print a message containing any libraries which are wrong.
35        Return True if everything is OK, otherwise False.
36        """
37        
38        errors = Thuban.version.verify_versions()
39    
40        if len(errors) > 0:
41            msg = " The following version errors were detected:"
42    
43            for e in errors:
44                msg += "\n     " + e
45    
46    #       if use_msg_box:
47    #           # XXX: use a message box to display the errors
48    #           pass
49    
50            print "\n*******************************************************"
51            print msg
52            print "*******************************************************\n"
53    
54            return False
55    
56        return True

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26