[GRASS-SVN] r35990 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 20 14:17:37 EST 2009


Author: martinl
Date: 2009-02-20 14:17:37 -0500 (Fri, 20 Feb 2009)
New Revision: 35990

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI: fix trac #502


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2009-02-20 18:02:16 UTC (rev 35989)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2009-02-20 19:17:37 UTC (rev 35990)
@@ -335,39 +335,15 @@
 
     def __CheckDBConnection(self):
         """Check DB connection"""
-        layerCommand = gcmd.Command(cmd=["v.db.connect",
-                                         "-g", "--q",
-                                         "map=%s" % self.map],
-                                    rerr=None, stderr=None)
-        if layerCommand.returncode != 0:
-            return False
-
-        # list of available layers & (table, database, driver)
-        for line in layerCommand.ReadStdOutput():
-            lineList = line.split(' ')
-            layer = lineList[0]
-            if '/' in layer:
-                layer, layer_name = lineList[0].split('/')
-            else:
-                layer_name = None
-            # database can contain ' ' in it's path
-            if len(lineList) > 5:
-                database = ''.join(lineList[3:-1])
-            else:
-                database = lineList[3]
-            self.layers[int(layer)] = {
-                "name"     : layer_name,
-                "table"    : lineList[1],
-                "key"      : lineList[2],
-                "database" : database,
-                "driver"   : lineList[-1]
-                }
-            
+        nuldev = file(os.devnull, 'w+')
+        self.layers = grass.vector_db(map=self.map, stderr=nuldev)
+        nuldev.close()
+        
         if (len(self.layers.keys()) == 0):
             return False
 
         return True
-
+    
     def __DescribeTables(self):
         """Describe linked tables"""
         for layer in self.layers.keys():



More information about the grass-commit mailing list