[GRASS-SVN] r55145 - in grass/branches/releasebranch_6_4/gui/wxpython: core gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Feb 21 05:35:15 PST 2013
Author: annakrat
Date: 2013-02-21 05:35:14 -0800 (Thu, 21 Feb 2013)
New Revision: 55145
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/core/utils.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py
Log:
wxGUI: fix #1605 again
Modified: grass/branches/releasebranch_6_4/gui/wxpython/core/utils.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/core/utils.py 2013-02-21 13:23:18 UTC (rev 55144)
+++ grass/branches/releasebranch_6_4/gui/wxpython/core/utils.py 2013-02-21 13:35:14 UTC (rev 55145)
@@ -331,6 +331,41 @@
return layers
+def GetAllVectorLayers(vector):
+ """!Returns list of all vector layers as strings.
+
+ @param vector name of vector map
+ """
+ layers = []
+ if not vector:
+ return layers
+
+ fullname = grass.find_file(name = vector, element = 'vector')['fullname']
+ if not fullname:
+ Debug.msg(3, "utils.GetAllVectorLayers(): vector map <%s> not found" % vector)
+ return layers
+
+ ret, out, msg = RunCommand('v.category',
+ getErrorMsg = True,
+ read = True,
+ quiet = True,
+ option = 'layers',
+ input = fullname)
+
+ if ret != 0:
+ sys.stderr.write(_("Vector map <%(map)s>: %(msg)s\n") % { 'map' : fullname, 'msg' : msg })
+ return layers
+
+ Debug.msg(1, "utils.GetAllVectorLayers(): ret %s" % ret)
+
+ for layer in out.splitlines():
+ layers.append(layer)
+
+ Debug.msg(3, "utils.GetAllVectorLayers(): vector=%s -> %s" % \
+ (fullname, ','.join(layers)))
+
+ return layers
+
def Deg2DMS(lon, lat, string = True, hemisphere = True, precision = 3):
"""!Convert deg value to dms string
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py 2013-02-21 13:23:18 UTC (rev 55144)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py 2013-02-21 13:35:14 UTC (rev 55145)
@@ -48,7 +48,7 @@
from core.gcmd import RunCommand, GError, GMessage
from core.utils import GetListOfLocations, GetListOfMapsets, GetFormats
-from core.utils import GetSettingsPath, GetValidLayerName, ListSortLower, GetVectorNumberOfLayers
+from core.utils import GetSettingsPath, GetValidLayerName, ListSortLower, GetAllVectorLayers
from core.settings import UserSettings
from core.debug import Debug
@@ -681,7 +681,7 @@
@param vector name of vector map
"""
if vector:
- layers = GetVectorNumberOfLayers(vector)
+ layers = GetAllVectorLayers(vector)
else:
layers = list()
More information about the grass-commit
mailing list