瀏覽代碼

wxGUI: skip creating table for OGR layers (TODO)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48019 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 年之前
父節點
當前提交
868b8be40f
共有 2 個文件被更改,包括 25 次插入21 次删除
  1. 24 20
      gui/wxpython/gui_modules/gdialogs.py
  2. 1 1
      gui/wxpython/gui_modules/globalvar.py

+ 24 - 20
gui/wxpython/gui_modules/gdialogs.py

@@ -48,6 +48,7 @@ import gselect
 import menuform
 import utils
 from preferences import globalSettings as UserSettings
+from debug       import Debug
 
 class ElementDialog(wx.Dialog):
     def __init__(self, parent, title, label, id = wx.ID_ANY,
@@ -405,36 +406,39 @@ def CreateNewVector(parent, cmd, title = _('Create new vector map'),
             dlg.Destroy()
             return None
         
-        # create link for OGR layers
         if not isNative:
+            # create link for OGR layers
             gcmd.RunCommand('v.external',
                             overwrite = overwrite,
                             parent = parent,
                             dsn = vExternalOut['dsn'],
                             layer = outmap)
-        
+            
         # create attribute table
         if dlg.table.IsEnabled() and dlg.table.IsChecked():
             key = UserSettings.Get(group = 'atm', key = 'keycolumn', subkey = 'value')
-            sql = 'CREATE TABLE %s (%s INTEGER)' % (outmap, key)
-            
-            gcmd.RunCommand('db.connect',
-                            flags = 'c')
-            
-            gcmd.RunCommand('db.execute',
-                            quiet = True,
-                            parent = parent,
-                            input = '-',
-                            stdin = sql)
+            if isNative:
+                sql = 'CREATE TABLE %s (%s INTEGER)' % (outmap, key)
+                
+                gcmd.RunCommand('db.connect',
+                                flags = 'c')
+                
+                Debug.msg(1, "SQL: %s" % sql)
+                gcmd.RunCommand('db.execute',
+                                quiet = True,
+                                parent = parent,
+                                input = '-',
+                                stdin = sql)
+                
+                gcmd.RunCommand('v.db.connect',
+                                quiet = True,
+                                parent = parent,
+                                map = outmap,
+                                table = outmap,
+                                key = key,
+                                layer = '1')
+            # TODO: how to deal with attribute tables for OGR layers?
             
-            gcmd.RunCommand('v.db.connect',
-                            quiet = True,
-                            parent = parent,
-                            map = outmap,
-                            table = outmap,
-                            key = key,
-                            layer = '1')
-        
         # return fully qualified map name
         if '@' not in outmap:
             outmap += '@' + grass.gisenv()['MAPSET']

+ 1 - 1
gui/wxpython/gui_modules/globalvar.py

@@ -6,7 +6,7 @@
 This module provide the space for global variables
 used in the code.
 
-(C) 2007-2010 by the GRASS Development Team
+(C) 2007-2011 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.