[GRASS-dev] Re: g.rename consolidation

Glynn Clements glynn at gclements.plus.com
Wed Feb 28 21:44:34 EST 2007


Maciej Sieczka wrote:

> >>> TclTk has a nice progress bar capabilities. But it needs consistent
> >>> information to read. There is a progress bar built into the map display that
> >>> tracks display progress. For modules that output consistent progress
> >>> information, there is the green progress bar in the autogenerated dialog.
> >>> The holes are for modules that don't output progress information in a
> >>> consistent format and for scripts that tend not to output it at all.
> >> Is it possible to make the script output progress info in way tcl/tk
> >> GRASS GUI could use it?
> 
> > 	if [ "$GRASS_MESSAGE_FORMAT" = "gui" ] ; then
> > 		echo "GRASS_INFO_PERCENT: $percent" >&2
> > 	fi
> 
> Thank you (I couldn't find this GRASS_INFO_PERCENT documented in
> variables.html).

GRASS_INFO_PERCENT isn't a variable; it's part of the syntax used for
progress output when modules are being run from a GUI. The default
output (using backspace characters to overwrite the previous output)
is awkward to parse, especially if any other output gets interleaved
with the percentages.

GRASS_MESSAGE_FORMAT is listed in variables.html, but it doesn't
specify its precise semantics.

> > It could get tricky if the script calls modules which output their own
> > percentages.
> > 
> > I suppose that the script *could* process the commands' stderr, parse
> > the percentages and re-emit them to its own stderr, scaled according
> > to the proportion of the task that the command represents. Although,
> > I'm not expecting to see many scripts actually taking that approach.
> 
> Just one (I hope ;) ) question more: could I somehow disable module's
> progress output alone, still letting it print it's ERRORs, ie. not
> sending both it's sdout and stderr to /dev/null?

Currently, no. Supporting e.g. GRASS_MESSAGE_FORMAT=silent would be a
useful enhancement.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list