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 |
|
|
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. |
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 |