/[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 226 by bh, Thu Jul 18 16:26:11 2002 UTC revision 1520 by bh, Wed Jul 30 12:34:02 2003 UTC
# Line 1  Line 1 
1  #! /usr/bin/python  #! /usr/bin/python
2  # Copyright (C) 2001, 2002 by Intevation GmbH  # Copyright (C) 2001, 2002, 2003 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  
 try:  
     import locale  
     locale.setlocale(locale.LC_ALL, "")  
 except ImportError:  
     # the locale module may not be available on some systems  
     pass  
   
18  from application import ThubanApplication  from application import ThubanApplication
19    import Thuban.version
20    
21  def main():  def main():
22      """Instantiate the application object and run the application"""      """Instantiate the application object and run the application"""
23      app = ThubanApplication(0)  
24      if len(sys.argv) > 1:      if verify_versions():
25          app.OpenSession(sys.argv[1])          app = ThubanApplication(0)
26      app.top.ShowSessionTree()          if len(sys.argv) > 1:
27      app.MainLoop()              app.OpenSession(sys.argv[1])
28            app.MainLoop()
29            # sys.excepthook is set in ThubanApplication.OnInit()
30            sys.excepthook = sys.__excepthook__
31    
32    def verify_versions():
33        """Check some library versions.
34    
35        Print a message containing any libraries which are wrong.
36        Return True if everything is OK, otherwise False.
37        """
38        
39        errors = Thuban.version.verify_versions()
40    
41        if len(errors) > 0:
42            msg = " The following version errors were detected:"
43    
44            for e in errors:
45                msg += "\n     " + e
46    
47    #       if use_msg_box:
48    #           # XXX: use a message box to display the errors
49    #           pass
50    
51            print "\n*******************************************************"
52            print msg
53            print "*******************************************************\n"
54    
55            return False
56    
57        return True

Legend:
Removed from v.226  
changed lines
  Added in v.1520

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26