Prechádzať zdrojové kódy

wxGUI: fix menuform
(merge https://trac.osgeo.org/grass/changeset/39792 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39793 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 15 rokov pred
rodič
commit
8848f9f642

+ 14 - 1
gui/wxpython/gui_modules/menuform.py

@@ -53,6 +53,7 @@ import time
 import types
 import copy
 import locale
+import types
 from threading import Thread
 import Queue
 
@@ -370,12 +371,17 @@ class grassTask:
         try:
             for p in self.params:
                 val = p[element]
+                if val is None:
+                    continue
                 if type(val) in (types.ListType, types.TupleType):
                     if value in val:
                         return p
-                else:
+                elif type(val) == types.StringType:
                     if p[element][:len(value)] == value:
                         return p
+                else:
+                    if p[element] == value:
+                        return p
         except KeyError:
             pass
         
@@ -1866,7 +1872,12 @@ class GUI:
     def __init__(self, parent=-1):
         self.parent = parent
         self.grass_task = None
+        self.cmd = list()
 
+    def GetCmd(self):
+        """Get validated command"""
+        return self.cmd
+    
     def ParseInterface(self, cmd, parser = processTask):
         """!Parse interface
 
@@ -1969,6 +1980,8 @@ class GUI:
             else:
                 self.mf.OnApply(None)
         
+        self.cmd = cmd
+        
         return self.grass_task
 
     def GetCommandInputMapParamKey(self, cmd):

+ 6 - 4
gui/wxpython/gui_modules/wxgui_utils.py

@@ -846,10 +846,12 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                    ltype)
 
         if self.GetPyData(layer)[0]['cmd']:
-            cmdValidated = menuform.GUI().ParseCommand(self.GetPyData(layer)[0]['cmd'],
-                                                       completed=(self.GetOptData,layer,params),
-                                                       parentframe=self, show=show)
-            self.GetPyData(layer)[0]['cmd'] = cmdValidated
+            module = menuform.GUI()
+            module.ParseCommand(self.GetPyData(layer)[0]['cmd'],
+                                completed=(self.GetOptData,layer,params),
+                                parentframe=self, show=show)
+            
+            self.GetPyData(layer)[0]['cmd'] = module.GetCmd()
         elif ltype == 'raster':
             cmd = ['d.rast']