[Qgis-developer] QGIS 2.4 64 bits doesn't find a a legend item.

Vincent Damoy vincent.damoy at espaces-naturels.fr
Fri Sep 5 08:17:16 PDT 2014


QGIS 2.4 64 bits doesn't find a a legend item.
Hello all,
I've created a plugin for QGIS 2.4, which opens a composer and updates 
labels, legends...
These items are created with the loadFromTemplate() method.
So, to update it, I run this code (for example with legend):

legends = [item for item in self.composition.items() if item.type() == 
QgsComposerItem.ComposerLegend]
         legend = legends[0]
         legend.updateLegend()

On Ubuntu 12.04, no problem. The legend is updated.
But on windows 7, Qgis (64 bits) can't find the legend item.

"print legends" gives an empty list, and an error message is displayed :

/Traceback (most recent call last)://
//  File 
"C:/Users/anthony/.qgis2/python/plugins\bdtravaux\operationdialog.py", 
line 467, in composeur//
//    legend = legends[0]//
//IndexError: list index out of range//
/
So I wonder why Qgis on Linux can find the legend item, and not Qgis on 
Windows.
I must precise the code is exactly the same on both sides (I just copy 
the Ubuntu QGIS code to the windows plugin folder, then test).
Have you an idea?
Thanks for advance
Vincent


---------------------------

Vincent Damoy - Responsable SIG
Conservatoire d'espaces naturels du Nord et du Pas-de-Calais
152 bd de Paris - 62190 Lillers
Tél : 03.21.54.75.00 - Fax : 03.21.54.56.07
/*Pour adhérer au Conservatoire :* 
www.cen-npdc.org/nous-rejoindre/adherent.html/ 	



	/Pour le respect de l'environnement, n'imprimez ce message qu'en cas de 
nécessité !/ 	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140905/4a0c23f5/attachment.html>


More information about the Qgis-developer mailing list