[GRASS5] Re: [GRASSLIST:8729] Re: r.reclass not working in GUI

Glynn Clements glynn at gclements.plus.com
Mon Oct 24 08:15:48 EDT 2005


Hamish wrote:

> > g.mremove is never run in a terminal; if you are using it from the
> > GUI, you will have to enable the "force removal" option, as there's no
> > way to respond to the prompt.
> 
> Any thoughts on how to get G_yes() to spawn a Yes|No GUI much like
> G_percent() figures to do a Tcl thing instead of a stderr thing if it
> detects it is being run from a GUI environment? Same goes for G_ask_*(),
> but I'm not sure how much those are used anymore.

	if (G_info_format() == G_INFO_FORMAT_GUI)
		return !system("$GISBASE/etc/yesno.tcl");

where yesno.tcl is a Tcl/Tk program which returns 0 for yes and 1 for
no.

Having said that, programs should generally try to avoid assuming
interactive use, and take all necessary inputs from the command line. 
Scripting and web applications are legitimate uses.

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




More information about the grass-dev mailing list