205 |
|
|
206 |
def MoveCurrentItemUp(self): |
def MoveCurrentItemUp(self): |
207 |
cur_id = self.GetSelection() |
cur_id = self.GetSelection() |
208 |
assert(cur_id.IsOk()) |
assert cur_id.IsOk() |
209 |
|
|
210 |
cur_data = self.GetPyData(cur_id) |
cur_data = self.GetPyData(cur_id) |
211 |
|
|
221 |
elif isinstance(cur_data, ClassGroup): |
elif isinstance(cur_data, ClassGroup): |
222 |
pass |
pass |
223 |
else: |
else: |
224 |
assert(False, "Shouldn't be here.") |
assert False, "Shouldn't be here." |
225 |
pass |
pass |
226 |
|
|
227 |
def MoveCurrentItemDown(self): |
def MoveCurrentItemDown(self): |
228 |
cur_id = self.GetSelection() |
cur_id = self.GetSelection() |
229 |
assert(cur_id.IsOk()) |
assert cur_id.IsOk() |
230 |
|
|
231 |
cur_data = self.GetPyData(cur_id) |
cur_data = self.GetPyData(cur_id) |
232 |
|
|
235 |
elif isinstance(cur_data, ClassGroup): |
elif isinstance(cur_data, ClassGroup): |
236 |
pass |
pass |
237 |
else: |
else: |
238 |
assert(False, "Shouldn't be here.") |
assert False, "Shouldn't be here." |
239 |
pass |
pass |
240 |
|
|
241 |
|
|
263 |
|
|
264 |
# def DoOnClassify(self): |
# def DoOnClassify(self): |
265 |
# id = self.GetSelection() |
# id = self.GetSelection() |
266 |
# assert(id.IsOk()) |
# assert id.IsOk() |
267 |
|
|
268 |
# item = self.GetPyData(id) |
# item = self.GetPyData(id) |
269 |
# if isinstance(item, ClassGroup): |
# if isinstance(item, ClassGroup): |
270 |
# id = self.GetItemParent(id) |
# id = self.GetItemParent(id) |
271 |
# assert(id.IsOk()) |
# assert id.IsOk() |
272 |
# item = self.GetPyData(id) |
# item = self.GetPyData(id) |
273 |
|
|
274 |
# # XXX: THIS IS SUCH AWFUL STYLE! YUCK! |
# # XXX: THIS IS SUCH AWFUL STYLE! YUCK! |
275 |
# self.parent.mainWindow.OpenClassifier(item) |
# self.parent.mainWindow.OpenClassifier(item) |
276 |
# #assert(False, "XXX: FIXME HERE") |
# #assert False, "XXX: FIXME HERE" |
277 |
|
|
278 |
def Sort(self): |
def Sort(self): |
279 |
self.SortChildren(self.GetRootItem()) |
self.SortChildren(self.GetRootItem()) |
292 |
self.parent.DoOnClassify() |
self.parent.DoOnClassify() |
293 |
|
|
294 |
def _OnMsgLayerChanged(self, layer): |
def _OnMsgLayerChanged(self, layer): |
295 |
assert(isinstance(layer, Layer)) |
assert isinstance(layer, Layer) |
296 |
|
|
297 |
id = self.layer2id[layer] |
id = self.layer2id[layer] |
298 |
assert(id.IsOk()) |
assert id.IsOk() |
299 |
|
|
300 |
# XXX: yikes! this is so bad, we should be doing what is |
# XXX: yikes! this is so bad, we should be doing what is |
301 |
# commented out, but there is a problem with keeping |
# commented out, but there is a problem with keeping |
312 |
self.EnsureVisible(id) |
self.EnsureVisible(id) |
313 |
|
|
314 |
def _OnMsgMapLayersAddedRemoved(self, map): |
def _OnMsgMapLayersAddedRemoved(self, map): |
315 |
assert(map is self.map) |
assert map is self.map |
316 |
|
|
317 |
self.__FillTree(self.map) |
self.__FillTree(self.map) |
318 |
|
|
319 |
def _OnMsgLayerVisibilityChanged(self, layer): |
def _OnMsgLayerVisibilityChanged(self, layer): |
320 |
assert(isinstance(layer, Layer)) |
assert isinstance(layer, Layer) |
321 |
|
|
322 |
self.__ShowHideLayer(layer) |
self.__ShowHideLayer(layer) |
323 |
|
|
324 |
def GetSelectedHierarchy(self): |
def GetSelectedHierarchy(self): |
325 |
id = self.GetSelection() |
id = self.GetSelection() |
326 |
assert(id.IsOk()) |
assert id.IsOk() |
327 |
|
|
328 |
layer = self.GetPyData(id) |
layer = self.GetPyData(id) |
329 |
group = None |
group = None |
330 |
|
|
331 |
if isinstance(layer, ClassGroup): |
if isinstance(layer, ClassGroup): |
332 |
id = self.GetItemParent(id) |
id = self.GetItemParent(id) |
333 |
assert(id.IsOk()) |
assert id.IsOk() |
334 |
group = layer |
group = layer |
335 |
layer = self.GetPyData(id) |
layer = self.GetPyData(id) |
336 |
|
|
338 |
|
|
339 |
def __FillTree(self, map): |
def __FillTree(self, map): |
340 |
|
|
341 |
assert(isinstance(map, Map)) |
assert isinstance(map, Map) |
342 |
|
|
343 |
self.Freeze() |
self.Freeze() |
344 |
|
|
368 |
l.Subscribe(LAYER_VISIBILITY_CHANGED, |
l.Subscribe(LAYER_VISIBILITY_CHANGED, |
369 |
self._OnMsgLayerVisibilityChanged) |
self._OnMsgLayerVisibilityChanged) |
370 |
self.SetPyData(id, l) |
self.SetPyData(id, l) |
371 |
font = self.GetItemFont(id) |
self.__SetVisibilityStyle(l.Visible(), id) |
|
if not l.Visible(): |
|
|
font.SetStyle(wxITALIC) |
|
|
self.SetItemFont(id, font) |
|
372 |
|
|
373 |
self.layer2id[l] = id |
self.layer2id[l] = id |
374 |
|
|
388 |
|
|
389 |
shapeType = layer.ShapeType() |
shapeType = layer.ShapeType() |
390 |
|
|
391 |
|
show = layer.Visible() |
392 |
for g in clazz: |
for g in clazz: |
393 |
id = self.AppendItem(pid, g.GetDisplayText()) |
id = self.AppendItem(pid, g.GetDisplayText()) |
394 |
self.SetPyData(id, g) |
self.SetPyData(id, g) |
395 |
|
self.__SetVisibilityStyle(show, id) |
396 |
|
|
397 |
bmp = self.__BuildGroupImage(g, shapeType) |
bmp = self.__BuildGroupImage(g, shapeType) |
398 |
|
|
405 |
self.Thaw() |
self.Thaw() |
406 |
|
|
407 |
def __BuildGroupImage(self, group, shapeType): |
def __BuildGroupImage(self, group, shapeType): |
408 |
assert(isinstance(group, ClassGroup)) |
assert isinstance(group, ClassGroup) |
409 |
|
|
410 |
bmp = wxEmptyBitmap(BMP_SIZE_W, BMP_SIZE_H) |
bmp = wxEmptyBitmap(BMP_SIZE_W, BMP_SIZE_H) |
411 |
#brush = wxBrush(Color2wxColour(item[1]), wxSOLID) |
#brush = wxBrush(Color2wxColour(item[1]), wxSOLID) |
428 |
|
|
429 |
self.DeleteAllItems() |
self.DeleteAllItems() |
430 |
|
|
431 |
def __ShowHideHelper(self, show, id): |
def __SetVisibilityStyle(self, visible, id): |
432 |
font = self.GetItemFont(id) |
font = self.GetItemFont(id) |
433 |
|
|
434 |
if show: |
if visible: |
435 |
font.SetStyle(wxNORMAL) |
font.SetStyle(wxNORMAL) |
436 |
color = wxBLACK |
color = wxBLACK |
437 |
else: |
else: |
443 |
|
|
444 |
def __ShowHideLayer(self, layer): |
def __ShowHideLayer(self, layer): |
445 |
parent = self.layer2id[layer] |
parent = self.layer2id[layer] |
446 |
assert(parent.IsOk()) |
assert parent.IsOk() |
|
|
|
|
show = layer.Visible() |
|
447 |
|
|
448 |
|
visible = layer.Visible() |
449 |
|
|
450 |
self.__ShowHideHelper(show, parent) |
self.__SetVisibilityStyle(visible, parent) |
451 |
|
|
452 |
id, cookie = self.GetFirstChild(parent, 123) |
id, cookie = self.GetFirstChild(parent, 123) |
453 |
|
|
454 |
while id.IsOk(): |
while id.IsOk(): |
455 |
self.__ShowHideHelper(show, id) |
self.__SetVisibilityStyle(visible, id) |
456 |
id, cookie = self.GetNextChild(parent, cookie) |
id, cookie = self.GetNextChild(parent, cookie) |
457 |
|
|