31 |
wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS) |
wxPanel.__init__(self, parent, -1, style=wxWANTS_CHARS) |
32 |
self.app = app |
self.app = app |
33 |
|
|
34 |
|
# boolean to indicate that we manipulate the selection ourselves |
35 |
|
# so that we can ignore the selection events generated |
36 |
|
self.changing_selection = 0 |
37 |
|
|
38 |
EVT_SIZE(self, self.OnSize) |
EVT_SIZE(self, self.OnSize) |
39 |
self.tree = wxTreeCtrl(self, -1) |
self.tree = wxTreeCtrl(self, -1) |
40 |
|
|
115 |
break |
break |
116 |
item = tree.GetItemParent(item) |
item = tree.GetItemParent(item) |
117 |
|
|
118 |
self.tree.SelectItem(item) |
self.changing_selection = 1 |
119 |
|
try: |
120 |
|
self.tree.SelectItem(item) |
121 |
|
finally: |
122 |
|
self.changing_selection = 0 |
123 |
|
|
124 |
def SelectedLayer(self): |
def SelectedLayer(self): |
125 |
"""Return the layer object currently selected in the tree. |
"""Return the layer object currently selected in the tree. |
131 |
return None |
return None |
132 |
|
|
133 |
def OnSelChanged(self, event): |
def OnSelChanged(self, event): |
134 |
|
if self.changing_selection: |
135 |
|
# we're changing the selection ourselves (probably through |
136 |
|
# self.normalize_selection(). ignore the event. |
137 |
|
return |
138 |
self.normalize_selection() |
self.normalize_selection() |
139 |
layer = self.SelectedLayer() |
layer = self.SelectedLayer() |
140 |
if layer is not None: |
if layer is not None: |