[Qgis-developer] Struggling with iface.openFeatureForm()

Bernhard Ströbl bernhard.stroebl at jena.de
Thu Aug 21 04:45:41 PDT 2014


I tried in master (1.5) after Jürgen's fix and it worked for me (PostGIS 
I think)

Bernhard

Am 21.08.2014 13:41, schrieb Alexandre Neto:
> Hi Bernhard,
>
> Thanks for the link, I guess that the 2.4 problem was already identified
> and corrected in master.
>
> A bit of update on this matter. Regarding 2.2. I was doing my tests with
> a dbf layer. With a postgis table is working well. So I can work with
> that for now.
>
> Still, it seems that there is something to fix in 2.5. should I open a
> ticket?
>
> Alexandre Neto
>
>
> On Thu, Aug 21, 2014 at 12:37 PM, Bernhard Ströbl
> <bernhard.stroebl at jena.de <mailto:bernhard.stroebl at jena.de>> wrote:
>
>     Hi Alexandre,
>
>     see: http://hub.qgis.org/issues/__10865
>     <http://hub.qgis.org/issues/10865>
>
>     regards
>
>     Bernhard
>
>     Am 21.08.2014 13 <tel:21.08.2014%2013>:23, schrieb Alexandre Neto:
>
>         Hello all,
>
>         I'm trying to finish a plugin that was initially designed for 1.8.
>
>         Our workflow is currently on QGIS 2.2, but we will update in the
>         future,
>         so I'm doing some test in 2.4 and in master.
>
>         My goal is to open the feature form of a temporary feature in a
>         layer,
>         and keep it's attribute values for future actions.
>
>         The code is something like this:
>
>              mc = iface.mapCanvas()
>              layer = mc.currentLayer()
>              temp_feature = QgsFeature()
>              attributes = []
>
>              # getting default values (for primary keys)
>
>              provider = layer.dataProvider()
>              for j in layer.__pendingAllAttributesList():
>                   if provider.defaultValue(j):
>                       attributes.append(provider.__defaultValue(j))
>                   else:
>                       attributes.append(None)
>              temp_feature.setAttributes(__attributes)
>
>
>              iface.openFeatureForm(layer, temp_feature)
>
>              print temp_feature.attributes()
>
>
>         My "problems" are:
>
>         In 2.2, after I edit the feature form and press the OK button, the
>         temp_feature attributes are updated, but so is the first (already
>         commited) feature of my layer...weird.
>
>         In 2.4, the Feature Form always open in non editng mode, even
>         when the
>         current layer is editable.
>
>         In master (2.5 1b205be), after pressing the feature form ok
>         button, a
>         new feature is automaticly added to the attribute table, and the
>         temporary feature attributes are not updated.
>
>         I though it might be something to do with *updateFeatureOnly*
>         boolean
>
>         value, but setting it to True does not seems to make any difference.
>
>         Can anyone of you QGIS developing masters throw some light into
>         my poor
>         brain?
>
>         Thanks,
>
>         Alexandre Neto
>
>
>         _________________________________________________
>
>
>
>     __________ Information from ESET Mail Security, version of virus
>     signature database 10290 (20140821) __________
>
>     The message was checked by ESET Mail Security.
>     http://www.eset.com
>
>
>     _________________________________________________
>     Qgis-developer mailing list
>     Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>     http://lists.osgeo.org/__mailman/listinfo/qgis-__developer
>     <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>
>



__________ Information from ESET Mail Security, version of virus signature database 10290 (20140821) __________

The message was checked by ESET Mail Security.
http://www.eset.com




More information about the Qgis-developer mailing list