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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 30 10:31:09 EDT 2008


Author: martinl
Date: 2008-07-30 10:31:09 -0400 (Wed, 30 Jul 2008)
New Revision: 32383

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI: print properly vector build message

Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-07-30 14:30:25 UTC (rev 32382)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-07-30 14:31:09 UTC (rev 32383)
@@ -382,10 +382,29 @@
             
         p1 = self.cmd_output.GetCurrentPos()
 
-        if os.linesep not in message:
-            self.cmd_output.AddTextWrapped(message, wrap=60)
+        message = message.replace('\r', '')
+
+        pc = -1
+        if '\b' in message:
+            pc = p1
+            last_c = ''
+            for c in message:
+                if c == '\b':
+                    pc -= 1
+                else:
+                    self.cmd_output.SetCurrentPos(pc)
+                    self.cmd_output.ReplaceSelection(c)
+                    pc = self.cmd_output.GetCurrentPos()
+                    if c != ' ':
+                        last_c = c
+            if last_c not in ('0123456789'):
+                self.cmd_output.AddText('\n')
+                pc = -1
         else:
-            self.cmd_output.AppendText(message)
+            if os.linesep not in message:
+                self.cmd_output.AddTextWrapped(message, wrap=60)
+            else:
+                self.cmd_output.AddText(message)
 
         p2 = self.cmd_output.GetCurrentPos()
         self.cmd_output.StartStyling(p1, 0xff)
@@ -397,6 +416,9 @@
             self.cmd_output.SetStyling(p2 - p1 + 1, self.cmd_output.StyleMessage)
         else: # unknown
             self.cmd_output.SetStyling(p2 - p1 + 1, self.cmd_output.StyleUnknown)
+
+        if pc > 0:
+            self.cmd_output.SetCurrentPos(pc)
             
         self.cmd_output.EnsureCaretVisible()
         
@@ -508,7 +530,6 @@
     def write(self, s):
         s = s.replace('\n', os.linesep)
         # remove/replace escape sequences '\b' or '\r' from stream
-        s = s.replace('\b', '').replace('\r', '%s' % os.linesep)
         progressValue = -1
         
         for line in s.split(os.linesep):



More information about the grass-commit mailing list