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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 6 00:27:37 EST 2008


Author: cmbarton
Date: 2008-02-06 00:27:37 -0500 (Wed, 06 Feb 2008)
New Revision: 29966

Modified:
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
Fixed bug where command without arguments entered in console did nothing or raised an error. Now it launches the GUI dialog.

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-02-06 05:26:24 UTC (rev 29965)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-02-06 05:27:37 UTC (rev 29966)
@@ -1088,7 +1088,7 @@
         rendered in map display widget that currently has
         the focus (as indicted by mdidx).
         """
-
+        
         # map display window available ?
         try:
             curr_disp = self.parent.curr_page.maptree.mapdisplay
@@ -1147,33 +1147,37 @@
                     tmpreg = os.getenv("GRASS_REGION")
                     os.unsetenv("GRASS_REGION")
 
-                    # process GRASS command with argument
-                    self.cmd_output.GotoPos(self.cmd_output.GetEndStyled())
-                    p1 = self.cmd_output.GetCurrentPos()
-                    line = '$ %s' % ' '.join(cmdlist)
-                    if len(line) < 80:
-                        diff = 80 - len(line)
-                        line += diff * ' '
-                    line += '%s' % os.linesep
-                    self.cmd_output.AddText(line)
-                    self.cmd_output.EnsureCaretVisible()
-                    p2 = self.cmd_output.GetCurrentPos()
-                    self.cmd_output.StartStyling(p1, 0xff)
-                    self.cmd_output.SetStyling(p2 - p1, self.cmd_output.StyleCommand)
+                    if len(cmdlist) == 1:
+                        #process GRASS command without argument
+                        menuform.GUI().ParseCommand(cmdlist, parentframe=self)
+                    else:
+                        # process GRASS command with argument
+                        self.cmd_output.GotoPos(self.cmd_output.GetEndStyled())
+                        p1 = self.cmd_output.GetCurrentPos()
+                        line = '$ %s' % ' '.join(cmdlist)
+                        if len(line) < 80:
+                            diff = 80 - len(line)
+                            line += diff * ' '
+                        line += '%s' % os.linesep
+                        self.cmd_output.AddText(line)
+                        self.cmd_output.EnsureCaretVisible()
+                        p2 = self.cmd_output.GetCurrentPos()
+                        self.cmd_output.StartStyling(p1, 0xff)
+                        self.cmd_output.SetStyling(p2 - p1, self.cmd_output.StyleCommand)
+    
+                        grassCmd = gcmd.Command(cmdlist, wait=False,
+                                                stdout=self.cmd_stdout,
+                                                stderr=self.cmd_stderr)
+    
+                        self.cmdThreads.append(grassCmd.cmdThread)
 
-                    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
 
         else:
             # Send any other command to the shell. Send output to
-            # console output window.
+            # console output window
 
             if self.parent.notebook.GetSelection() != 1:
                 # select 'Command output' tab



More information about the grass-commit mailing list