瀏覽代碼

wxGUI: launch script with full path

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38220 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 年之前
父節點
當前提交
ce245b86da
共有 2 個文件被更改,包括 15 次插入9 次删除
  1. 11 7
      gui/wxpython/gui_modules/goutput.py
  2. 4 2
      gui/wxpython/gui_modules/menuform.py

+ 11 - 7
gui/wxpython/gui_modules/goutput.py

@@ -65,7 +65,7 @@ class CmdThread(threading.Thread):
 
     def RunCmd(self, callable, onDone, *args, **kwds):
         CmdThread.requestId += 1
-
+        
         self.requestCmd = None
         self.requestQ.put((CmdThread.requestId, callable, onDone, args, kwds))
         
@@ -78,6 +78,7 @@ class CmdThread(threading.Thread):
             requestTime = time.time()
             event = wxCmdRun(cmd=args[0],
                              pid=requestId)
+            
             wx.PostEvent(self.parent, event)
 
             time.sleep(.1)
@@ -411,12 +412,15 @@ class GMConsole(wx.Panel):
             # console output window
 
             # if command is not a GRASS command, treat it like a shell command
-            try:
-                gcmd.Command(cmdlist,
-                             stdout=self.cmd_stdout,
-                             stderr=self.cmd_stderr)
-            except gcmd.CmdError, e:
-                print >> sys.stderr, e
+            # process GRASS command with argument
+            self.cmdThread.RunCmd(GrassCmd,
+                                  onDone,
+                                  cmdlist,
+                                  self.cmd_stdout, self.cmd_stderr)                                          
+            self.btn_abort.Enable()
+            self.cmd_output_timer.Start(50)
+            
+            return None
         
         return None
 

+ 4 - 2
gui/wxpython/gui_modules/menuform.py

@@ -304,6 +304,7 @@ class grassTask:
     for parsed filling.
     """
     def __init__(self, grassModule = None):
+        self.path = grassModule
         self.name = _('unknown')
         self.params = []
         self.description = ''
@@ -825,8 +826,9 @@ class mainFrame(wx.Frame):
                 self.notebookpanel.notebook.SetSelection(self.notebookpanel.goutputId)
             
             try:
+                cmd[0] = self.task.path # full path
                 self.goutput.RunCmd(cmd)
-            except AttributeError,e:
+            except AttributeError, e:
                 print >> sys.stderr, "%s: Propably not running in wxgui.py session?" % (e)
                 print >> sys.stderr, "parent window is: %s" % (str(self.parent))
             # Send any other command to the shell.
@@ -1815,7 +1817,7 @@ if __name__ == "__main__":
         sys.exit()
     if sys.argv[1] != 'test':
         q=wx.LogNull()
-        GrassGUIApp( grassTask( sys.argv[1] ) ).MainLoop()
+        GrassGUIApp(grassTask(sys.argv[1])).MainLoop()
     else: #Test
         # Test grassTask from within a GRASS session
         if os.getenv("GISBASE") is not None: