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

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

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

revision 488 by jonathan, Fri Mar 7 18:21:25 2003 UTC revision 504 by jonathan, Mon Mar 10 15:12:24 2003 UTC
# Line 23  from Thuban.Model.layer import Layer Line 23  from Thuban.Model.layer import Layer
23  from Thuban.Model.map import Map  from Thuban.Model.map import Map
24    
25  from dialogs import NonModalDialog  from dialogs import NonModalDialog
26  from messages import SESSION_CHANGED, SELECTED_LAYER  from messages import SESSION_REPLACED, SELECTED_LAYER
27    
28  BMP_SIZE = 15  BMP_SIZE = 15
29    
# Line 62  class SessionTreeCtrl(wxTreeCtrl): Line 62  class SessionTreeCtrl(wxTreeCtrl):
62          # Dictionary mapping layer id's to tree items          # Dictionary mapping layer id's to tree items
63          self.layer_to_item = {}          self.layer_to_item = {}
64    
65          self.app.Subscribe(SESSION_CHANGED, self.session_changed)          self.app.Subscribe(SESSION_REPLACED, self.session_changed)
66          self.app.interactor.Subscribe(SELECTED_LAYER, self.layer_selected)          self.app.interactor.Subscribe(SELECTED_LAYER, self.layer_selected)
67    
68          # the session currently displayed in the tree          # the session currently displayed in the tree
# Line 80  class SessionTreeCtrl(wxTreeCtrl): Line 80  class SessionTreeCtrl(wxTreeCtrl):
80          if self.session is not None:          if self.session is not None:
81              self.session.Unsubscribe(CHANGED, self.update_tree)              self.session.Unsubscribe(CHANGED, self.update_tree)
82              self.session = None              self.session = None
83          self.app.Unsubscribe(SESSION_CHANGED, self.session_changed)          self.app.Unsubscribe(SESSION_REPLACED, self.session_changed)
84          self.app.interactor.Unsubscribe(SELECTED_LAYER, self.layer_selected)          self.app.interactor.Unsubscribe(SELECTED_LAYER, self.layer_selected)
85    
86      def update_tree(self, *args):      def update_tree(self, *args):
# Line 212  class SessionTreeView(NonModalDialog): Line 212  class SessionTreeView(NonModalDialog):
212                                  _("Session"))                                  _("Session"))
213          self.tree = SessionTreeCtrl(self, -1, app)          self.tree = SessionTreeCtrl(self, -1, app)
214    
215      def Shutdown(self):      def OnClose(self, event):
216            NonModalDialog.OnClose(self, event)
217    
218          # if there were a way to get notified when the tree control          # if there were a way to get notified when the tree control
219          # itself is destroyed we could use that to unsubscribe instead          # itself is destroyed we could use that to unsubscribe instead
220          # of doing it here. (EVT_WINDOW_DESTROY doesn't seem to sent at          # of doing it here. (EVT_WINDOW_DESTROY doesn't seem to sent at
221          # all)          # all)
222          self.tree.unsubscribe_all()          self.tree.unsubscribe_all()
223    
         # this needs to come last because Destroy will be called  
         NonModalDialog.Shutdown(self)  
   

Legend:
Removed from v.488  
changed lines
  Added in v.504

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26