[GRASS-dev] Re: not quite there on fonts

Glynn Clements glynn at gclements.plus.com
Sun May 13 12:24:48 EDT 2007

Michael Barton wrote:

> >>> I had to do this in the menu entry instead of guarantee_xmon because
> >>> the procedure calls the spawn to run the command.
> >> 
> >> spawn is still "downstream" of the Tcl GUI, or is it somehow a sibling
> >> to it?
> > 
> > spawn is part of the GUI, so it shares the same environment with the
> > rest of the GUI.
> > 
> > I'm not sure why putting the setting in guarantee_xmon wouldn't work,
> > unless the "global env" was overlooked (if you forget that, you're
> > modifying a local variable named "env" rather than the actual
> > environment which is passed on to child processes).
> Turning it on is not problem. It's turning it off. You can't put unset
> env(GRASS_RENDER_IMMEDIATE) after the call to spawn at the end of the
> procedure because it will unset the variable before the command is
> done.

You can set it back as soon as the "open |..." returns (for the actual
d.* command, not d.mon). Once the child has started, nothing which
gis.m does to its own environment will affect it.

> And
> it is complicated to put it into spawn because that procedure is used by
> processes that don't need the environmental setting as well as processes
> that do. 
> It is of course possible to rewrite the procedures in question to pass a
> variable calling for resetting this, but it could have unforseen
> consequences elsewhere in the GUI code. There are only 3 or so commands that
> need it, so I opted to just add it into the menu command rather than do more
> rewriting and debugging.


One alternative would be to have e.g. with_xmon:

	proc with_xmon {args} {
		global env
		eval exec $args

So e.g.:
	{ guarantee_xmon ; spawn d.path.sh -b --ui }

	{ with_xmon spawn d.path.sh -b --ui }

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list