<!DOCTYPE html><html><head>
    <meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
  
<style type="text/css">body { font-family:'DejaVu Sans Mono'; font-size:12px}</style>
</head>
<body bgcolor="#FFFFFF" text="#000000"><div>Hi Benoît,</div><div><br></div><div>would you mind sharing your hole script as reference for others?</div><div>I think you touched a common problem which isn't covered with built-in functions yet, and not everyone is gifted with profound coding abilities in python (like me ;) )</div><div><br></div><div>Cheers</div><div>Bernd</div><div><br></div><div><br></div><div>Am 20.05.2015, 15:16 Uhr, schrieb Benoît Laurent <blaurent@heurisis.eu>:<br></div><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex">
    I eventually managed to solve my problem. In case somebody
    encounters the same or a similar one, I provide my solution: I used
    a Python script iterating over the groups. Apparently, it is not
    possible (or I failed) to refresh the mapCanvas during the Python
    script. <br>
    <br>
    Instead of using  <code><span class="pln">"legend</span><span class="pun">.</span><span class="pln">setLayerVisible</span><span class="pun">(</span><span class="pln">layer</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">True</span><span class="pun">)", I played with symbols:<br>
        <br>
        layers[2*g].rendererV2().symbol().setWidth(2)<br>
        layers[2*g].rendererV2().symbol().setAlpha(1)<br>
        <br>
        There were others problems in my code but the main difficulty
        lied there. Symbols can be updated during Python scripts and it
        perfectly meets my needs.<br>
        <br>
        Regards,<br>
        <br>
        Benoît<br>
      </span></code>
  
<br><br>
<hr style="border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;">
<table style="border-collapse:collapse;border:none;">
        <tbody><tr>
                <td style="border:none;padding:0px 15px 0px 8px">
                        <a href="http://www.avast.com/">
                                <img border="0" src="http://static.avast.com/emails/avast-mail-stamp.png">
                        </a>
                </td>
                <td>
                        <p style="color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;">
                                L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
                                <br><a href="http://www.avast.com/">www.avast.com</a>
                        </p>
                </td>
        </tr>
</tbody></table>
<br>
</blockquote><br><br><br><div id="M2Signature"><div>-- </div><div>Erstellt mit Operas E-Mail-Modul: <a href="http://www.opera.com/mail/">http://www.opera.com/mail/</a></div></div></body></html>