[GRASS-dev] G_OPT_V_TYPE cannot be recognized in --interface-description in GRASS GIS

Was: [Qgis-developer] QGIS GRASS plugin - modules upgrade

On Mon, Aug 24, 2015 at 2:42 PM, Radim Blazek <radim.blazek@gmail.com>
wrote:

On Tue, Aug 18, 2015 at 9:39 PM, Vaclav Petras <wenzeslaus@gmail.com>
wrote:
>> > I wonder why UI is not generated on the fly or during compilation? To
>> > maintain manually UI in QGIS is complicated and the result will be
>> > always out-of-date. Just 2 my cents, Martin
>>
>> UI is generated on the fly when a module UI is opened. It is using
>> options description printed by GRASS module (--interface-description)
>> combined with options definition for the module in QGIS (.qgm file).
>> The additional options definition in QGIS is mainly for two purposes:
>>
>> 1) limit number of options not to frighten users, some GRASS modules
>> are also represented as multiple items with predefined options
>
> Hi Radim and Martin,
>
> I guess that one of the reasons for QGIS interface for GRASS. Anyway, is
> there a option of not using .qgm file and using --interface-description
> only? This would not only enable some of the hidden features but more
> importantly, it would enable to use of modules from GRASS GIS Addons
> repository.
>
>> 2) define relations between options (e.g. type or column option
>> relation with input vector) or special options which has dedicated
>> widget in UI (e.g. GDAL/OGR input).
>
> This should be defined in GRASS GIS. If it is missing in GRASS or in the
> --interface-description then it is a bug which should be solved.

How can I recognize G_OPT_V_TYPE in --interface-description? It does
not have gisprompt.

Right [1]. I think this is a bug. No gisprompt is there. I think wxGUI
doesn't need it because the values for the combo box are defined there
already.

I suppose we can add something like 'type' or 'vtype' as one of the values
for gisprompt. No 'type' is currently used in the gisprompt, although it
might have been used in the past [2]. Probably the following could be the
gisprompt:

'old,vtype,vtype'
'old,v3type,v3type'

Unfortunately, I'm not sure about 'old' versus 'new' in this context (for
other things then maps) but hopefully somebody knows. I'm also not sure
about handing of unknown gisprompts in wxGUI but this can be easily tested.

Vaclav

[1]
https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/parser_standard_options.c#L487
[2]
https://trac.osgeo.org/grass/browser/grass/trunk/display/d.rast.arrow/main.c#L173

On Tue, Aug 25, 2015 at 3:31 AM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

Was: [Qgis-developer] QGIS GRASS plugin - modules upgrade

>> 2) define relations between options (e.g. type or column option
>> relation with input vector) or special options which has dedicated
>> widget in UI (e.g. GDAL/OGR input).
>
> This should be defined in GRASS GIS. If it is missing in GRASS or in the
> --interface-description then it is a bug which should be solved.

How can I recognize G_OPT_V_TYPE in --interface-description? It does
not have gisprompt.

Right [1]. I think this is a bug. No gisprompt is there. I think wxGUI
doesn't need it because the values for the combo box are defined there
already.

How does the wxGUI know that the option should be placed in Selection tab?

Radim

I suppose we can add something like 'type' or 'vtype' as one of the values
for gisprompt. No 'type' is currently used in the gisprompt, although it
might have been used in the past [2]. Probably the following could be the
gisprompt:

'old,vtype,vtype'
'old,v3type,v3type'

Unfortunately, I'm not sure about 'old' versus 'new' in this context (for
other things then maps) but hopefully somebody knows. I'm also not sure
about handing of unknown gisprompts in wxGUI but this can be easily tested.

Vaclav

[1]
https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/parser_standard_options.c#L487
[2]
https://trac.osgeo.org/grass/browser/grass/trunk/display/d.rast.arrow/main.c#L173

On Tue, Sep 1, 2015 at 5:14 AM, Radim Blazek <radim.blazek@gmail.com> wrote:

On Tue, Aug 25, 2015 at 3:31 AM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

Was: [Qgis-developer] QGIS GRASS plugin - modules upgrade

  1. define relations between options (e.g. type or column option
    relation with input vector) or special options which has dedicated
    widget in UI (e.g. GDAL/OGR input).

This should be defined in GRASS GIS. If it is missing in GRASS or in the
–interface-description then it is a bug which should be solved.

How can I recognize G_OPT_V_TYPE in --interface-description? It does
not have gisprompt.

Right [1]. I think this is a bug. No gisprompt is there. I think wxGUI
doesn’t need it because the values for the combo box are defined there
already.

How does the wxGUI know that the option should be placed in Selection tab?

It is defined using guisection:

https://trac.osgeo.org/grass/browser/grass/trunk/vector/v.distance/main.c#L97

In the XML it looks like:

Layer number or name (from) ... From

It is not defined what should happen with the ones which do not have guisection, i.e. it is up to you to decide and it doesn’t make sense for GRASS GIS to enforce one representation or the other. The old behavior in wxGUI was that all required options/parameters were in the Required tab and all with non defined guisection were in Optional tab together with all flags without guisection specified. The current (and better) behavior is that wxGUI respects the guisection specified for required options/parameters and (if it is actually specified) includes a red star to a field description. In this case, it is up to the module to have it defined nicely which means that module should specify guisection for every required parameter if it is defining it for at least one (i.e. define all or nothing). The Optional tab still behaves the same and contains all not-required options/parameters without guisection. So now Required and Optional behave the same – as fallbacks.