瀏覽代碼

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 年之前
父節點
當前提交
8848f9f642
共有 2 個文件被更改,包括 20 次插入5 次删除
  1. 14 1
      gui/wxpython/gui_modules/menuform.py
  2. 6 4
      gui/wxpython/gui_modules/wxgui_utils.py

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

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

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

@@ -846,10 +846,12 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                    ltype)
                    ltype)
 
 
         if self.GetPyData(layer)[0]['cmd']:
         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':
         elif ltype == 'raster':
             cmd = ['d.rast']
             cmd = ['d.rast']