Bläddra i källkod

GUI dialog: fix guidependency for maps/columns (see eg. v.what.vect query_map -> query_column)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@70518 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 8 år sedan
förälder
incheckning
012f68e2c9
2 ändrade filer med 22 tillägg och 22 borttagningar
  1. 9 6
      gui/wxpython/gui_core/forms.py
  2. 13 16
      lib/python/script/task.py

+ 9 - 6
gui/wxpython/gui_core/forms.py

@@ -317,12 +317,15 @@ class UpdateThread(Thread):
 
             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] = {

+ 13 - 16
lib/python/script/task.py

@@ -155,22 +155,19 @@ class grassTask:
         :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'") % \