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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Sep 1 05:32:13 EDT 2011


Author: martinl
Date: 2011-09-01 02:32:13 -0700 (Thu, 01 Sep 2011)
New Revision: 48019

Modified:
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
   grass/trunk/gui/wxpython/gui_modules/globalvar.py
Log:
wxGUI: skip creating table for OGR layers (TODO)


Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-09-01 09:30:06 UTC (rev 48018)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-09-01 09:32:13 UTC (rev 48019)
@@ -48,6 +48,7 @@
 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 @@
             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)
+            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('db.connect',
-                            flags = 'c')
-            
-            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')
-        
         # return fully qualified map name
         if '@' not in outmap:
             outmap += '@' + grass.gisenv()['MAPSET']

Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py	2011-09-01 09:30:06 UTC (rev 48018)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py	2011-09-01 09:32:13 UTC (rev 48019)
@@ -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.



More information about the grass-commit mailing list