I want to configure the edit widget (in qgis: "Properties" of a layer, "Fields", column "edit widget") for a field of a editable layer (shapefile) using a Python plugin. I want set the edit widget with a "Value Map" using a CSV file for the values.

In the documentation http://qgis.org/api/2.8/classQgsVectorLayer.html#a82f6764bb1189e9d5192cc4b4285fdba i find the method setEditorWidgetV2Config, but when i try a code like this:

layToEdit.setEditorWidgetV2Config(indField, {...} )

QGIS returns this error for any configuration value in the second parameter:

(qgis.bin:6585): Gtk-CRITICAL **: IA__gtk_widget_get_direction: assertion 'GTK_IS_WIDGET (widget)' failed

what parameters should I use to configure the edit widget as a "value map" that uses the values of a CSV?


Browse other questions tagged or ask your own question.