/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/application.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/application.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 242 by bh, Wed Jul 24 17:16:31 2002 UTC revision 374 by jan, Mon Jan 27 14:20:02 2003 UTC
# Line 19  from wxPython.wx import * Line 19  from wxPython.wx import *
19    
20  from Thuban.Lib.connector import Publisher  from Thuban.Lib.connector import Publisher
21    
22    from Thuban import _
23  from Thuban.Model.session import create_empty_session  from Thuban.Model.session import create_empty_session
24  from Thuban.Model.save import save_session  from Thuban.Model.save import save_session
25  from Thuban.Model.load import load_session  from Thuban.Model.load import load_session
# Line 54  class ThubanApplication(wxApp, Publisher Line 55  class ThubanApplication(wxApp, Publisher
55          self.create_session()          self.create_session()
56          return true          return true
57    
58        def OnExit(self):
59            """Clean up code.
60    
61            Extend this in derived classes if needed.
62            """
63            self.session.Destroy()
64            self.interactor.Destroy()
65            Publisher.Destroy(self)
66    
67        def MainLoop(self):
68            """Call the inherited MainLoop method and then call OnExit.
69    
70            In wxPython OnExit isn't called automatically, unfortunately, so
71            we do it here.
72            """
73            wxApp.MainLoop(self)
74            self.OnExit()
75    
76      def read_startup_files(self):      def read_startup_files(self):
77          """Read the startup files."""          """Read the startup files."""
78          # for now the startup file is ~/.thuban/thubanstart.py          # for now the startup file is ~/.thuban/thubanstart.py
# Line 68  class ThubanApplication(wxApp, Publisher Line 87  class ThubanApplication(wxApp, Publisher
87                      if tb.tb_next is not None:                      if tb.tb_next is not None:
88                          # The ImportError exception was raised from                          # The ImportError exception was raised from
89                          # inside the thubanstart module.                          # inside the thubanstart module.
90                          sys.stderr.write("Cannot import the thubanstart"                          sys.stderr.write(_("Cannot import the thubanstart"
91                                           "module\n")                                           "module\n"))
92                          traceback.print_exc(None, sys.stderr)                          traceback.print_exc(None, sys.stderr)
93                      else:                      else:
94                          # There's no thubanstart module.                          # There's no thubanstart module.
95                          sys.stderr.write("No thubanstart module available\n")                          sys.stderr.write(_("No thubanstart module available\n"))
96                  finally:                  finally:
97                      # make sure we delete the traceback object,                      # make sure we delete the traceback object,
98                      # otherwise there's be circular references involving                      # otherwise there's be circular references involving
99                      # the current stack frame                      # the current stack frame
100                      del tb                      del tb
101              except:              except:
102                  sys.stderr.write("Cannot import the thubanstart module\n")                  sys.stderr.write(_("Cannot import the thubanstart module\n"))
103                  traceback.print_exc(None, sys.stderr)                  traceback.print_exc(None, sys.stderr)
104          else:          else:
105              # There's no .thuban directory              # There's no .thuban directory
106              sys.stderr.write("No ~/.thuban directory\n")              sys.stderr.write(_("No ~/.thuban directory\n"))
107    
108      def CreateMainWindow(self):      def CreateMainWindow(self):
109          """Create and return the main window for the application.          """Create and return the main window for the application.
# Line 97  class ThubanApplication(wxApp, Publisher Line 116  class ThubanApplication(wxApp, Publisher
116          for the interactor argument of the standard Thuban main window          for the interactor argument of the standard Thuban main window
117          class) has already been instantiated.          class) has already been instantiated.
118          """          """
119          msg = ("This is the wxPython-based Graphical User Interface"          msg = (_("This is the wxPython-based Graphical User Interface"
120                 " for exploring geographic data")                 " for exploring geographic data"))
121          return mainwindow.MainWindow(NULL, -1, "Thuban", self, self.interactor,          return mainwindow.MainWindow(NULL, -1, "Thuban", self, self.interactor,
122                                       initial_message = msg)                                       initial_message = msg)
123    

Legend:
Removed from v.242  
changed lines
  Added in v.374

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26