[GRASS-SVN] r71322 - in grass/branches/releasebranch_7_2: gui/wxpython/gui_core lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 3 07:54:10 PDT 2017


Author: martinl
Date: 2017-08-03 07:54:10 -0700 (Thu, 03 Aug 2017)
New Revision: 71322

Modified:
   grass/branches/releasebranch_7_2/gui/wxpython/gui_core/forms.py
   grass/branches/releasebranch_7_2/lib/python/script/task.py
Log:
v.what.vect query_column dropdown button doesn't show attribute columns of query_map (fix #3380)


Modified: grass/branches/releasebranch_7_2/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/gui_core/forms.py	2017-07-31 17:51:01 UTC (rev 71321)
+++ grass/branches/releasebranch_7_2/gui/wxpython/gui_core/forms.py	2017-08-03 14:54:10 UTC (rev 71322)
@@ -315,12 +315,15 @@
 
             elif name == 'ColumnSelect':
                 if map:
-                    if map in cparams:
-                        if not cparams[map]['dbInfo']:
-                            cparams[map]['dbInfo'] = gselect.VectorDBInfo(map)
-                        self.data[win.GetParent().InsertColumns] = {
-                            'vector': map, 'layer': layer,
-                            'dbInfo': cparams[map]['dbInfo']}
+                    if map not in cparams:
+                        cparams[map] = {'dbInfo': None,
+                                        'layers': None, }
+
+                    if not cparams[map]['dbInfo']:
+                        cparams[map]['dbInfo'] = gselect.VectorDBInfo(map)
+                    self.data[win.GetParent().InsertColumns] = {
+                        'vector': map, 'layer': layer,
+                        'dbInfo': cparams[map]['dbInfo']}
                 else:  # table
                     if driver and db:
                         self.data[win.GetParent().InsertTableColumns] = {

Modified: grass/branches/releasebranch_7_2/lib/python/script/task.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/script/task.py	2017-07-31 17:51:01 UTC (rev 71321)
+++ grass/branches/releasebranch_7_2/lib/python/script/task.py	2017-08-03 14:54:10 UTC (rev 71322)
@@ -155,22 +155,19 @@
         :param str element: element name
         :param bool raiseError: True for raise on error
         """
-        try:
-            for p in self.params:
-                val = p[element]
-                if val is None:
-                    continue
-                if isinstance(val, (list, tuple)):
-                    if value in val:
-                        return p
-                elif isinstance(val, (bytes, unicode)):
-                    if p[element][:len(value)] ==  value:
-                        return p
-                else:
-                    if p[element] ==  value:
-                        return p
-        except KeyError:
-            pass
+        for p in self.params:
+            val = p.get(element, None)
+            if val is None:
+                continue
+            if isinstance(val, (list, tuple)):
+                if value in val:
+                    return p
+            elif isinstance(val, (bytes, unicode)):
+                if p[element][:len(value)] == value:
+                    return p
+            else:
+                if p[element] == value:
+                    return p
 
         if raiseError:
             raise ValueError(_("Parameter element '%(element)s' not found: '%(value)s'") % \



More information about the grass-commit mailing list