[GRASS-dev] g.parser and link a relation between parameters

Hi devs,

may be I'm missing something stupid, but if I want to write a GRASS
modules that takes two different vectors and allows for each vetor to
select a column, something like:

{{{
#%module
#% description: Test
#% keyword: vector
#%end
#%option G_OPT_V_INPUT
#% key: vect0
#%end
#%option G_OPT_V_FIELD
#% key: vect0_layer
#% required: no
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_cost
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_maintenance
#%end
#%option G_OPT_V_INPUT
#% key: vect1
#%end
#%option G_OPT_V_FIELD
#% key: vect1_layer
#% required: no
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_other
#%end
#%option G_OPT_V_OUTPUT
#%end
from pprint import pprint
import grass.script.core as gcore

def main(options, flags):
    pprint(options)
    pprint(flags)

if __name__ == "__main__":
    main(*gcore.parser())
}}}

How can I say to WxGui that vect0_column_cost should display a
combobox with the available columns of the table linked with a layer
specify in vect0_layer of the vector map with name specify in vect0?

For the GRASS addons and GUI that we are developing we decide to use
the same root word: "vect0" and "vect1" to link the different
parameters to the vector, there are any better way to solve this? May
be something that it is working natively in GRASS?

Thank you for your help.

Pietro

On Wed, Mar 25, 2015 at 3:59 AM, Pietro <peter.zamb@gmail.com> wrote:

Hi devs,

may be I'm missing something stupid, but if I want to write a GRASS
modules that takes two different vectors and allows for each vetor to
select a column, something like:

{{{
#%module
#% description: Test
#% keyword: vector
#%end
#%option G_OPT_V_INPUT
#% key: vect0
#%end
#%option G_OPT_V_FIELD
#% key: vect0_layer
#% required: no
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_cost
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_maintenance
#%end
#%option G_OPT_V_INPUT
#% key: vect1
#%end
#%option G_OPT_V_FIELD
#% key: vect1_layer
#% required: no
#%end
#%option G_OPT_DB_COLUMN
#% key: vect0_column_other
#%end
#%option G_OPT_V_OUTPUT
#%end
from pprint import pprint
import grass.script.core as gcore

def main(options, flags):
    pprint(options)
    pprint(flags)

if __name__ == "__main__":
    main(*gcore.parser())
}}}

How can I say to WxGui that vect0_column_cost should display a
combobox with the available columns of the table linked with a layer
specify in vect0_layer of the vector map with name specify in vect0?

For the GRASS addons and GUI that we are developing we decide to use
the same root word: "vect0" and "vect1" to link the different
parameters to the vector, there are any better way to solve this? May
be something that it is working natively in GRASS?

There is 'guidependency' in parser, look at
http://trac.osgeo.org/grass/changeset/64914

The problem is that in case of 2 vector inputs, the gui is not working
properly - the layers and columns are not found for the second vector. I
haven't look into it yet.

Anna

Thank you for your help.

Pietro
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev