/[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 218 by bh, Thu Jul 18 12:54:48 2002 UTC revision 233 by bh, Fri Jul 19 15:15:16 2002 UTC
# Line 13  from types import StringType Line 13  from types import StringType
13    
14  from wxPython.wx import *  from wxPython.wx import *
15    
16  from Thuban.Model.messages import MAPS_CHANGED, MAP_PROJECTION_CHANGED, \  from Thuban.Model.messages import CHANGED
17       LAYERS_CHANGED, LAYER_LEGEND_CHANGED, LAYER_VISIBILITY_CHANGED, \  from Thuban.Model.layer import Layer
      EXTENSIONS_CHANGED, EXTENSION_OBJECTS_CHANGED  
 from Thuban.Model.layer import Layer, shapetype_names  
18  from Thuban.Model.map import Map  from Thuban.Model.map import Map
19    
20  from dialogs import NonModalDialog  from dialogs import NonModalDialog
# Line 45  class SessionTreeCtrl(wxTreeCtrl): Line 43  class SessionTreeCtrl(wxTreeCtrl):
43            value of TreeInfo.            value of TreeInfo.
44      """      """
45    
     # the session channels to subscribe to update the tree  
     session_channels = (MAPS_CHANGED, MAP_PROJECTION_CHANGED,  
                         LAYERS_CHANGED, LAYER_LEGEND_CHANGED,  
                         LAYER_VISIBILITY_CHANGED, EXTENSIONS_CHANGED,  
                         EXTENSION_OBJECTS_CHANGED)  
   
46      def __init__(self, parent, ID, app):      def __init__(self, parent, ID, app):
47          # Use the WANTS_CHARS style so the panel doesn't eat the Return key.          # Use the WANTS_CHARS style so the panel doesn't eat the Return key.
48          wxTreeCtrl.__init__(self, parent, ID)          wxTreeCtrl.__init__(self, parent, ID)
# Line 76  class SessionTreeCtrl(wxTreeCtrl): Line 68  class SessionTreeCtrl(wxTreeCtrl):
68    
69      def unsubscribe_all(self):      def unsubscribe_all(self):
70          if self.session is not None:          if self.session is not None:
71              for channel in self.session_channels:              self.session.Unsubscribe(CHANGED, self.update_tree)
                 self.session.Unsubscribe(channel, self.update_tree)  
72              self.session = None              self.session = None
73          self.app.Unsubscribe(SESSION_CHANGED, self.session_changed)          self.app.Unsubscribe(SESSION_CHANGED, self.session_changed)
74          self.app.interactor.Unsubscribe(SELECTED_LAYER, self.layer_selected)          self.app.interactor.Unsubscribe(SELECTED_LAYER, self.layer_selected)
# Line 131  class SessionTreeCtrl(wxTreeCtrl): Line 122  class SessionTreeCtrl(wxTreeCtrl):
122          # if the session has changed subscribe/unsubscribe          # if the session has changed subscribe/unsubscribe
123          if self.session is not new_session:          if self.session is not new_session:
124              if self.session is not None:              if self.session is not None:
125                  for channel in self.session_channels:                  self.session.Unsubscribe(CHANGED, self.update_tree)
                     self.session.Unsubscribe(channel, self.update_tree)  
126              if new_session is not None:              if new_session is not None:
127                  for channel in self.session_channels:                  new_session.Subscribe(CHANGED, self.update_tree)
                     new_session.Subscribe(channel, self.update_tree)  
128              self.session = new_session              self.session = new_session
129          self.update_tree()          self.update_tree()
130    

Legend:
Removed from v.218  
changed lines
  Added in v.233

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26