[GRASS-SVN] r56371 - grass/trunk/gui/wxpython/lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu May 23 01:49:30 PDT 2013
Author: annakrat
Date: 2013-05-23 01:49:30 -0700 (Thu, 23 May 2013)
New Revision: 56371
Modified:
grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI/layertree: fix layer selection (results in wrong layer order when loading workspace)
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2013-05-23 07:35:35 UTC (rev 56370)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2013-05-23 08:49:30 UTC (rev 56371)
@@ -848,9 +848,10 @@
self.first = True
+ selectedLayer = self.GetSelectedLayer()
# deselect active item
- if self.layer_selected:
- self.SelectItem(self.layer_selected, select = False)
+ if selectedLayer:
+ self.SelectItem(selectedLayer, select=False)
Debug.msg (3, "LayerTree().AddLayer(): ltype=%s" % (ltype))
@@ -870,11 +871,11 @@
ctrl.SetToolTipString(_("Click to edit layer settings"))
self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenu, ctrl)
# add layer to the layer tree
- if self.layer_selected and self.layer_selected != self.GetRootItem():
- if self.GetLayerInfo(self.layer_selected, key = 'type') == 'group' \
- and self.IsExpanded(self.layer_selected):
+ if selectedLayer and selectedLayer != self.GetRootItem():
+ if self.GetLayerInfo(selectedLayer, key = 'type') == 'group' \
+ and self.IsExpanded(selectedLayer):
# add to group (first child of self.layer_selected) if group expanded
- layer = self.PrependItem(parent = self.layer_selected,
+ layer = self.PrependItem(parent = selectedLayer,
text = '', ct_type = 1, wnd = ctrl)
else:
# prepend to individual layer or non-expanded group
@@ -891,13 +892,13 @@
text = '', ct_type = 1, wnd = ctrl)
elif lgroup is None:
# -> previous sibling of selected layer
- parent = self.GetItemParent(self.layer_selected)
+ parent = self.GetItemParent(selectedLayer)
layer = self.InsertItem(parentId = parent,
- input = self.GetPrevSibling(self.layer_selected),
+ input = self.GetPrevSibling(selectedLayer),
text = '', ct_type = 1, wnd = ctrl)
else: # add first layer to the layer tree (first child of root)
layer = self.PrependItem(parent = self.root, text = '', ct_type = 1, wnd = ctrl)
-
+
# layer is initially unchecked as inactive (beside 'command')
# use predefined value if given
if lchecked is not None:
More information about the grass-commit
mailing list