[GRASS-SVN] r54507 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 2 10:57:25 PST 2013


Author: martinl
Date: 2013-01-02 10:57:25 -0800 (Wed, 02 Jan 2013)
New Revision: 54507

Modified:
   grass/trunk/gui/wxpython/gui_core/gselect.py
Log:
wxGUI: attempt to fix LayerSelect (check v.category instead of v.db.connect)


Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py	2013-01-02 18:42:32 UTC (rev 54506)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py	2013-01-02 18:57:25 UTC (rev 54507)
@@ -729,25 +729,24 @@
             layers.append('-1')
 
         if vector:
-            # TODO: use Vect_get_field2() in C modules where possible
-            # currently the following is identical to
-            # layers = utils.GetVectorNumberOfLayers(self, vector)
-
-            ret = RunCommand('v.db.connect',
+            ret = RunCommand('v.category',
                              read = True,
                              quiet = True,
-                             sep = '|',
+                             option = 'report',
                              flags = 'g',
-                             map = vector)
+                             input = vector)
             if ret:
                 for line in ret.splitlines():
-                    layerinfo = line.split('|')
-                    layername = layerinfo[0].split('/')
+                    if 'all' not in line:
+                        continue
+                    try:
+                        layer = line.split(' ')[0]
+                    except IndexError:
+                        continue
                     # use this to get layer names
                     # but only when all modules use Vect_get_field2()
                     # which is not the case right now
-                    ### layers.append(layername[len(layername) - 1])
-                    layers.append(layername[0])
+                    layers.append(layer)
 
         elif dsn:
             ret = RunCommand('v.in.ogr',



More information about the grass-commit mailing list