/[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 161 by bh, Wed May 8 13:47:10 2002 UTC revision 198 by jan, Thu Jun 20 15:24:26 2002 UTC
# Line 12  __version__ = "$Revision$" Line 12  __version__ = "$Revision$"
12  from wxPython.wx import *  from wxPython.wx import *
13    
14  from Thuban.Model.messages import MAPS_CHANGED, MAP_PROJECTION_CHANGED, \  from Thuban.Model.messages import MAPS_CHANGED, MAP_PROJECTION_CHANGED, \
15       LAYERS_CHANGED, LAYER_LEGEND_CHANGED, LAYER_VISIBILITY_CHANGED       LAYERS_CHANGED, LAYER_LEGEND_CHANGED, LAYER_VISIBILITY_CHANGED, \
16         EXTENSIONS_CHANGED, EXTENSION_OBJECTS_CHANGED
17  from Thuban.Model.layer import Layer, shapetype_names  from Thuban.Model.layer import Layer, shapetype_names
18  from Thuban.Model.map import Map  from Thuban.Model.map import Map
19    
# Line 27  def color_string(color): Line 28  def color_string(color):
28    
29  class SessionTreeCtrl(wxTreeCtrl):  class SessionTreeCtrl(wxTreeCtrl):
30    
31      # the session channels to subscribe to to update the tree      # the session channels to subscribe to update the tree
32      session_channels = (MAPS_CHANGED, MAP_PROJECTION_CHANGED,      session_channels = (MAPS_CHANGED, MAP_PROJECTION_CHANGED,
33                          LAYERS_CHANGED, LAYER_LEGEND_CHANGED,                          LAYERS_CHANGED, LAYER_LEGEND_CHANGED,
34                          LAYER_VISIBILITY_CHANGED)                          LAYER_VISIBILITY_CHANGED, EXTENSIONS_CHANGED,
35                            EXTENSION_OBJECTS_CHANGED)
36    
37      def __init__(self, parent, ID, app):      def __init__(self, parent, ID, app):
38          # 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.
# Line 111  class SessionTreeCtrl(wxTreeCtrl): Line 113  class SessionTreeCtrl(wxTreeCtrl):
113                          text = "Hidden"                          text = "Hidden"
114                      self.AppendItem(layeritem, text)                      self.AppendItem(layeritem, text)
115                      self.AppendItem(layeritem, "Shapes: %d" %layer.NumShapes())                      self.AppendItem(layeritem, "Shapes: %d" %layer.NumShapes())
116                      self.AppendItem(layeritem,                      bbox = layer.LatLongBoundingBox()
117                                      ("Extent (lat-lon): (%g, %g, %g, %g)"                      if bbox is not None:
118                                       % layer.LatLongBoundingBox()))                          self.AppendItem(layeritem,
119                                            ("Extent (lat-lon): (%g, %g, %g, %g)"
120                                             % bbox))
121                        else:
122                            self.AppendItem(layeritem, ("Extent (lat-lon):"))
123                      self.AppendItem(layeritem,                      self.AppendItem(layeritem,
124                                      "Shapetype: %s"                                      "Shapetype: %s"
125                                      % shapetype_names[layer.ShapeType()])                                      % shapetype_names[layer.ShapeType()])
# Line 125  class SessionTreeCtrl(wxTreeCtrl): Line 131  class SessionTreeCtrl(wxTreeCtrl):
131              self.Expand(mapitem)              self.Expand(mapitem)
132          self.Expand(root)          self.Expand(root)
133    
134            for extension in session.Extensions():
135                extensionitem = self.AppendItem(root, "Extension: %s" %
136                                                extension.title)
137                for object in extension.Objects():
138                    objectitem = self.AppendItem(extensionitem, "%s: %s" %
139                                                 (object.title, object.name))
140                self.Expand(extensionitem)
141    
142    
143      def session_changed(self, *args):      def session_changed(self, *args):
144          new_session = self.app.session          new_session = self.app.session
145          # if the session has changed subscribe/unsubscribe          # if the session has changed subscribe/unsubscribe

Legend:
Removed from v.161  
changed lines
  Added in v.198

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26