[Qgis-developer] EasyCustomLabeling ported to QGIS 2.0

Chris Crook ccrook at linz.govt.nz
Sat Feb 1 17:34:35 PST 2014


I've updated the MemoryLayerSaver plugin to fix this.  Basically the problem comes from (I believe) the SIP wrapping around QgsFeature attributes.  So for a feature feat with a field 'f',

feat.f=None
value=feat.f
print type(value)

prints PyQtNullVariant.  The same result (expected in this case) if the first line is feat.f=NULL.

I've got around this in the MemoryLayerSaver by not setting the value at all if the required value is None.  This works as when a feature is created all the attributes are None - they just can't be set to that value as far as I can see (through the python API that is..)

Cheers
Chris
________________________________________
From: Régis Haubourg [regis.haubourg at eau-adour-garonne.fr]
Sent: 02 February 2014 04:03
To: qgis-developer at lists.osgeo.org
Subject: Re: [Qgis-developer] EasyCustomLabeling ported to QGIS 2.0

Just a followup, when restoring a memory layer thanks to memory layer saver,
we got QpyNullVariant objects, when we had NoneType object on memory layer's
creation. Updating the values to None restore the unpinned labels. Just use
this

 layer.changeAttributeValue(myFeatureId, myfieldId, None)

I will try to patch memory Layers Saver for this, since I assume some other
side effects with memory layers are expectable

Régis.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/EasyCustomLabeling-ported-to-QGIS-2-0-tp5101254p5101354.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


This message contains information, which is confidential and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.


More information about the Qgis-developer mailing list