浏览代码

wxGUI: fix https://trac.osgeo.org/grass/changeset/32469, loading workspaces works properly again...

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32475 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 17 年之前
父节点
当前提交
cc90c6dcb8
共有 1 个文件被更改,包括 15 次插入15 次删除
  1. 15 15
      gui/wxpython/gui_modules/wxgui_utils.py

+ 15 - 15
gui/wxpython/gui_modules/wxgui_utils.py

@@ -563,21 +563,21 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                                          text='', ct_type=1, wnd=ctrl)
             else:
                 # prepend to individual layer or non-expanded group
-                parent = self.GetItemParent(self.layer_selected)
-                layer = self.InsertItem(parentId=parent, input=self.GetPrevSibling(self.layer_selected),
-                                       text='', ct_type=1, wnd=ctrl)
-                #if lgroup is False:
-                #    # last child of root
-                #    layer = self.AppendItem(parentId=self.root,
-                #                            text='', ct_type=1, wnd=ctrl)
-                #elif lgroup is None or lgroup is True:
-                #    # insert item as last child
-                #    parent = self.GetItemParent(self.layer_selected)
-                #    # layer = self.InsertItem(parentId=parent, input=self.GetPrevSibling(self.layer_selected),
-                #    #                        text='', ct_type=1, wnd=ctrl)
-                #    layer = self.AppendItem(parentId=parent,
-                #                            text='', ct_type=1, wnd=ctrl)
-
+                if lgroup is False:
+                    # -> last child of root (loading from workspace)
+                    layer = self.AppendItem(parentId=self.root,
+                                            text='', ct_type=1, wnd=ctrl)
+                elif lgroup is True:
+                    # -> last child of group (loading from workspace)
+                    parent = self.GetItemParent(self.layer_selected)
+                    layer = self.AppendItem(parentId=parent,
+                                            text='', ct_type=1, wnd=ctrl)
+                elif lgroup is None:
+                    # -> previous sibling of selected layer
+                    parent = self.GetItemParent(self.layer_selected)
+                    layer = self.InsertItem(parentId=parent,
+                                            input=self.GetPrevSibling(self.layer_selected),
+                                            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)