Bläddra i källkod

wxGUI/vector query: don't fail when no attribute table linked to the vector map

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48878 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 år sedan
förälder
incheckning
59aaf5e72e
2 ändrade filer med 7 tillägg och 9 borttagningar
  1. 2 2
      gui/wxpython/gui_modules/dbm_base.py
  2. 5 7
      gui/wxpython/gui_modules/dbm_dialogs.py

+ 2 - 2
gui/wxpython/gui_modules/dbm_base.py

@@ -97,7 +97,7 @@ class VectorDBInfo(gselect.VectorDBInfo):
                                  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 @@ class VectorDBInfo(gselect.VectorDBInfo):
             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,

+ 5 - 7
gui/wxpython/gui_modules/dbm_dialogs.py

@@ -67,14 +67,12 @@ class DisplayAttributesDialog(wx.Dialog):
             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,