[GRASS-dev] Re: [GRASS GIS] #254: wxpython Layer Manager: higher raster hides the lower (GRASS GIS)

Martin Landa landa.martin at gmail.com
Fri Aug 15 09:02:08 EDT 2008


Hi,

2008/8/15 Glynn Clements <glynn at gclements.plus.com>:
>> BTW, when I start g.gui without arguments the dialog is launched
>> instead of the GUI. This behaviour is not right I guess, the 'gui'
>> parameter has already defined default value. Now you are forced to run
>> `g.gui gui=wxpython`.
>
> That's becasue the gui= option is marked as required:
>
>    type = G_define_option();
>    type->key = "gui";
>        ...
>    type->required = YES;
>
> even though it always has a default value:
>
>    gui_type_env = G__getenv("GRASS_GUI");
>    if (gui_type_env && strcmp(gui_type_env, "text")) {
>        type->answer = G_store(gui_type_env);
>    }
>    else {
>        type->answer = "tcltk";
>    }
> If you remove the ->required setting, the dialog shouldn't appear.

well, I think the 'gui' parameter should stay required. Maybe I am
missing something, but what is wrong on the required parameter with
defined default value?

> In r32756, I removed all of the "argc > 1" hacks, and always call
> G_parser(). It only generates the dialog if no arguments are given and
> there is at least one required option.

I see, I think also default value(s) should be checked here, i.e.
don't generate the dialog if there is required option with defined
default value?

> Previously, it would always generate the dialog if no arguments were
> given. Modules which have no required arguments would evade this
> "feature" by not calling G_parser() if no arguments were given.
>
> But this has some undesirable side effects, e.g. module->overwrite
> won't reflect the setting of $GRASS_OVERWRITE. So now, everything
> always calls G_parser().

Make sense to me.

> BTW, g.gui shouldn't be using G__getenv() to initialise type->answer.
> It should leave it uninitialised, then check the GRASS_GUI setting if
> it's still null when G_parser() returns.

done

http://trac.osgeo.org/grass/changeset/32776

If no objections I will backport it to devbr6.

Martin

-- 
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *


More information about the grass-dev mailing list