[GRASS-dev] why doesn't g.region launch gui?

Glynn Clements glynn at gclements.plus.com
Sat Feb 25 12:10:34 EST 2012


Michael Barton wrote:

> I've just learned that typing "g.region" [return] from the terminal
> does not launch the g.region GUI. Typing it from the wxPython
> command console does launch the GUI. Other commands typed from the
> terminal (followed by return with no arguments) launch their GUIs.
> 
> This is happening in GRASS 7 and GRASS 6.4.2 (and I suppose all
> versions in between).

g.region doesn't have any required options.

In 7.0, the GUI is shown if no arguments are given and at least one
option is required.

In 6.x, the GUI is shown if no arguments are given. Modules which can
reasonably be run without arguments (e.g. d.erase, g.gisenv) skip
calling G_parser() if no arguments are given, with e.g.:

    if (argc > 1 && G_parser(argc, argv))
	exit(1);

As g.region doesn't do this, I have no idea why it isn't showing the
GUI when run without arguments (unless you're accidentally running the
7.0 version for some reason).

In general, skipping G_parser() is unsatisfactory, as certain other
initialisation steps are performed by G_parser (e.g. checking
GRASS_OVERWRITE, parsing opt->options into opt->opts[], etc). And
always showing the GUI when no options are given is unsatisfactory for
modules which can reasonably be run without arguments.

The main downside of the current 7.0 behaviour is where it isn't
reasonable to run a module without arguments, but no specific option
is required. But that will cease to be an issue if we ever get around
to deciding how to extend the concept of required options to handle
the one-from-many cases.

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


More information about the grass-dev mailing list