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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 4 08:07:05 EDT 2010


Author: martinl
Date: 2010-08-04 12:07:04 +0000 (Wed, 04 Aug 2010)
New Revision: 42997

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI/dbm: set default DB settings if not defined
(merge r42994 from trunk)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py	2010-08-04 11:39:00 UTC (rev 42996)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py	2010-08-04 12:07:04 UTC (rev 42997)
@@ -146,10 +146,10 @@
                           message=_("Unable to create vector map <%s>.") % outmap,
                           caption=_("Error"),
                           style=wx.ID_OK | wx.ICON_ERROR | wx.CENTRE)
-            return False
+            return (None, None)
         
         if outmap == '': # should not happen
-            return False
+            return (None, None)
         
         cmd.append("%s=%s" % (cmdDef[1], outmap))
         
@@ -169,16 +169,17 @@
                 cmd.append('--overwrite')
             else:
                 dlgOw.Destroy()
-                return False
+                return (None, None)
 
         if UserSettings.Get(group='cmd', key='overwrite', subkey='enabled') is True:
             cmd.append('--overwrite')
         
         try:
             gcmd.Command(cmd)
-        except gcmd.CmdError, e:
-            print >> sys.stderr, e
-            return None
+        except gcmd.GException, e:
+            gcmd.GError(parent = self,
+                        message = e)
+            return (None, None)
 
         #
         # create attribute table
@@ -187,17 +188,22 @@
             key = UserSettings.Get(group='atm', key='keycolumn', subkey='value')
             sql = 'CREATE TABLE %s (%s INTEGER)' % (outmap, key)
             
-            gcmd.Command(['db.execute',
-                          '--q'],
-                         stdin=sql)
-
-            gcmd.Command(['v.db.connect',
-                          '--q',
-                          'map=%s' % outmap,
-                          'table=%s' % outmap,
-                          'key=%s' % key,
-                          'layer=1'])
-
+            gcmd.RunCommand('db.connect',
+                            flags = 'c')
+            
+            gcmd.RunCommand('db.execute',
+                            quiet = True,
+                            parent = parent,
+                            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 += '@' + grassenv.GetGRASSVariable('MAPSET')



More information about the grass-commit mailing list