<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<title>QGIS 2.4 64 bits doesn't find a a legend item.</title>
<div class="moz-text-html" lang="x-unicode"> Hello all,<br>
I've created a plugin for QGIS 2.4, which opens a composer and
updates labels, legends...<br>
These items are created with the loadFromTemplate() method.<br>
So, to update it, I run this code (for example with legend):<br>
<br>
<font color="#cc0000">legends = [item for item in
self.composition.items() if item.type() ==
QgsComposerItem.ComposerLegend]<br>
legend = legends[0]<br>
legend.updateLegend() </font><br>
<br>
On Ubuntu 12.04, no problem. The legend is updated.<br>
But on windows 7, Qgis (64 bits) can't find the legend item. <br>
<br>
<font color="#cc0000">"print legends"</font> gives an empty list,
and an error message is displayed : <br>
<br>
<i>Traceback (most recent call last):</i><i><br>
</i><i> File
"C:/Users/anthony/.qgis2/python/plugins\bdtravaux\operationdialog.py",
line 467, in composeur</i><i><br>
</i><i> legend = legends[0]</i><i><br>
</i><i>IndexError: list index out of range</i><i><br>
</i><br>
So I wonder why Qgis on Linux can find the legend item, and not
Qgis on Windows.<br>
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).<br>
Have you an idea?<br>
Thanks for advance<br>
Vincent<br>
<div class="moz-signature"><br>
<div class="moz-signature">
<div class="moz-signature">
<div class="moz-signature">
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
<br>
<div class="moz-signature">--------------------------- <br>
<div class="moz-signature">
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
<title></title>
<br>
<div class="moz-signature">
<table border="0" cellpadding="2" cellspacing="2"
height="206" width="818">
<tbody>
<tr>
<td colspan="2" rowspan="1" valign="top"
width="200">Vincent Damoy - Responsable SIG<br>
Conservatoire d'espaces naturels du Nord et
du Pas-de-Calais<br>
152 bd de Paris - 62190 Lillers<br>
Tél : 03.21.54.75.00 - Fax : 03.21.54.56.07<br>
<small><font color="#009900"><i><b>Pour
adhérer au Conservatoire :</b> <a
class="moz-txt-link-abbreviated"
href="http://www.cen-npdc.org/nous-rejoindre/adherent.html">www.cen-npdc.org/nous-rejoindre/adherent.html</a></i></font></small></td>
<td valign="top" width="300">
<p style="border: 2.60pt double #808080;
padding: 0.05cm"><br>
</p>
</td>
</tr>
<tr>
<td height="100" valign="top" width="65"><br>
</td>
<td valign="top"><small><i><font
color="#999999">Pour le respect de
l'environnement, n'imprimez ce message
qu'en cas de nécessité !</font></i></small></td>
<td valign="top"><br>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>