[GRASS-SVN] r48759 - in grass/branches/releasebranch_6_4:
gui/wxpython/gui_modules lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 12 08:06:22 EDT 2011
Author: martinl
Date: 2011-10-12 05:06:22 -0700 (Wed, 12 Oct 2011)
New Revision: 48759
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
grass/branches/releasebranch_6_4/lib/python/core.py
grass/branches/releasebranch_6_4/lib/python/db.py
Log:
pythonlib: improve mapsets() interface - sync before 6.4.2
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2011-10-12 12:01:49 UTC (rev 48758)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2011-10-12 12:06:22 UTC (rev 48759)
@@ -327,7 +327,7 @@
# list of mapsets in current location
if mapsets is None:
- mapsets = grass.mapsets()
+ mapsets = grass.mapsets(search_path = True)
# current mapset first
if curr_mapset in mapsets and mapsets[0] != curr_mapset:
Modified: grass/branches/releasebranch_6_4/lib/python/core.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/core.py 2011-10-12 12:01:49 UTC (rev 48758)
+++ grass/branches/releasebranch_6_4/lib/python/core.py 2011-10-12 12:06:22 UTC (rev 48759)
@@ -620,7 +620,7 @@
mapset_re = re.compile("<(.*)>")
result = {}
if check_search_path:
- for mapset in mapsets(accessible = True):
+ for mapset in mapsets(search_path = True):
result[mapset] = []
mapset = None
@@ -703,7 +703,7 @@
"""
result = {}
if check_search_path:
- for mapset in mapsets(accessible = True):
+ for mapset in mapsets(search_path = 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(search_path = 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 search_path:
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/releasebranch_6_4/lib/python/db.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/db.py 2011-10-12 12:01:49 UTC (rev 48758)
+++ grass/branches/releasebranch_6_4/lib/python/db.py 2011-10-12 12:06:22 UTC (rev 48759)
@@ -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