[GRASS-SVN] r44329 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 15 15:37:26 EST 2010
Author: martinl
Date: 2010-11-15 12:37:26 -0800 (Mon, 15 Nov 2010)
New Revision: 44329
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: better treat external scripts
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2010-11-15 16:43:46 UTC (rev 44328)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py 2010-11-15 20:37:26 UTC (rev 44329)
@@ -528,10 +528,25 @@
else:
# Send any other command to the shell. Send output to
# console output window
- self.cmdThread.RunCmd(GrassCmd,
- onDone,
- command,
- self.cmd_stdout, self.cmd_stderr)
+ if len(command) == 1:
+ import menuform
+ try:
+ task = menuform.GUI().ParseInterface(command)
+ except:
+ task = None
+ # if not task.has_required():
+ # task = None # run command
+ else:
+ task = None
+
+ if task:
+ # process GRASS command without argument
+ menuform.GUI().ParseCommand(command, parentframe = self)
+ else:
+ self.cmdThread.RunCmd(GrassCmd,
+ onDone,
+ command,
+ self.cmd_stdout, self.cmd_stderr)
self.cmd_output_timer.Start(50)
return None
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2010-11-15 16:43:46 UTC (rev 44328)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py 2010-11-15 20:37:26 UTC (rev 44329)
@@ -1957,10 +1957,13 @@
@param cmd command (name of GRASS module)
"""
+ nuldev = file(os.devnull, 'w+')
try:
- cmdout = grass.Popen([cmd, '--interface-description'], stdout = grass.PIPE).communicate()[0]
+ cmdout = grass.Popen([cmd, '--interface-description'], stdout = grass.PIPE,
+ stderr = nuldev).communicate()[0]
except OSError:
raise gcmd.GException, _("Unable to fetch interface description for command '%s'.") % cmd
+ nuldev.close()
return cmdout.replace('grass-interface.dtd', os.path.join(globalvar.ETCDIR, 'grass-interface.dtd'))
More information about the grass-commit
mailing list