[GRASS5] Re: [bug #3709] (grass) d.m - commands output pollutes the Grass terminal

Michael Barton michael.barton at asu.edu
Mon Oct 24 15:45:14 EDT 2005


Maciek,

With help from Glynn, I've updated the GIS Manager to redirect all
panel/layer output to the window at the bottom of the GIS Manager pane,
rather than the grass terminal. There are a couple minor cosmetic issues
that someone might be able to help me clean up, both of which are related to
d.rast. 

First, d.rast is the only module that tries to display its progress. This is
not really necessary but I don't see any way of turning it off (I tried what
Glynn suggests below to no effect). The progress display is a series of
percent values. They would look nicer on a new line following the d.rast
command and if each value overwrote the prior one. I'm not sure how to do
this, because I'm not sure what d.rast is doing here. This does not seem to
be a problem with the other panel commands.

Second, if I induce an error in d.rast, it generates a TclTk error. These
are somewhat more difficult to understand than normal GRASS error
messages--though not incomprehensible. All other panel command errors go to
the GIS Manager output window. Only d.rast still generates a TclTk error.
Again, I don't know what d.rast is doing that the other commands are not.

Hopefully, this addresses the further issues you raised with bug #3709. If
it seems OK, you can close it now.

-----

I also changed the monitor control buttons to radiobuttons. This should
address a wish you had several months back. The buttons indicate which
monitor is currently active. If that wish ever got a number, you can close
it.

Cheers,
Michael


______________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ  85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


> From: Glynn Clements <glynn at gclements.plus.com>
> Date: Mon, 24 Oct 2005 13:36:21 +0100
> To: Michael Barton <michael.barton at asu.edu>
> Subject: Re: [GRASS5] Re: [bug #3709] (grass) d.m - commands output pollutes
> the Grass terminal
> 
> 
> Michael Barton wrote:
> 
>> Glynn,
>> 
>> I tried your procedure and it pretty much works. There are a couple items
>> that I need to ask about, however.
>> 
>> 1) d.rast, d.rgb, and d.his produce output followed by a series of %
>> completed numbers as copied below
>> 
>> d.rgb red=Elkhorn_view1000 green=Elkhorn_view2000 blue=Elkhorn_view3000 -o
>> 0%  0%  6% 12% 18% 24% 30% 36% 42% 48% 54% 60% 66% 72% 78% 84% 90% 96%100%
>> 
>> Can this progress be limited to a single spot (i.e., each number replaces
>> the other instead of printing to the right of the last value) or eliminated
>> altogether? There is no such progress indication for vectors, barscales,
>> grids, etcs.
> 
> If you set the environment variable GRASS_MESSAGE_FORMAT to "gui",
> G_percent() will print percentage values on a separate line preceded
> by "GRASS_INFO_PERCENT: ". It should be quite straightforward to
> remove such lines from the output.
> 
> It appears that the backspace-handling code:
> 
> while {[set idx [string first "\b" $str]] != -1} {
> set last [expr $idx - 1]
> set str1 [string range $str 1 $last]
> set first [expr $idx + 1]
> set str [string range $str $first end]
> set pos [$outtext index "end - 1 chars"]
> $outtext delete $pos
> $outtext insert end $str1
> }
> 
> doesn't correctly handle the case where the output begins with a
> sequence of backspace characters (where it should be removing multiple
> characters from the end of $outtext).
> 
>> 2) I intentionally generated an error. It printed correctly to the output
>> window at the bottom of the GIS Manager panel. However, it also generated a
>> TclTk error for which I've copied the relevant part here. Is this to be
>> expected or can the TclTk error be avoided?
>> 
>> child process exited abnormally
>>     while executing
>> "close $fh"
> 
> Wrap the close in a catch statement, e.g.
> 
> catch {close $fh}
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list