Browse Source

don't ignore scripts in bin dir
(merge https://trac.osgeo.org/grass/changeset/42830 from relbr64)


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

Martin Landa 15 years ago
parent
commit
5be6581131
2 changed files with 27 additions and 4 deletions
  1. 3 1
      gui/wxpython/gui_modules/globalvar.py
  2. 24 3
      gui/wxpython/gui_modules/menu.py

+ 3 - 1
gui/wxpython/gui_modules/globalvar.py

@@ -143,7 +143,9 @@ def GetGRASSCmds(bin=True, scripts=True, gui_scripts=True):
     cmd = list()
     cmd = list()
     if bin is True:
     if bin is True:
         for file in os.listdir(os.path.join(gisbase, 'bin')):
         for file in os.listdir(os.path.join(gisbase, 'bin')):
-            if not EXT_BIN or file[-4:] == EXT_BIN:
+            if not EXT_BIN or \
+                    file[-4:] == EXT_BIN or \
+                    file[-4:] == EXT_SCT:
                 cmd.append(file)
                 cmd.append(file)
         
         
         # add special call for setting vector colors
         # add special call for setting vector colors

+ 24 - 3
gui/wxpython/gui_modules/menu.py

@@ -1,3 +1,20 @@
+"""!
+@package menu.py
+
+@brief Menu classes for wxGUI
+
+Classes:
+ - Menu
+
+(C) 2010 by the GRASS Development Team
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
+
+@author Martin Landa <landa.martin gmail.com>
+"""
+
+import shlex
+
 import wx
 import wx
 
 
 import globalvar
 import globalvar
@@ -50,9 +67,13 @@ class Menu(wx.MenuBar):
         
         
         self.menucmd[menuItem.GetId()] = gcmd
         self.menucmd[menuItem.GetId()] = gcmd
         
         
-        if len(gcmd) > 0 and \
-                gcmd.split()[0] not in globalvar.grassCmd['all']:
-            menuItem.Enable (False)
+        if gcmd: 
+            try: 
+                cmd = shlex.split(str(gcmd)) 
+            except UnicodeError: 
+                cmd = shlex.split(utils.EncodeString((gcmd))) 
+            if cmd and cmd[0] not in globalvar.grassCmd['all']: 
+                menuItem.Enable(False)
         
         
         rhandler = eval('self.parent.' + handler)
         rhandler = eval('self.parent.' + handler)