[GRASS5] Re: [GRASSLIST:1863] Re: problems displaying layers on 5.7

Glynn Clements glynn.clements at virgin.net
Tue Nov 25 22:18:49 EST 2003


Markus Neteler wrote:

> > OK. AFAICT, that thread contains everything which is publicly known
> > about the "console1" problems with using the MacOSX Tcl/Tk for
> > tcltkgrass.
> > 
> > FWIW, the other common tcltkgrass-on-mac problems were:
> 
> This does not affect 5.7, right (doesn't contain tcltkgrass)?

I don't know; I haven't really been following 5.7.

> > 1. Use of xwininfo in conjunction with "winfo id".
> > 2. Use of xlsclients and xwininfo in search_xdrivers (gui.tcl).
> > 3. Use of xterm.
> > 
> > 1 will never work with the MacOSX Tcl/Tk; the Tk windows aren't X
> > windows, so you can use xwininfo on them.
> > 
> > 2 is valid (XDRIVER is still an X11 program even on MacOSX), but ugly. 
> > If it wants to query the size, it should probably be using e.g. 
> > d.frame.
> > 
> > As for 3, hard-coding "xterm" is gratuitous. Making "xterm" the
> > default is reasonable, but it should support the option of using a
> > different terminal emulator. Although getting it to use a "native"
> > console might be awkward.
> > 
> > -- 
> > Glynn Clements <glynn.clements at virgin.net>
> 
> [ xterm found in src/tcltkgrass/main/*.tcl ]
> 
> Should we introduce
> $GRASS_TERM
> in etc/Init.sh? However, this is 5.0/5.3 related.

It's more complex than that, as you typically need to specify both the
command and some of its arguments, and the set of valid arguments
depends upon the program. Also, the position of any variables within
the command line may depend upon the program.

Certainly, each usage pattern should be isolated in a separate
function. E.g. instead of this:

    "Select" "" {
        X0 "" {"exec xterm -iconic -e d.mon select=x0"}
        X1 "" {"exec xterm -iconic -e d.mon select=x1"}
	...

(from menu.tcl), you would have e.g.:

    "Select" "" {
        X0 "" {"start_mon x0"}
        X1 "" {"start_mon x1"}
	...

with:
	proc start_mon {name} {
		exec xterm -iconic -e d.mon select=$name
	}

so that any changes would only need to be made in one place.

An easy mechanism for customisation would be to allow functions such
as start_mon to be put into a ~/.tcltkgrassrc file (distinct from the
~/.tcltkgrass file to which tcltkgrass saves its settings) which would
be sourced at start-up.

Allowing the user to override entire functions is both more flexible
and simpler than just allowing them to set variables which are used
within fixed code.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list