Explorar o código

wxGUI: fix d.vect for more layers

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42395 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa %!s(int64=15) %!d(string=hai) anos
pai
achega
fdfc593c64
Modificáronse 2 ficheiros con 16 adicións e 13 borrados
  1. 6 5
      gui/wxpython/gui_modules/menuform.py
  2. 10 8
      gui/wxpython/gui_modules/utils.py

+ 6 - 5
gui/wxpython/gui_modules/menuform.py

@@ -191,7 +191,7 @@ class UpdateThread(Thread):
         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 @@ class UpdateThread(Thread):
         
         # 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 @@ class cmdPanel(wx.Panel):
             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']
 

+ 10 - 8
gui/wxpython/gui_modules/utils.py

@@ -299,22 +299,24 @@ def GetVectorNumberOfLayers(vector):
     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)))