[Qgis-developer] Python init script
Andreas Neumann
a.neumann at carto.net
Thu Jul 10 01:18:40 PDT 2014
Hi Bernhard,
Ah I see. It is a different context. I am using a Python init script
(the one you can specify in the layer properties dialog in the fields
tab) that is triggered after the dialog already opened. The user is
using the info tool and the feature form opens and the python init
script is triggered.
In your example the context is different. Your script would open the
featureForm.
But thanks anyway,
Andreas
Am 2014-07-10 10:09, schrieb Bernhard Ströbl:
> Hallo Andreas,
>
>
> Am 10.07.2014 09:53, schrieb Andreas Neumann:
>> Hi Bernhard,
>>
>> I am able to change the attribute value in the feature record, but the
>> attribute dialog does not update the value. Probably because "feature"
>> is not live-linked but a copy of the record?
>
> works for me:
> myFeature = myLayer.selectedFeatures()[0] # access the feature
> myFeature[myLayer.fieldNameIndex("fieldxy")] = "blabla" # change value
> if iface.openFeatureForm(myLayer, myFeature): # show dialog
> # change feature values for myFeature in myLayer
>
> Bernhard
More information about the Qgis-developer
mailing list