[GRASS-SVN] r35215 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 4 14:34:04 EST 2009
Author: martinl
Date: 2009-01-04 14:34:04 -0500 (Sun, 04 Jan 2009)
New Revision: 35215
Modified:
grass/trunk/gui/wxpython/gui_modules/colorrules.py
grass/trunk/gui/wxpython/gui_modules/dbm.py
grass/trunk/gui/wxpython/gui_modules/georect.py
grass/trunk/gui/wxpython/gui_modules/goutput.py
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/location_wizard.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
grass/trunk/gui/wxpython/gui_modules/preferences.py
grass/trunk/gui/wxpython/gui_modules/profile.py
grass/trunk/gui/wxpython/gui_modules/render.py
grass/trunk/gui/wxpython/gui_modules/utils.py
grass/trunk/gui/wxpython/gui_modules/vdigit.py
Log:
wxGUI: replace split('\n') with splitlines()
Modified: grass/trunk/gui/wxpython/gui_modules/colorrules.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/colorrules.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/colorrules.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -374,7 +374,7 @@
map = self.inmap)
if info:
- for line in info.split('\n'):
+ for line in info.splitlines():
if 'min' in line:
self.rast['min'] = float(line.split('=')[1])
elif 'max' in line:
Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -1136,9 +1136,7 @@
where = where)
region = {}
- for line in select.split('\n'):
- if '=' not in line:
- continue
+ for line in select.splitlines():
key, value = line.split('=')
region[key.strip()] = float(value.strip())
@@ -2146,7 +2144,7 @@
flags = 'p')
self.listOfDrivers = []
- for drv in drivers.split('\n'):
+ for drv in drivers.splitlines():
self.listOfDrivers.append(drv.strip())
#
@@ -2158,9 +2156,7 @@
read = True,
quiet = True)
- for line in connect.split('\n'):
- if ':' not in line:
- continue
+ for line in connect.splitlines():
item, value = line.split(':')
self.defaultConnect[item.strip()] = value.strip()
@@ -2573,9 +2569,8 @@
return tables
- for table in ret.split('\n'):
- if len(table) > 0:
- tables.append(table)
+ for table in ret.splitlines():
+ tables.append(table)
return tables
@@ -2594,9 +2589,8 @@
if ret == None:
return columns
- for column in ret.split('\n'):
- if len(column) > 0:
- columns.append(column)
+ for column in ret.splitlines():
+ columns.append(column)
return columns
@@ -3361,10 +3355,7 @@
data = {}
if ret:
readAttrb = False
- for item in ret.split('\n'):
- if len(item) < 1:
- continue
-
+ for item in ret.splitlines():
key, value = item.split(':', 1)
if key == 'Layer' and readAttrb:
@@ -3423,7 +3414,7 @@
# self.tables[table][key][1] = str(cat)
if ret:
- for line in ret.split('\n'):
+ for line in ret.splitlines():
name, value = line.split('|')
# casting ...
if value:
Modified: grass/trunk/gui/wxpython/gui_modules/georect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/georect.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/georect.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -1111,7 +1111,7 @@
self.grwiz.SwitchEnv('original')
if ret:
- errlist = ret.split('\n')
+ errlist = ret.splitlines()
if errlist == []:
return
Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -228,7 +228,7 @@
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 = 80 - len(line)
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -488,9 +488,8 @@
database = database)
if ret:
- for table in ret.split('\n'):
- if len(table) > 0:
- items.append(table)
+ for table in ret.splitlines():
+ items.append(table)
self.SetItems(items)
self.SetValue('')
@@ -567,9 +566,8 @@
columnchoices = []
if ret:
- for item in ret.split('\n'):
- if len(item) < 1:
- columnchoices.append(item)
+ for item in ret.splitlines():
+ columnchoices.append(item)
# columnchoices.sort()
self.SetItems(columnchoices)
Modified: grass/trunk/gui/wxpython/gui_modules/location_wizard.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/location_wizard.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/location_wizard.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -2035,7 +2035,7 @@
dtoptions = {}
if ret:
- line = ret.split('\n')
+ line = ret.splitlines()
i = 0
while i < len(line):
if line[i] == '---':
@@ -2211,11 +2211,8 @@
ret = gcmd.RunCommand('g.gisenv',
read = True)
if ret:
- output = ret.split('\n')
- for line in output:
- line = line.strip()
- if '=' in line:
- key, val = line.split('=')
+ for line in ret.splitlines():
+ key, val = line.split('=')
envval[key] = val
self.currlocation = envval['LOCATION_NAME'].strip("';")
self.currmapset = envval['MAPSET'].strip("';")
@@ -2241,11 +2238,8 @@
read = True,
flags = 'gp3')
if ret:
- output = ret.split('\n')
- for line in output:
- line = line.strip()
- if '=' in line:
- key, val = line.split('=')
+ for line in ret.splitlines():
+ key, val = line.split('=')
region[key] = float(val)
else:
dlg = wx.MessageBox(parent=self,
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -2342,9 +2342,7 @@
dlg.Destroy()
return
- for line in region.split('\n'):
- if '=' not in line:
- continue
+ for line in region.splitlines():
key, val = line.split('=')
zoomreg[key.strip()] = float(val.strip())
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -2424,9 +2424,7 @@
return
npoints = nprimitives = 0
- for line in vInfo.split('\n'):
- if '=' not in line:
- continue
+ for line in vInfo.splitlines():
key, value = line.split('=')
if key == 'map3d':
mapIs3D = int(value)
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -1680,7 +1680,7 @@
if not ret:
return fontlist
- dfonts = ret.split('\n')
+ dfonts = ret.splitlines()
dfonts.sort(lambda x,y: cmp(x.lower(), y.lower()))
for item in range(len(dfonts)):
# ignore duplicate fonts and those starting with #
@@ -1787,7 +1787,7 @@
mapsets = []
if ret:
- mapsets = ret.split('\n')
+ mapsets = ret.splitlines()
for mapset in mapsets:
index = self.InsertStringItem(sys.maxint, mapset)
Modified: grass/trunk/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/profile.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/profile.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -289,7 +289,7 @@
map = r['name'])
if ret:
- r['units'] = p.split('\n')[0].split('=')[1]
+ r['units'] = p.splitlines()[0].split('=')[1]
# update title
self.ptitle += ' %s and' % r['name']
@@ -325,9 +325,9 @@
read = True,
input = self.raster[0]['name'],
east_north = '%d,%d' % (point[0],point[1]))
- outlist = ret.split('\n')
- val = outlist[0].split('|')[3]
+ val = ret.splitlines()[0].split('|')[3]
+
# calculate distance between coordinate points
if lasteast and lastnorth:
dist = math.sqrt(math.pow((lasteast-point[0]),2) + math.pow((lastnorth-point[1]),2))
@@ -413,15 +413,20 @@
import subprocess
try:
- p = grass.read_command("r.profile",
- input=raster,
- profile=coords,
- null="nan",
- quiet=True
- )
- for outline in p.strip().split('\n'):
+ ret = RunCommand("r.profile",
+ input=raster,
+ profile=coords,
+ null="nan",
+ quiet=True,
+ read = True)
+
+ if not ret:
+ return dataset
+
+ for line in ret.splitlines():
dist, elev = outline.split(' ')
- if elev != 'nan': datalist.append((dist,elev))
+ if elev != 'nan':
+ datalist.append((dist,elev))
return datalist
except gcmd.CmdError, e:
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -734,7 +734,7 @@
if not ret:
return projinfo
- for line in ret.split('\n'):
+ for line in ret.splitlines():
if ':' in line:
key,val = line.split(':')
key = key.strip()
Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -46,7 +46,7 @@
read = True,
pid = os.getpid())
- tempfile = tempfileCmd.split('\n')[0].strip()
+ tempfile = tempfileCmd.splitlines()[0].strip()
# FIXME
# ugly hack for MSYS (MS Windows)
@@ -257,7 +257,7 @@
if not ret:
return layers
- for line in ret.split('\n'):
+ for line in ret.splitlines():
if not 'Layer' in line:
continue
Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-01-04 19:22:13 UTC (rev 35214)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-01-04 19:34:04 UTC (rev 35215)
@@ -195,7 +195,7 @@
if not ret:
return ids
- output = ret.split('\n')[0] # first line
+ output = ret.splitlines()[0] # first line
ids = output.split(',')
ids = map(int, ids) # str -> int
@@ -1991,7 +1991,7 @@
if not ret:
return False
- for item in ret.split('\n'):
+ for item in ret.splitlines():
litem = item.lower()
if "id:" in litem: # get line id
self.line = int(item.split(':')[1].strip())
More information about the grass-commit
mailing list