[GRASS5] New help button - please text review

On Tue, Feb 01, 2005 at 11:45:19AM -0500, John Gillette wrote:

xmessage -center -file - any_file.txt
at a terminal reproduces your error message.
Do you need the final dash (-) in the GRASS_PAGER variable?
In other words:
setenv GRASS_PAGER "xmessage -center -file"

Magic! This works

   if $TERM is csh like
     setenv GRASS_PAGER "xmessage -center -file"

   if $TERM is bash like
     export GRASS_PAGER="xmessage -center -file"

Thanks, John!

This should be documented somewhere in the online
help system.

Markus

> -----Original Message-----
> From: grass5-admin@grass.itc.it [mailto:grass5-admin@grass.itc.it]On
> Behalf Of Markus Neteler
> Sent: Monday, January 31, 2005 6:11 AM
> To: Hamish
> Cc: grass5 developers list
> Subject: Re: [GRASS5] New help button - please text review
>
>
> Hamish,
>
> On Mon, Jan 24, 2005 at 08:14:39PM +1300, Hamish wrote:
> ...
> > idea: use xmessage (should be installed on all Mac+Cygwin with X?)
> >
> >
> > if GUI:
> >
> > if $TERM is csh like
> > setenv GRASS_PAGER "xmessage -center -file -"
> >
> > if $TERM is bash like
> > export GRASS_PAGER="xmessage -center -file -"
>
> I tried this idea, works well for g.list etc.
>
> However, it doesn't with g.setproj:
>
> GRASS 6.0.cvs:~ > g.setproj
>
> WARNING! A projection file already exists for this location
> (Filename '/ssi0/ssi/neteler/grassdata/srilanka/PERMANENT/PROJ_INFO')
> ...
> Please specify projection name
> Enter 'list' for the list of available projections
> Hit RETURN to cancel request
> >list
> usage: xmessage [-options] [message ...]
>
> where options include:
> -file filename file to read message from,
> "-" for stdin
> -buttons string comma-separated list of label:exitcode
>
>
> The code in lib/gis/get_projname.c is
>
> do {
> fprintf(stderr,_("\n\nPlease specify projection
> name\n"));
> fprintf(stderr,_("Enter 'list' for the list of
> available projections\n"));
> fprintf (stderr, _("Hit RETURN to cancel request\n"));
> fprintf(stderr,">");
> } while(!G_gets(answer));
>
> G_strip(answer);
> if(strlen(answer)==0) return -1;
> if (strcmp(answer,"list") == 0) {
> if (isatty(1)) {
> sprintf(buff,"$GRASS_PAGER %s",Tmp_file);
> }
> else
> sprintf(buff,"cat %s",Tmp_file);
> system(buff);
> }
>
> Is it the isatty?
>
> Markus
>
> _______________________________________________
> grass5 mailing list
> grass5@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass5
>

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

On Tue, Feb 01, 2005 at 11:45:19AM -0500, John Gillette wrote:
> xmessage -center -file - any_file.txt
> at a terminal reproduces your error message.
> Do you need the final dash (-) in the GRASS_PAGER variable?
> In other words:
> setenv GRASS_PAGER "xmessage -center -file"

Magic! This works

   if $TERM is csh like
     setenv GRASS_PAGER "xmessage -center -file"

   if $TERM is bash like
     export GRASS_PAGER="xmessage -center -file"

Thanks, John!

This should be documented somewhere in the online
help system.

... ah yes. The "-file -" indicates input is to be piped from stdin.

xmessage works, but is very inconsistent with the rest of the GRASS GUI.

One problem I saw with xmessage is that it didn't give horiz. scroll
bars and when you did g.list for example, the right hand column of maps
could be silently hidden unless you thought to resize the window.

I like the g.message tcltk solution better. The attached prototype needs
a box with horiz and vert scroll bars (ala d.what.vect) for the longer
lists and more robust piping from stdin..

or just send to the existing lib/form/html_library_grass.tcl ?

Hamish

(attachments)

g.message (643 Bytes)

On Wed, Feb 02, 2005 at 06:08:33PM +1300, Hamish wrote:

> On Tue, Feb 01, 2005 at 11:45:19AM -0500, John Gillette wrote:
> > xmessage -center -file - any_file.txt
> > at a terminal reproduces your error message.
> > Do you need the final dash (-) in the GRASS_PAGER variable?
> > In other words:
> > setenv GRASS_PAGER "xmessage -center -file"
>
>
> Magic! This works
>
> if $TERM is csh like
> setenv GRASS_PAGER "xmessage -center -file"
>
> if $TERM is bash like
> export GRASS_PAGER="xmessage -center -file"
>
> Thanks, John!
>
> This should be documented somewhere in the online
> help system.

... ah yes. The "-file -" indicates input is to be piped from stdin.

xmessage works, but is very inconsistent with the rest of the GRASS GUI.

Meanwhile I disovered that

- Hamish's version works for g.list
- John's version works for g.setproj

GRASS_PAGER doesn't behave the same...

Markus

> > > Do you need the final dash (-) in the GRASS_PAGER variable?
> > > In other words:
> > > setenv GRASS_PAGER "xmessage -center -file"

..

> > Magic! This works

..

> ... ah yes. The "-file -" indicates input is to be piped from stdin.
>
> xmessage works, but is very inconsistent with the rest of the GRASS
> GUI.

Meanwhile I disovered that

- Hamish's version works for g.list
- John's version works for g.setproj

GRASS_PAGER doesn't behave the same...

One takes input piped from stdin, the other from a filename. (?)

xmessage can't figure this out automatically and needs to be told which
one it is getting.

I don't know how to get a shell script to do both. "read" strips
whitespace from between words, how else to read from stdin?

Again I'd push for a g.message C module which takes input from stdin or
a file and makes a Tcl display window ala a module started with no
options.

Hamish

Hamish said:

One takes input piped from stdin, the other from a filename. (?)

xmessage can't figure this out automatically and needs to be told which
one it is getting.

I don't know how to get a shell script to do both. "read" strips
whitespace from between words, how else to read from stdin?

Again I'd push for a g.message C module which takes input from stdin or
a file and makes a Tcl display window ala a module started with no
options.

Sorry, I was sleeping during the first part of this thread, so I'm
probably missing some of the requirements for what you're looking for. But
is this where you'd go like

     cat $* | xmessage -file -

in bash? In a script, this should work whether you give a filename on the
command line or just let it read stdin. (It'll actually concatenate any
number of named files, obviously.)

-- Mark

Mark P. Line
Polymathix
San Antonio, TX

On Thu, Feb 03, 2005 at 01:04:32PM +1300, Hamish wrote:

> > > > Do you need the final dash (-) in the GRASS_PAGER variable?
> > > > In other words:
> > > > setenv GRASS_PAGER "xmessage -center -file"
..
> > > Magic! This works
..
> > ... ah yes. The "-file -" indicates input is to be piped from stdin.
> >
> > xmessage works, but is very inconsistent with the rest of the GRASS
> > GUI.
>
> Meanwhile I disovered that
>
> - Hamish's version works for g.list
> - John's version works for g.setproj
>
> GRASS_PAGER doesn't behave the same...

One takes input piped from stdin, the other from a filename. (?)

xmessage can't figure this out automatically and needs to be told which
one it is getting.

I don't know how to get a shell script to do both. "read" strips
whitespace from between words, how else to read from stdin?

Again I'd push for a g.message C module which takes input from stdin or
a file and makes a Tcl display window ala a module started with no
options.

Good idea. Let's do this in CVS once 6.0.0 is out or the release
branch created (soonish).

Markus