소스 검색

wxGUI: fix https://trac.osgeo.org/grass/changeset/48444, allow output=-

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48450 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 년 전
부모
커밋
507e868fa4
1개의 변경된 파일24개의 추가작업 그리고 28개의 파일을 삭제
  1. 24 28
      gui/wxpython/gui_modules/goutput.py

+ 24 - 28
gui/wxpython/gui_modules/goutput.py

@@ -521,20 +521,25 @@ class GMConsole(wx.SplitterWindow):
             
             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:
@@ -549,20 +554,11 @@ class GMConsole(wx.SplitterWindow):
                     tmpreg = os.getenv("GRASS_REGION")
                     if "GRASS_REGION" in os.environ:
                         del os.environ["GRASS_REGION"]
-                
-                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)
+                    
+                # 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: