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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 39 - (hide annotations)
Thu Sep 6 17:18:22 2001 UTC (23 years, 6 months ago) by bh
Original Path: trunk/thuban/Thuban/UI/application.py
File MIME type: text/x-python
File size: 2005 byte(s)
Create the session tree view in main with the new mainwindow method
ShowSessionTree and not directly the application's OnInit method

1 bh 6 # Copyright (C) 2001 by Intevation GmbH
2     # Authors:
3     # Jan-Oliver Wagner <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with Thuban for details.
7    
8     """
9     Thuban's application object.
10     """
11    
12     __version__ = "$Revision$"
13    
14     from wxPython.wx import *
15    
16     from Thuban.Lib.connector import Publisher
17    
18     from Thuban.Model.session import create_empty_session
19     from Thuban.Model.save import save_session
20     from Thuban.Model.load import load_session
21    
22     import view
23     import tree
24     from interactor import Interactor
25     from mainwindow import MainWindow
26    
27     from messages import SESSION_CHANGED
28    
29    
30    
31     class ThubanApplication(wxApp, Publisher):
32    
33     """
34     Thuban's application class.
35    
36     All wxWindows programs have to have an instance of an application
37     class derived from wxApp. In Thuban the application class holds
38     references to the main window, the session and the interactor.
39     """
40    
41     def OnInit(self):
42     self.interactor = Interactor(None)
43 bh 25 top = MainWindow(NULL, -1, self.interactor)
44 bh 6 top.Show(true)
45     self.top = top
46     self.SetTopWindow(top)
47     self.session = None
48     self.create_session()
49     return true
50    
51     def SetSession(self, session):
52     oldsession = self.session
53     self.session = session
54     self.issue(SESSION_CHANGED)
55     self.interactor.SetSession(session)
56     self.set_map()
57     if oldsession is not None:
58     oldsession.Destroy()
59    
60     def create_session(self):
61     # Create a simple default session
62     self.SetSession(create_empty_session())
63    
64     def OpenSession(self, filename):
65     session = load_session(filename)
66     session.SetFilename(filename)
67     session.UnsetModified()
68     self.SetSession(session)
69    
70     def SaveSession(self):
71     save_session(self.session, self.session.filename)
72    
73     def set_map(self):
74     if self.session.HasMaps():
75     self.top.SetMap(self.session.Maps()[0])
76     else:
77     self.top.SetMap(None)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26