[GRASS-SVN] r48755 - in grass/trunk: gui/wxpython/gui_modules
lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 12 07:50:21 EDT 2011
Author: martinl
Date: 2011-10-12 04:50:21 -0700 (Wed, 12 Oct 2011)
New Revision: 48755
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/lib/python/core.py
grass/trunk/lib/python/db.py
Log:
pythonlib: improve mapsets() interface
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-10-12 11:20:55 UTC (rev 48754)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-10-12 11:50:21 UTC (rev 48755)
@@ -329,7 +329,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/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py 2011-10-12 11:20:55 UTC (rev 48754)
+++ grass/trunk/lib/python/core.py 2011-10-12 11:50:21 UTC (rev 48755)
@@ -629,7 +629,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
@@ -712,7 +712,7 @@
"""
result = {}
if check_search_path:
- for mapset in mapsets(accessible = True):
+ for mapset in mapsets(searchPath = True):
result[mapset] = []
mapset = None
@@ -875,14 +875,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'
@@ -892,7 +892,7 @@
quiet = True)
if not mapsets:
fatal(_("Unable to list mapsets"))
-
+
return mapsets.splitlines()
# interface to `g.proj -c`
Modified: grass/trunk/lib/python/db.py
===================================================================
--- grass/trunk/lib/python/db.py 2011-10-12 11:20:55 UTC (rev 48754)
+++ grass/trunk/lib/python/db.py 2011-10-12 11:50:21 UTC (rev 48755)
@@ -122,7 +122,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