[GRASS-SVN] r42395 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 30 08:08:02 EDT 2010


Author: martinl
Date: 2010-05-30 08:08:01 -0400 (Sun, 30 May 2010)
New Revision: 42395

Modified:
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: fix d.vect for more layers


Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-05-30 11:44:59 UTC (rev 42394)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-05-30 12:08:01 UTC (rev 42395)
@@ -191,7 +191,7 @@
         if not p or \
                 not p.has_key('wxId-bind'):
             return
-
+        
         # get widget prompt
         pType = p.get('prompt', '')
         if not pType:
@@ -199,6 +199,7 @@
         
         # check for map/input parameter
         pMap = self.task.get_param('map', raiseError=False)
+        
         if not pMap:
             pMap = self.task.get_param('input', raiseError=False)
 
@@ -1620,10 +1621,10 @@
             pMap['wxId-bind'] = copy.copy(pColumnIds)
             if pLayer:
                 pMap['wxId-bind'] += pLayerIds
-        if len(pLayer) == 1:
-            # TODO: fix modules with more 'layer' options
-            pLayer[0]['wxId-bind'] = copy.copy(pColumnIds)
-
+        if pLayer:
+            for p in pLayer:
+                p['wxId-bind'] = copy.copy(pColumnIds)
+        
         if pDriver and pTable:
             pDriver['wxId-bind'] = pTable['wxId']
 

Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2010-05-30 11:44:59 UTC (rev 42394)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2010-05-30 12:08:01 UTC (rev 42395)
@@ -299,22 +299,24 @@
     if not vector:
         return layers
     
-    ret = gcmd.RunCommand('v.category',
+    ret = gcmd.RunCommand('v.db.connect',
                           flags = 'g',
                           read = True,
-                          input = vector,
-                          option = 'report')
-    
+                          map = vector,
+                          fs = ';')
+        
     if not ret:
         return layers
     
     for line in ret.splitlines():
         try:
-            layer = line.split(' ')[0]
-            if layer not in layers:
-                layers.append(layer)
-        except ValueError:
+            layer = line.split(';')[0]
+            if '/' in layer:
+                layer = layer.split('/')[0]
+            layers.append(layer)
+        except IndexError:
             pass
+    
     Debug.msg(3, "utils.GetVectorNumberOfLayers(): vector=%s -> %s" % \
                   (vector, ','.join(layers)))
     



More information about the grass-commit mailing list