[GRASS-SVN] r44330 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 15 15:39:41 EST 2010
Author: martinl
Date: 2010-11-15 12:39:41 -0800 (Mon, 15 Nov 2010)
New Revision: 44330
Modified:
grass/trunk/gui/wxpython/gui_modules/goutput.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: better treat external scripts
(merge r44329 from devbr6)
Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py 2010-11-15 20:37:26 UTC (rev 44329)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py 2010-11-15 20:39:41 UTC (rev 44330)
@@ -530,10 +530,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/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-11-15 20:37:26 UTC (rev 44329)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-11-15 20:39:41 UTC (rev 44330)
@@ -2119,10 +2119,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