[GRASS-SVN] r48450 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 24 11:57:57 EDT 2011
Author: martinl
Date: 2011-09-24 08:57:57 -0700 (Sat, 24 Sep 2011)
New Revision: 48450
Modified:
grass/trunk/gui/wxpython/gui_modules/goutput.py
Log:
wxGUI: fix r48444, allow output=-
Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py 2011-09-24 15:51:46 UTC (rev 48449)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py 2011-09-24 15:57:57 UTC (rev 48450)
@@ -521,21 +521,26 @@
else:
# other GRASS commands (r|v|g|...)
- # check for <input>=-
- # gtask.parse_command() is probably overkill here, use brute force instead
- for opt in command[1:]:
- if opt[0] == '-':
- # skip flags
- continue
- key, value = map(lambda x: x.strip(), opt.split('=', 1))
- if value == '-':
- gcmd.GError(parent = self,
- message = _("Unable to run command:\n%(cmd)s\n\n"
- "Option <%(opt)s>: read from standard input is not "
- "supported by wxGUI") % { 'cmd': ' '.join(command),
- 'opt': key })
- return 1
+ if len(command) == 1 and command[0] != 'v.krige':
+ # no arguments given
+ menuform.GUI(parent = self).ParseCommand(command)
+ return 0
+ task = menuform.GUI(show = None).ParseCommand(command)
+ if task:
+ # check for <input>=-
+ for p in task.get_options()['params']:
+ if p.get('prompt', '') == 'input' and \
+ p.get('age', 'new') == 'old' and \
+ p.get('value', '') == '-':
+ gcmd.GError(parent = self,
+ message = _("Unable to run command:\n%(cmd)s\n\n"
+ "Option <%(opt)s>: read from standard input is not "
+ "supported by wxGUI") % { 'cmd': ' '.join(command),
+ 'opt': p.get('name', '') }
+ )
+ return 1
+
# switch to 'Command output' if required
if switchPage:
self._notebook.SetSelectionByName('output')
@@ -549,21 +554,12 @@
tmpreg = os.getenv("GRASS_REGION")
if "GRASS_REGION" in os.environ:
del os.environ["GRASS_REGION"]
+
+ # process GRASS command with argument
+ self.cmdThread.RunCmd(command, stdout = self.cmdStdOut, stderr = self.cmdStrErr,
+ onDone = onDone)
+ self.cmdOutputTimer.Start(50)
- if len(command) == 1:
- task = gtask.parse_interface(command[0])
- else:
- task = None
-
- if task and command[0] not in ('v.krige'):
- # process GRASS command without argument
- menuform.GUI(parent = self).ParseCommand(command)
- else:
- # process GRASS command with argument
- self.cmdThread.RunCmd(command, stdout = self.cmdStdOut, stderr = self.cmdStrErr,
- onDone = onDone)
- self.cmdOutputTimer.Start(50)
-
# deactivate computational region and return to display settings
if compReg and tmpreg:
os.environ["GRASS_REGION"] = tmpreg
More information about the grass-commit
mailing list