[GRASS-SVN] r35574 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 24 09:24:34 EST 2009


Author: martinl
Date: 2009-01-24 09:24:33 -0500 (Sat, 24 Jan 2009)
New Revision: 35574

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
Log:
wxGUI: MS Windows-related fixes


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py	2009-01-24 12:29:41 UTC (rev 35573)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py	2009-01-24 14:24:33 UTC (rev 35574)
@@ -306,13 +306,7 @@
 
         self.cmd = cmd
         self.stderr = stderr
-
-	# hack around platform-specific extension for binaries
-	if self.cmd[0] in globalvar.grassCmd['script']:
-	    self.cmd[0] = self.cmd[0] + globalvar.EXT_SCT
-	else:
-	    self.cmd[0] = self.cmd[0] + globalvar.EXT_BIN
-
+	
         #
         # set verbosity level
         #
@@ -489,8 +483,15 @@
                   stdout=sys.stdout, stderr=sys.stderr):
 
         Thread.__init__(self)
-
+	
         self.cmd    = cmd
+	
+	# hack around platform-specific extension for binaries
+	if self.cmd[0] in globalvar.grassCmd['script']:
+	    self.cmd[0] = self.cmd[0] + globalvar.EXT_SCT
+	else:
+	    self.cmd[0] = self.cmd[0] + globalvar.EXT_BIN
+        
         self.stdin  = stdin
         self.stdout = stdout
         self.stderr = stderr

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2009-01-24 12:29:41 UTC (rev 35573)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2009-01-24 14:24:33 UTC (rev 35574)
@@ -228,13 +228,13 @@
         p1 = self.cmd_output.GetEndStyled()
         self.cmd_output.GotoPos(p1)
         
-        for line in text.split('\n'):
+        for line in text.splitlines():
             # fill space
             if len(line) < self.lineWidth:
                 diff = self.lineWidth - len(line) 
                 line += diff * ' '
             
-            self.cmd_output.AddTextWrapped(line, wrap=wrap) # adds os.linesep
+            self.cmd_output.AddTextWrapped(line, wrap=wrap) # adds '\n'
             
             p2 = self.cmd_output.GetCurrentPos()
             
@@ -374,8 +374,8 @@
             self.history = self.cmd_output.GetText()
 
         # add newline if needed
-        if len(self.history) > 0 and self.history[-1] != os.linesep:
-            self.history += os.linesep
+        if len(self.history) > 0 and self.history[-1] != '\n':
+            self.history += '\n'
 
         wildcard = "Text file (*.txt)|*.txt"
         dlg = wx.FileDialog(
@@ -402,10 +402,6 @@
         """Print command output"""
         message = event.text
         type  = event.type
-        
-        # switch to 'Command output'
-        ### if self.parent.notebook.GetSelection() != self.parent.goutput.pageid:
-        ### self.parent.notebook.SetSelection(self.parent.goutput.pageid)
         if self.parent.notebook.GetSelection() != self.parent.goutput.pageid:
             textP = self.parent.notebook.GetPageText(self.parent.goutput.pageid)
             if textP[-1] != ')':
@@ -444,11 +440,11 @@
                 self.linepos = -1
         else:
             self.linepos = -1 # don't force position
-            if os.linesep not in message:
+            if '\n' not in message:
                 self.cmd_output.AddTextWrapped(message, wrap=60)
             else:
                 self.cmd_output.AddTextWrapped(message, wrap=None)
-        
+	    
         p2 = self.cmd_output.GetCurrentPos()
         
         if p2 >= p1:
@@ -571,14 +567,12 @@
     def write(self, s):
         if len(s) == 0 or s == '\n':
             return
-        
-        s = s.replace('\n', os.linesep)
-        
-        for line in s.split(os.linesep):
+
+        for line in s.splitlines():
             if len(line) == 0:
                 continue
             
-            evt = wxCmdOutput(text=line + os.linesep,
+            evt = wxCmdOutput(text=line + '\n',
                               type='')
             wx.PostEvent(self.parent.cmd_output, evt)
         
@@ -604,11 +598,10 @@
         if "GtkPizza" in s:
             return
         
-        s = s.replace('\n', os.linesep)
         # remove/replace escape sequences '\b' or '\r' from stream
         progressValue = -1
         
-        for line in s.split(os.linesep):
+        for line in s.splitlines():
             if len(line) == 0:
                 continue
 
@@ -636,7 +629,7 @@
                                   type='')
                 wx.PostEvent(self.parent.cmd_output, evt)
             elif len(line) > 0:
-                self.message += line.strip() + os.linesep
+                self.message += line.strip() + '\n'
 
             if self.printMessage and len(self.message) > 0:
                 evt = wxCmdOutput(text=self.message,
@@ -740,10 +733,10 @@
         String is wrapped and linesep is also added to the end
         of the string"""
         if wrap:
-            txt = textwrap.fill(txt, wrap) + os.linesep
+            txt = textwrap.fill(txt, wrap) + '\n'
         else:
-            if txt[-1] != os.linesep:
-                txt += os.linesep
+            if txt[-1] != '\n':
+                txt += '\n'
         
         if '\r' in txt:
             self.parent.linePos = -1
@@ -765,7 +758,7 @@
                 elif os.environ.has_key('GRASS_DB_ENCODING'):
                     txt = unicode(txt, os.environ['GRASS_DB_ENCODING'])
                 else:
-                    txt = _('Unable to encode text. Please set encoding in GUI preferences.') + os.linesep
+                    txt = _('Unable to encode text. Please set encoding in GUI preferences.') + '\n'
                     
                 self.AddText(txt) 
     

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2009-01-24 12:29:41 UTC (rev 35573)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2009-01-24 14:24:33 UTC (rev 35574)
@@ -22,6 +22,7 @@
 
 import os
 import sys
+import platform
 
 import wx
 import wx.combo
@@ -211,9 +212,12 @@
             if i > 0 and mapsets[i] == curr_mapset:
                 mapsets[i] = mapsets[0]
                 mapsets[0] = curr_mapset
-
-        filesdict = grass.mlist_grouped(elementdict[element])
         
+	if platform.system() == 'Windows':
+            filesdict = grass.list_grouped(elementdict[element])
+	else:
+            filesdict = grass.mlist_grouped(elementdict[element])
+        
         for dir in mapsets:
             dir_node = self.AddItem('Mapset: '+dir)
             self.seltree.SetItemTextColour(dir_node,wx.Colour(50,50,200))

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2009-01-24 12:29:41 UTC (rev 35573)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2009-01-24 14:24:33 UTC (rev 35574)
@@ -2732,7 +2732,8 @@
                               ToolbarPane().Top().
                               LeftDockable(False).RightDockable(False).
                               BottomDockable(False).TopDockable(True).
-                              CloseButton(False).Layer(2))
+                              CloseButton(False).Layer(2).
+                              BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
         # vector digitizer
         elif name == "vdigit":
             self.toolbars['vdigit'] = toolbars.VDigitToolbar(parent=self, map=self.Map,
@@ -2746,7 +2747,8 @@
                                   ToolbarPane().Top().Row(toolRow + 1).
                                   LeftDockable(False).RightDockable(False).
                                   BottomDockable(False).TopDockable(True).
-                                  CloseButton(False).Layer(2))
+                                  CloseButton(False).Layer(2).
+                                  BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
 
             # change mouse to draw digitized line
             self.MapWindow.mouse['box'] = "point"
@@ -2763,7 +2765,8 @@
                               ToolbarPane().Top().
                               LeftDockable(False).RightDockable(False).
                               BottomDockable(False).TopDockable(True).
-                              CloseButton(False).Layer(2))
+                              CloseButton(False).Layer(2).
+                              BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
         # nviz
         elif name == "nviz":
             import nviz
@@ -2846,7 +2849,9 @@
                               ToolbarPane().Top().Row(1).
                               LeftDockable(False).RightDockable(False).
                               BottomDockable(False).TopDockable(True).
-                              CloseButton(False).Layer(2))
+                              CloseButton(False).Layer(2).
+                              BestSize((globalvar.MAP_WINDOW_SIZE[0]-15, -1)))
+            
             self.MapWindow = self.MapWindow3D
             self.SetStatusText("", 0)
             



More information about the grass-commit mailing list