[GRASS-SVN] r37328 - in grass/branches/releasebranch_6_4: gui/tcltk/gis.m lib/gtcltk lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 21 10:04:28 EDT 2009


Author: hamish
Date: 2009-05-21 10:04:27 -0400 (Thu, 21 May 2009)
New Revision: 37328

Modified:
   grass/branches/releasebranch_6_4/gui/tcltk/gis.m/description.html
   grass/branches/releasebranch_6_4/gui/tcltk/gis.m/runandoutput.tcl
   grass/branches/releasebranch_6_4/lib/gtcltk/gronsole.tcl
   grass/branches/releasebranch_6_4/lib/init/grass-run.bat
   grass/branches/releasebranch_6_4/lib/init/grass-run.src
Log:
merge back 'Run in Xterm' fixes from devbr6

Modified: grass/branches/releasebranch_6_4/gui/tcltk/gis.m/description.html
===================================================================
--- grass/branches/releasebranch_6_4/gui/tcltk/gis.m/description.html	2009-05-21 12:30:47 UTC (rev 37327)
+++ grass/branches/releasebranch_6_4/gui/tcltk/gis.m/description.html	2009-05-21 14:04:27 UTC (rev 37328)
@@ -71,10 +71,20 @@
 <br><br>
 
 A separate console window shows all commands issued and all command
-output (upper window). GRASS commands (and any other unix/linux
-commands) can be run from the console (lower window).<br>
+output (upper window). GRASS commands (and any other UNIX/Linux/DOS
+commands) can be entered into and run from the console (lower window).
+If any of the arguments contain a space then the entire option must
+be quoted in Tcl/Tk style, e.g.:
+<div class="code"><pre>
+ v.db.select roads "where=label ~ 'highway'"
+  or
+ v.db.select roads {where=label ~ 'highway'}
+  or
+ v.db.select roads where=label\ ~\ 'highway'
+</pre></div>
 
 <br>
+<br>
 <center>
 <img src="gm_gronsole.png" alt="Output and command console window" height="231" width="480">
 </center>

Modified: grass/branches/releasebranch_6_4/gui/tcltk/gis.m/runandoutput.tcl
===================================================================
--- grass/branches/releasebranch_6_4/gui/tcltk/gis.m/runandoutput.tcl	2009-05-21 12:30:47 UTC (rev 37327)
+++ grass/branches/releasebranch_6_4/gui/tcltk/gis.m/runandoutput.tcl	2009-05-21 14:04:27 UTC (rev 37328)
@@ -108,22 +108,29 @@
 proc command_window {where} {
 	global keycontrol
 	global bgcolor
+	global mingw
+
 	set cmdpane [frame $where.command -bg $bgcolor]
 	set cmdwin [ScrolledWindow $where.win -relief flat -borderwidth 1]
 	set gronsole [Gronsole $where.gronsole -clickcmd "gronsole_history $cmdwin.text"]
 	set cmdtext [text $cmdwin.text -height 2 -width 80] 
 	$cmdwin setwidget $cmdtext
-	set runbutton [button $cmdpane.run -text [G_msg "Run"] -width 17 -wraplength 100 -default active -bd 1 \
-		-highlightbackground $bgcolor \
+	set runbutton [button $cmdpane.run -text [G_msg "Run"] -width 17 -wraplength 100 \
+		-default active -bd 1 -highlightbackground $bgcolor \
 		-command "run_disabled $gronsole $cmdpane.run \[string trim \[$cmdtext get 1.0 end\]\]"]
-	set run2button [button $cmdpane.run2 -text [G_msg "Run (background)"] -width 17 -wraplength 100 -bd 1 \
-		-highlightbackground $bgcolor \
+	set run2button [button $cmdpane.run2 -text [G_msg "Run (background)"] -width 17 \
+		-wraplength 100 -bd 1 -highlightbackground $bgcolor \
 		-command "$gronsole run \[string trim \[$cmdtext get 1.0 end\]\] {} {}"]
-	set runuibutton [button $cmdpane.runui -text [G_msg "Run (GUI)"] -width 17 -wraplength 100 -bd 1 \
-		-highlightbackground $bgcolor \
+	set runuibutton [button $cmdpane.runui -text [G_msg "Run (GUI)"] -width 17 \
+		-wraplength 100 -bd 1 -highlightbackground $bgcolor \
 		-command "run_ui \[string trim \[$cmdtext get 1.0 end\]\]"]
-	set runxterm [button $cmdpane.xterm -text [G_msg "Run (in Xterm)"] -width 17 -wraplength 100 -bd 1 \
-		-highlightbackground $bgcolor \
+	if { $mingw } {
+		set termbox "DOS box"
+	} else {
+		set termbox "Xterm"
+	}
+	set runxterm [button $cmdpane.xterm -text [G_msg "Run (in $termbox)"] -width 17 \
+		-wraplength 100 -bd 1 -highlightbackground $bgcolor \
 		-command "$gronsole run_xterm \[string trim \[$cmdtext get 1.0 end\]\] {}"]
 	set outpane [frame $where.output -bg $bgcolor]
 	set savebutton [button $outpane.save -text [G_msg " Save "] -command "$gronsole save" \

Modified: grass/branches/releasebranch_6_4/lib/gtcltk/gronsole.tcl
===================================================================
--- grass/branches/releasebranch_6_4/lib/gtcltk/gronsole.tcl	2009-05-21 12:30:47 UTC (rev 37327)
+++ grass/branches/releasebranch_6_4/lib/gtcltk/gronsole.tcl	2009-05-21 14:04:27 UTC (rev 37328)
@@ -395,6 +395,8 @@
 
 proc Gronsole::readout {path ci mark fh} {
 
+	global mingw
+
 	set lines {}
 
 	while {[gets $fh line] >= 0} {
@@ -406,6 +408,10 @@
 
 	if {[llength $lines] != 0} {
 		Gronsole::add_data_tag $path $ci out
+		if { $mingw == "1" } {
+		    # FIXME bug #606
+		    Gronsole::output_to_gronsole $path $mark $ci [list cmd$ci cmd$ci-out] "\n"
+		}
 	}
 
 	#output any messages from running the command
@@ -533,9 +539,12 @@
 	Gronsole::annotate $path $cmd [concat xterm $tags]
 
 	if { $mingw == "1" } {
-	    exec -- cmd.exe /c start $env(GISBASE)/etc/grass-run.bat $cmd &
+	    eval [list exec -- cmd.exe /c start \
+	    	$env(GISBASE)/etc/grass-run.bat ] $cmd &
 	} else {
-	    exec -- $env(GISBASE)/etc/grass-xterm-wrapper -name xterm-grass -e $env(GISBASE)/etc/grass-run.sh $cmd &
+	    eval [list exec -- $env(GISBASE)/etc/grass-xterm-wrapper \
+		-name xterm-grass -e $env(GISBASE)/etc/grass-run.sh ] \
+		$cmd &
 	}
 
 	update idletasks

Modified: grass/branches/releasebranch_6_4/lib/init/grass-run.bat
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/grass-run.bat	2009-05-21 12:30:47 UTC (rev 37327)
+++ grass/branches/releasebranch_6_4/lib/init/grass-run.bat	2009-05-21 14:04:27 UTC (rev 37328)
@@ -8,17 +8,21 @@
 set GRASS_UI_TERM=1
 
 rem Run command
-"%*"
+%*
 
+if not %errorlevel% == 0 goto error
+
 title GRASS: %1 Done.
-if %errorlevel% == 1 goto error
+echo.
+echo %1 complete.
+pause
 
-rem Pause for 2 seconds to allow user to read any output
-ping 127.0.0.1 -n 3 -w 1000 >NUL:
 :end
 exit %errorlevel%
 
 :error
+title GRASS: %1 Done. (error %errorlevel%)
+echo.
 echo -----
 echo ERROR: %1 exited abnormally.
 echo -----

Modified: grass/branches/releasebranch_6_4/lib/init/grass-run.src
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/grass-run.src	2009-05-21 12:30:47 UTC (rev 37327)
+++ grass/branches/releasebranch_6_4/lib/init/grass-run.src	2009-05-21 14:04:27 UTC (rev 37328)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # script to launch GRASS commands
 
+#DEBUG:
+#print_args "$@"
+
 # change console title to name of module
 if [ "$TERM" = "xterm" ] && [ -n "$BASH" ] ; then
    TITLE="GRASS: $1"
@@ -31,8 +34,12 @@
 EXIT_VAL=$?
 if [ $EXIT_VAL -ne 0 ] ; then
    echo
-   echo "ERROR: $1 exited abnormally. Press <enter> to continue."
+   echo "ERROR: \"$1\" exited abnormally. Press <enter> to continue."
    read
+else
+   echo
+   echo "\"$1\" complete. Press <enter> to continue."
+   read
 fi
 
 exit $EXIT_VAL



More information about the grass-commit mailing list