瀏覽代碼

wxGUI: fix InsertTables

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35212 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 年之前
父節點
當前提交
a1bf2ee5fa
共有 1 個文件被更改,包括 11 次插入8 次删除
  1. 11 8
      gui/wxpython/gui_modules/gselect.py

+ 11 - 8
gui/wxpython/gui_modules/gselect.py

@@ -474,18 +474,21 @@ class TableSelect(wx.ComboBox):
     def InsertTables(self, driver=None, database=None):
     def InsertTables(self, driver=None, database=None):
         """Insert attribute tables into combobox"""
         """Insert attribute tables into combobox"""
         items = []
         items = []
+
+        if not driver or not database:
+            connect = grass.db_connection()
+            
+            driver = connect['driver']
+            database = connect['database']
+        
         ret = gcmd.RunCommand('db.tables',
         ret = gcmd.RunCommand('db.tables',
-                              flag = 'p',
-                              parent = self,
+                              flags = 'p',
+                              read = True,
                               driver = driver,
                               driver = driver,
                               database = database)
                               database = database)
         
         
-        if ret != 0:
-            tableCmd = None
-        
-        if tableCmd and \
-                tableCmd.returncode == 0:
-            for table in tableCmd.ReadStdOutput():
+        if ret:
+            for table in ret.split('\n'):
                 if len(table) > 0:
                 if len(table) > 0:
                     items.append(table)
                     items.append(table)