[GRASS-SVN] r35575 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 24 09:27:31 EST 2009
Author: martinl
Date: 2009-01-24 09:27:31 -0500 (Sat, 24 Jan 2009)
New Revision: 35575
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
Log:
wxGUI: MS Windows-related fixes
(merge from relbr64, r35574)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py 2009-01-24 14:24:33 UTC (rev 35574)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py 2009-01-24 14:27:31 UTC (rev 35575)
@@ -312,13 +312,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
#
@@ -495,8 +489,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/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2009-01-24 14:24:33 UTC (rev 35574)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2009-01-24 14:27:31 UTC (rev 35575)
@@ -234,7 +234,7 @@
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/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2009-01-24 14:24:33 UTC (rev 35574)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2009-01-24 14:27:31 UTC (rev 35575)
@@ -22,6 +22,7 @@
import os
import sys
+import platform
import wx
import wx.combo
@@ -212,9 +213,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/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2009-01-24 14:24:33 UTC (rev 35574)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2009-01-24 14:27:31 UTC (rev 35575)
@@ -282,7 +282,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":
if self.gismanager:
@@ -300,7 +301,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"
@@ -317,7 +319,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
@@ -401,7 +404,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