[GRASS-SVN] r54982 - in grass/trunk: gui/wxpython/gui_core gui/wxpython/mapdisp lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 8 03:38:08 PST 2013


Author: martinl
Date: 2013-02-08 03:38:07 -0800 (Fri, 08 Feb 2013)
New Revision: 54982

Modified:
   grass/trunk/gui/wxpython/gui_core/query.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/lib/python/script/vector.py
Log:
wxGUI/query: report also 'nothing found'


Modified: grass/trunk/gui/wxpython/gui_core/query.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/query.py	2013-02-08 11:35:30 UTC (rev 54981)
+++ grass/trunk/gui/wxpython/gui_core/query.py	2013-02-08 11:38:07 UTC (rev 54982)
@@ -35,7 +35,7 @@
         self.tree.AddColumn("Feature")
         self.tree.AddColumn("Value")
         self.tree.SetMainColumn(0)
-        self.tree.SetColumnWidth(0, 180)
+        self.tree.SetColumnWidth(0, 220)
         self.tree.SetColumnWidth(1, 400)
 
         self.mainSizer.Add(item = self.tree, proportion = 1, flag = wx.EXPAND | wx.ALL, border = 5)
@@ -62,9 +62,16 @@
         # TODO: move elsewhere
         for part in self.data:
             if 'Map' in part:
-                item = self.tree.AppendItem(self.root, text = part['Map'])
+                itemText = part['Map']
+                if 'Mapset' in part:
+                    itemText += '@' + part['Mapset']
+                    del part['Mapset']
+                item = self.tree.AppendItem(self.root, text = itemText)
                 del part['Map']
-                self._addItem(item, part)
+                if part:
+                    self._addItem(item, part)
+                else:
+                    self.tree.AppendItem(item, text = _("Nothing found"))
             else:
                 self._addItem(self.root, part)
         self.tree.UnselectAll()
@@ -115,8 +122,9 @@
     testdata1 = grast.raster_what(map = ('elevation_shade at PERMANENT','landclass96'),
                                   coord = [(638509.051416,224742.348346)])
 
-    testdata2 = gvect.vector_what(map=('firestations','firestations'),
-                                 coord=(633177.897487,221352.921257), distance=10)
+    testdata2 = gvect.vector_what(map=('firestations','bridges'),
+                                  coord=(633177.897487,221352.921257), distance=10)
+    
     testdata = testdata1 + testdata2
     frame = QueryDialog(parent = None, data = testdata)
     frame.ShowModal()

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2013-02-08 11:35:30 UTC (rev 54981)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2013-02-08 11:38:07 UTC (rev 54982)
@@ -726,7 +726,8 @@
         if vect:
             vectQuery = grass.vector_what(map=vect, coord=(east, north), distance=qdist)
         self._QueryMapDone()
-        self._queryHighlight(vectQuery)
+        if 'Id' in vectQuery:
+            self._queryHighlight(vectQuery)
 
         result = rastQuery + vectQuery
         if self.dialogs['query']:

Modified: grass/trunk/lib/python/script/vector.py
===================================================================
--- grass/trunk/lib/python/script/vector.py	2013-02-08 11:35:30 UTC (rev 54981)
+++ grass/trunk/lib/python/script/vector.py	2013-02-08 11:38:07 UTC (rev 54982)
@@ -371,9 +371,10 @@
         
         if key == 'Map':
             # attach the last one from the previous map
-            if dict_layer is not None:
+            if dict_map is not None:
                 dict_main = copy.copy(dict_map)
-                dict_main.update(dict_layer)
+                if dict_layer is not None:
+                    dict_main.update(dict_layer)
                 data.append(dict_main)
             dict_map  = { key : value }
             dict_layer = None
@@ -403,9 +404,10 @@
             # examples: Sq_Meters, Hectares, Acres, Sq_Miles
     
     # attach the last one
-    if dict_layer is not None:
+    if dict_map is not None:
         dict_main = copy.copy(dict_map)
-        dict_main.update(dict_layer)
+        if dict_layer:
+            dict_main.update(dict_layer)
         data.append(dict_main)
     
     return data



More information about the grass-commit mailing list