浏览代码

wxGUI/menu: don't disable non-grass commands in menu, motivation is creating toolboxes from non-grass commands such as Isis (merge from trunk, https://trac.osgeo.org/grass/changeset/60313)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@60754 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 11 年之前
父节点
当前提交
8ff41b32aa
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      gui/wxpython/gui_core/menu.py

+ 5 - 3
gui/wxpython/gui_core/menu.py

@@ -18,7 +18,7 @@ This program is free software under the GNU General Public License
 @author Robert Szczepanek (menu customization)
 @author Vaclav Petras <wenzeslaus gmail.com> (menu customization)
 """
-
+import re
 import wx
 
 from core              import globalvar
@@ -90,8 +90,10 @@ class Menu(wx.MenuBar):
             try: 
                 cmd = utils.split(str(command)) 
             except UnicodeError: 
-                cmd = utils.split(EncodeString((command))) 
-            if cmd and cmd[0] not in globalvar.grassCmd: 
+                cmd = utils.split(EncodeString((command)))
+            # disable only grass commands which are not present (e.g. r.in.lidar)
+            if cmd and cmd[0] not in globalvar.grassCmd and \
+               re.match('[rvdipmgt][3bs]?\.([a-z0-9\.])+', cmd[0]):
                 menuItem.Enable(False)
 
         rhandler = eval('self.parent.' + handler)