[GRASS-SVN] r44255 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 8 16:00:31 EST 2010


Author: martinl
Date: 2010-11-08 13:00:31 -0800 (Mon, 08 Nov 2010)
New Revision: 44255

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
   grass/trunk/gui/wxpython/gui_modules/prompt.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: fix running scripts
(merge r44253 from devbr6)


Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-11-08 20:58:28 UTC (rev 44254)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2010-11-08 21:00:31 UTC (rev 44255)
@@ -530,14 +530,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/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py	2010-11-08 20:58:28 UTC (rev 44254)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py	2010-11-08 21:00:31 UTC (rev 44255)
@@ -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/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2010-11-08 20:58:28 UTC (rev 44254)
+++ grass/trunk/gui/wxpython/wxgui.py	2010-11-08 21:00:31 UTC (rev 44255)
@@ -433,7 +433,7 @@
     def OnRunScript(self, event):
         """!Run script"""
         # open dialog and choose script file
-        dlg = wx.FileDialog(parent = self, message = _("Choose script file"),
+        dlg = wx.FileDialog(parent = self, message = _("Choose script file to run"),
                             defaultDir = os.getcwd(),
                             wildcard = _("Python script (*.py)|*.py|Bash script (*.sh)|*.sh"))
         
@@ -445,13 +445,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