[GRASS-SVN] r32463 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 2 09:09:36 EDT 2008


Author: martinl
Date: 2008-08-02 09:09:36 -0400 (Sat, 02 Aug 2008)
New Revision: 32463

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: add new layer as previous sibling of selected layer (first item from the list is rendered as the last one)
some goutput quick fixes


Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-08-02 12:11:06 UTC (rev 32462)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-08-02 13:09:36 UTC (rev 32463)
@@ -695,18 +695,17 @@
             txt += os.linesep
         
         if '\r' in txt:
-            self.linePos = -1
+            self.parent.linePos = -1
             for seg in txt.split('\r'):
-                if self.linePos > -1:
-                    self.cmd_output.SetCurrenPos()
-                    self.ReplaceText(iseg) + ' ' * (self.lineWidth - len(iseg))
+                if self.parent.linePos > -1:
+                    self.SetCurrentPos(self.parent.linePos)
+                    self.ReplaceSelection(seg)
                 else:
-                    self.AddText(iseg)
-                self.linePos = self.GetCurrentPos()
-                    
-                iseg += 1
+                    self.parent.linePos = self.GetCurrentPos()
+                    self.AddText(seg)
         else:
+            self.parent.linePos = self.GetCurrentPos()
             self.AddText(txt)
-            self.linePos = self.GetCurrentPos()
+        
             
             

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-02 12:11:06 UTC (rev 32462)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-02 13:09:36 UTC (rev 32463)
@@ -534,23 +534,28 @@
         if self.layer_selected and self.layer_selected != self.GetRootItem():
             if self.GetPyData(self.layer_selected)[0]['type'] != 'group':
                 if lgroup is False:
-                    # last child of root
+                    # -> last child of root (loading from workspace)
                     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
+                elif lgroup is True:
+                    # -> last child of group (loading from workspace)
                     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)
+                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: # group (first child of self.layer_selected)
+            else: # group -> first child of selected layer
                 layer = self.PrependItem(parent=self.layer_selected,
                                          text='', ct_type=1, wnd=ctrl)
                 self.Expand(self.layer_selected)
-        else: # add first layer to the layer tree (first child of root)
-            layer = self.PrependItem(parent=self.root, text='', ct_type=1, wnd=ctrl)
+        else: # add first layer to the layer tree (i.e. 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



More information about the grass-commit mailing list