[GRASS-dev] inconsistency between G_OPT_V_INPUT and G_OPT_R_INPUT

Nikos Alexandris nik at nikosalexandris.net
Wed May 13 00:31:39 PDT 2015


* Pietro <peter.zamb at gmail.com> [2015-05-13 08:03:04 +0200]:

> Dear all,
> 
> I found an inconsistency of behaviors between G_OPT_R_INPUT and
> G_OPT_V_INPUT, here the test code:
> 
> {{{
> #!/usr/bin/env python
> # -- coding: utf-8 --
> #%module
> #% description: Test
> #% keywords: test
> #%end
> #%option G_OPT_R_INPUT
> #% key: discharge
> #% description: Name of river discharge [m3/s]
> #% required: yes
> #%end
> #%option G_OPT_V_INPUT
> #% key: river
> #% key_desc: name
> #% description: Name of vector map with interested segments of rivers
> #% required: yes
> #%end
> from __future__ import print_function
> import sys
> 
> # import grass libraries
> from grass.script import core as gcore
> 
> 
> def main(opts, flgs):
>     print(opts, flgs)
> 
> if __name__ == "__main__":
>     options, flags = gcore.parser()
>     sys.exit(main(options, flags))
> }}}
> 
> here is the output of the manual page:
> 
> {{{
> python r.example.py --help
> 
> Description:
>  Test
> 
> Keywords:
>  test
> 
> Usage:
>  r.example.py discharge=name river=name [--help] [--verbose] [--quiet]
>    [--ui]
> 
> Flags:
>  --h   Print usage summary
>  --v   Verbose module output
>  --q   Quiet module output
>  --ui  Force launching GUI dialog
> 
> Parameters:
>   discharge   Name of river discharge [m3/s]
>       river   Name of input vector map
>                Name of vector map with interested segments of rivers
> }}}
> 
> As you can see the description of the parameter add the default
> description set in G_OPT_V_INPUT and in a new line the description
> added manually in the definition of the module parameters. Instead the
> G_OPT_R_INPUT shows only the description set manually.
> 
> The behavior concerning the GUI is worst, because it shows only the
> default description string, see attached figure.
> 
> What do you think?

Pietro,

What if you place the 'key_desc' instruction in G_OPT_R_INPUT too?

Nikos


More information about the grass-dev mailing list