[GRASS-SVN] r44253 - in grass/branches/develbranch_6/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 8 15:36:14 EST 2010


Author: martinl
Date: 2010-11-08 12:36:14 -0800 (Mon, 08 Nov 2010)
New Revision: 44253

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
wxGUI: fix running scripts


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-11-08 09:28:04 UTC (rev 44252)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-11-08 20:36:14 UTC (rev 44253)
@@ -528,14 +528,11 @@
         else:
             # Send any other command to the shell. Send output to
             # console output window
-            if grass.find_program(command[0]):
-                self.cmdThread.RunCmd(GrassCmd,
-                                      onDone,
-                                      command,
-                                      self.cmd_stdout, self.cmd_stderr)                                         
-                self.cmd_output_timer.Start(50)
-            else:
-                self.WriteError(_("Command '%s' not found") % command[0])
+            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/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2010-11-08 09:28:04 UTC (rev 44252)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2010-11-08 20:36:14 UTC (rev 44253)
@@ -791,6 +791,11 @@
             # Autocompletion for map/data file name entry after '=', ',', or manually
             pos = self.GetCurrentPos()
             entry = self.GetTextLeft()
+            if 'r.mapcalc' in entry:
+                self.InsertText(pos, '=')
+                self.CharRight()
+                return
+            
             if event.GetKeyCode() != 44:
                 self.promptType = None
             
@@ -911,6 +916,7 @@
             if len(items) == 1:
                 cmd = items[0].strip()
                 if cmd in globalvar.grassCmd['all'] and \
+                        cmd != 'r.mapcalc' and \
                         (not self.cmdDesc or cmd != self.cmdDesc.get_name()):
                     try:
                         self.cmdDesc = menuform.GUI().ParseInterface(cmd = [cmd])

Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2010-11-08 09:28:04 UTC (rev 44252)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2010-11-08 20:36:14 UTC (rev 44253)
@@ -432,8 +432,9 @@
     def OnRunScript(self, event):
         """!Run script"""
         # open dialog and choose script file
-        dlg = wx.FileDialog(parent = self, message = _("Choose script file"),
-                            defaultDir = os.getcwd(), wildcard = _("Bash script (*.sh)|*.sh|Python script (*.py)|*.py"))
+        dlg = wx.FileDialog(parent = self, message = _("Choose script file to run"),
+                            defaultDir = os.getcwd(),
+                            wildcard = _("Bash script (*.sh)|*.sh|Python script (*.py)|*.py"))
         
         filename = None
         if dlg.ShowModal() == wx.ID_OK:
@@ -443,13 +444,13 @@
             return False
 
         if not os.path.exists(filename):
-            wx.MessageBox(parent = self,
-                          message = _("Script file '%s' doesn't exist. Operation cancelled.") % filename,
-                          caption = _("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+            gcmd.GError(parent = self,
+                        message = _("Script file '%s' doesn't exist. "
+                                    "Operation cancelled.") % filename)
             return
         
         self.goutput.WriteCmdLog(_("Launching script '%s'...") % filename)
-        self.goutput.RunCmd(filename, switchPage = True)
+        self.goutput.RunCmd([filename], switchPage = True)
         
     def OnChangeLocation(self, event):
         """Change current location"""



More information about the grass-commit mailing list