/[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 374 by jan, Mon Jan 27 14:20:02 2003 UTC revision 503 by jonathan, Mon Mar 10 15:12:09 2003 UTC
# Line 1  Line 1 
1  # Copyright (C) 2001, 2002 by Intevation GmbH  # Copyright (C) 2001, 2002, 2003 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 30  import tree Line 30  import tree
30  from interactor import Interactor  from interactor import Interactor
31  import mainwindow  import mainwindow
32    
33  from messages import SESSION_CHANGED  from messages import SESSION_REPLACED
34    
35    
36    
# Line 45  class ThubanApplication(wxApp, Publisher Line 45  class ThubanApplication(wxApp, Publisher
45      """      """
46    
47      def OnInit(self):      def OnInit(self):
48            self.splash = self.splash_screen()
49            if self.splash is not None:
50                self.splash.Show()
51          self.read_startup_files()          self.read_startup_files()
52          self.interactor = Interactor(None)          self.interactor = Interactor(None)
53          top = self.CreateMainWindow()          self.top = self.CreateMainWindow()
54          top.Show(true)          self.SetTopWindow(self.top)
55          self.top = top          if self.splash is None:
56          self.SetTopWindow(top)              self.ShowMainWindow()
57          self.session = None          self.session = None
58          self.create_session()          self.create_session()
59          return true          return true
# Line 105  class ThubanApplication(wxApp, Publisher Line 108  class ThubanApplication(wxApp, Publisher
108              # There's no .thuban directory              # There's no .thuban directory
109              sys.stderr.write(_("No ~/.thuban directory\n"))              sys.stderr.write(_("No ~/.thuban directory\n"))
110    
111        def splash_screen(self):
112            """Create and return a splash screen.
113    
114            This method is called by OnInit to determine whether the
115            application should have a splashscreen. If the application
116            should display a splash screen override this method in a derived
117            class and have it create and return the wxSplashScreen instance.
118            The implementation of this method in the derived class should
119            also arranged for ShowMainWindow to be called.
120    
121            The default implementation simply returns None so that no splash
122            screen is shown and ShowMainWindow will be called automatically.
123            """
124            return None
125    
126        def ShowMainWindow(self):
127            """Show the main window
128    
129            Normally this method is automatically called by OnInit to show
130            the main window. However, if the splash_screen method has
131            returned a splashscreen it is expected that the derived class
132            also arranges for ShowMainWindow to be called at the appropriate
133            time.
134            """
135            self.top.Show(true)
136          
137      def CreateMainWindow(self):      def CreateMainWindow(self):
138          """Create and return the main window for the application.          """Create and return the main window for the application.
139    
# Line 128  class ThubanApplication(wxApp, Publisher Line 157  class ThubanApplication(wxApp, Publisher
157      def SetSession(self, session):      def SetSession(self, session):
158          """Make session the new session.          """Make session the new session.
159    
160          Issue SESSION_CHANGED after self.session has become the new          Issue SESSION_REPLACED after self.session has become the new
161          session. After the session has been assigned call          session. After the session has been assigned call
162          self.subscribe_session() with the new session and          self.subscribe_session() with the new session and
163          self.unsubscribe_session with the old one.          self.unsubscribe_session with the old one.
# Line 136  class ThubanApplication(wxApp, Publisher Line 165  class ThubanApplication(wxApp, Publisher
165          oldsession = self.session          oldsession = self.session
166          self.session = session          self.session = session
167          self.subscribe_session(self.session)          self.subscribe_session(self.session)
168          self.issue(SESSION_CHANGED)          self.issue(SESSION_REPLACED)
169          self.interactor.SetSession(session)          self.interactor.SetSession(session)
170          self.maps_changed()          self.maps_changed()
171          if oldsession is not None:          if oldsession is not None:

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26