[GRASS-SVN] r48756 - in grass/branches/develbranch_6:
gui/wxpython/gui_modules lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 12 07:52:02 EDT 2011
Author: martinl
Date: 2011-10-12 04:52:02 -0700 (Wed, 12 Oct 2011)
New Revision: 48756
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
grass/branches/develbranch_6/lib/python/core.py
grass/branches/develbranch_6/lib/python/db.py
Log:
pythonlib: improve mapsets() interface
(merge r48755 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2011-10-12 11:50:21 UTC (rev 48755)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2011-10-12 11:52:02 UTC (rev 48756)
@@ -327,7 +327,7 @@
# list of mapsets in current location
if mapsets is None:
- mapsets = grass.mapsets()
+ mapsets = grass.mapsets(searchPath = True)
# current mapset first
if curr_mapset in mapsets and mapsets[0] != curr_mapset:
Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py 2011-10-12 11:50:21 UTC (rev 48755)
+++ grass/branches/develbranch_6/lib/python/core.py 2011-10-12 11:52:02 UTC (rev 48756)
@@ -620,7 +620,7 @@
mapset_re = re.compile("<(.*)>")
result = {}
if check_search_path:
- for mapset in mapsets(accessible = True):
+ for mapset in mapsets(searchPath = True):
result[mapset] = []
mapset = None
@@ -703,7 +703,7 @@
"""
result = {}
if check_search_path:
- for mapset in mapsets(accessible = True):
+ for mapset in mapsets(searchPath = True):
result[mapset] = []
mapset = None
@@ -866,14 +866,14 @@
# interface to g.mapsets
-def mapsets(accessible = True):
- """!List accessible mapsets (mapsets in search path)
+def mapsets(searchPath = False):
+ """!List available mapsets
- @param accessible False to list all mapsets in the location
-
+ @param searchPatch True to list mapsets only in search path
+
@return list of mapsets
"""
- if accessible:
+ if searchPath:
flags = 'p'
else:
flags = 'l'
@@ -883,7 +883,7 @@
quiet = True)
if not mapsets:
fatal(_("Unable to list mapsets"))
-
+
return mapsets.splitlines()
# interface to `g.proj -c`
Modified: grass/branches/develbranch_6/lib/python/db.py
===================================================================
--- grass/branches/develbranch_6/lib/python/db.py 2011-10-12 11:50:21 UTC (rev 48755)
+++ grass/branches/develbranch_6/lib/python/db.py 2011-10-12 11:52:02 UTC (rev 48756)
@@ -112,7 +112,7 @@
fatal(_("Fetching data from table <%s> failed") % table)
ofile = open(fname)
- result = ofile.readlines()
+ result = map(lambda x: x.rstrip(os.linesep), ofile.readlines())
ofile.close()
try_remove(fname)
More information about the grass-commit
mailing list