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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 20 06:32:46 EDT 2011


Author: martinl
Date: 2011-10-20 03:32:46 -0700 (Thu, 20 Oct 2011)
New Revision: 48878

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm_base.py
   grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
Log:
wxGUI/vector query: don't fail when no attribute table linked to the vector map


Modified: grass/trunk/gui/wxpython/gui_modules/dbm_base.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_base.py	2011-10-20 03:16:32 UTC (rev 48877)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_base.py	2011-10-20 10:32:46 UTC (rev 48878)
@@ -97,7 +97,7 @@
                                  coord = (float(queryCoords[0]), float(queryCoords[1])),
                                  distance = float(qdist))
 
-        if len(data) < 1:
+        if len(data) < 1 or 'Table' not in data[0]:
             return None
         
         # process attributes
@@ -137,7 +137,7 @@
             sql = "SELECT %s FROM %s" % (cols, table)
         else:
             sql = "SELECT %s FROM %s WHERE %s" % (cols, table, where)
-
+        
         ret = gcmd.RunCommand('db.select',
                               parent = self,
                               read = True,

Modified: grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2011-10-20 03:16:32 UTC (rev 48877)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2011-10-20 10:32:46 UTC (rev 48878)
@@ -67,14 +67,12 @@
             label = _("Database connection "
                       "is not defined in DB file.")
 
-            wx.MessageBox(parent = self.parent,
+            gcmd.GMessage(parent = self.parent,
                           message = _("No attribute table linked to "
-                                    "vector map <%(vector)s> found. %(msg)s"
-                                    "\nYou can disable this message from digitization settings. Or "
-                                    "you can create and link attribute table to the vector map "
-                                    "using Attribute Table Manager.") % 
-                          {'vector' : self.map, 'msg' : label},
-                          caption = _("Message"), style = wx.OK | wx.ICON_EXCLAMATION | wx.CENTRE)
+                                      "vector map <%(vector)s> found. %(msg)s\n\n"
+                                      "New attribute table can be created by "
+                                      "Attribute Table Manager.") % 
+                          {'vector' : self.map, 'msg' : label})
             self.mapDBInfo = None
 
         wx.Dialog.__init__(self, parent = self.parent, id = wx.ID_ANY,



More information about the grass-commit mailing list