[GRASS-SVN] r30491 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Mar 6 16:20:42 EST 2008


Author: martinl
Date: 2008-03-06 16:20:42 -0500 (Thu, 06 Mar 2008)
New Revision: 30491

Modified:
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI (menuform) typo (wxgui_utils) fixing run command(command string with parameters)

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-03-06 17:11:23 UTC (rev 30490)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-03-06 21:20:42 UTC (rev 30491)
@@ -772,7 +772,7 @@
         """Abort running command"""
         try:
             self.goutput.GetListOfCmdThreads()[0].abort()
-        except KeyError:
+        except IndexError:
             pass
 
     def OnCopy(self, event):

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-06 17:11:23 UTC (rev 30490)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-06 21:20:42 UTC (rev 30491)
@@ -1114,12 +1114,22 @@
         except:
             curr_disp = None
 
+        if len(self.GetListOfCmdThreads()) > 0:
+            # only one running command enabled (per GMConsole instance)
+            busy = wx.BusyInfo(message=_("Unable to run the command, another command is running..."),
+                               parent=self)
+            wx.Yield()
+            time.sleep(3)
+            busy.Destroy()
+            return 
+
         # command given as a string ?
         try:
             cmdlist = command.strip().split(' ')
         except:
             cmdlist = command
 
+        # print cmdlist[0], globalvar.grassCmd['all']
         if cmdlist[0] in globalvar.grassCmd['all']:
             # send GRASS command without arguments to GUI command interface
             # except display commands (they are handled differently)
@@ -1152,34 +1162,34 @@
                     # select 'Command output' tab
                     self.parent.notebook.SetSelection(1)
                 
-                    # activate computational region (set with g.region)
-                    # for all non-display commands.
-                    tmpreg = os.getenv("GRASS_REGION")
-                    os.unsetenv("GRASS_REGION")
-
-                    if len(cmdlist) == 1:
-                        # process GRASS command without argument
-                        menuform.GUI().ParseCommand(cmdlist, parentframe=self)
-                    else:
-                        # process GRASS command with argument
-                        self.cmdPID = len(self.cmdThreads)+1
-                        self.WriteCmdLog('%s' % ' '.join(cmdlist), pid=self.cmdPID)
-                                                
-                        grassCmd = gcmd.Command(cmdlist, wait=False,
-                                                stdout=self.cmd_stdout,
-                                                stderr=self.cmd_stderr)
-    
-                        self.cmdThreads.append(grassCmd.cmdThread)
-
-                    # deactivate computational region and return to display settings
-                    if tmpreg:
-                        os.environ["GRASS_REGION"] = tmpreg
-
+                # activate computational region (set with g.region)
+                # for all non-display commands.
+                tmpreg = os.getenv("GRASS_REGION")
+                os.unsetenv("GRASS_REGION")
+                print cmdlist
+                if len(cmdlist) == 1:
+                    # process GRASS command without argument
+                    menuform.GUI().ParseCommand(cmdlist, parentframe=self)
+                else:
+                    # process GRASS command with argument
+                    self.cmdPID = len(self.cmdThreads)+1
+                    print self.cmdPID
+                    self.WriteCmdLog('%s' % ' '.join(cmdlist), pid=self.cmdPID)
+                    
+                    grassCmd = gcmd.Command(cmdlist, wait=False,
+                                            stdout=self.cmd_stdout,
+                                            stderr=self.cmd_stderr)
+                    
+                    self.cmdThreads.append(grassCmd.cmdThread)
+                    
                     return grassCmd
+                # deactivate computational region and return to display settings
+                if tmpreg:
+                    os.environ["GRASS_REGION"] = tmpreg
         else:
             # Send any other command to the shell. Send output to
             # console output window
-
+            print cmdlist
             if self.parent.notebook.GetSelection() != 1:
                 # select 'Command output' tab
                 self.parent.notebook.SetSelection(1)



More information about the grass-commit mailing list