<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Sep 21, 2018 at 8:36 PM Raymond Nijssen <<a href="mailto:r.nijssen@terglobo.nl">r.nijssen@terglobo.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Not working for me. I just built todays master (e85c09254c) and get the <br>
same result. What version did you build?<br></blockquote><div><br></div><div>Same as yours.</div><div><br></div><div>Btw, please file a ticket, I just re-tested it now and got the issue again, this is my workflow:</div><div><br></div><div>- Open a project that has no layouts</div><div>- Create a new layout through the manager</div><div>- Add a label and set id = "my_label"</div><div>- Save and close the layout and the manager</div><div>- Run python code and:</div><div><br></div><div>

<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">In [</span><span style="font-weight:600;color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,128)">]:</span> p = QgsProject.instance()</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">   ...:</span> lom = p.layoutManager()</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">   ...:</span> lo = lom.layoutByName('Layout 1')</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">   ...:</span> </p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">  <br></span></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">In [</span><span style="font-weight:600;color:rgb(0,0,128)">2</span><span style="color:rgb(0,0,128)">]:</span> lo</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(139,0,0)">Out[</span><span style="font-weight:600;color:rgb(139,0,0)">2</span><span style="color:rgb(139,0,0)">]:</span> <qgis._core.QgsPrintLayout at 0x7f981f368d38></p><br><p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">In [</span><span style="font-weight:600;color:rgb(0,0,128)">4</span><span style="color:rgb(0,0,128)">]:</span> lo.itemById('my_label')</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(139,0,0)">Out[</span><span style="font-weight:600;color:rgb(139,0,0)">4</span><span style="color:rgb(139,0,0)">]:</span> <qgis._core.QgsLayoutItem at 0x7f989db01dc8></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">In [</span><span style="font-weight:600;color:rgb(0,0,128)">5</span><span style="color:rgb(0,0,128)">]:</span> lo.items()</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(139,0,0)">Out[</span><span style="font-weight:600;color:rgb(139,0,0)">5</span><span style="color:rgb(139,0,0)">]:</span> </p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap">[<PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989db01ee8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01e58>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01f78>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91048>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da910d8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <qgis._core.QgsLayoutItem at 0x7f989db01dc8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91168>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <qgis._core.QgsLayoutItemPage at 0x7f989da911f8>]</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">In [</span><span style="font-weight:600;color:rgb(0,0,128)">6</span><span style="color:rgb(0,0,128)">]:</span> lo.items()</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(139,0,0)">Out[</span><span style="font-weight:600;color:rgb(139,0,0)">6</span><span style="color:rgb(139,0,0)">]:</span> </p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap">[<PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91318>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989db01ee8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da913a8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91438>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da914c8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91558>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01e58>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01f78>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91048>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da910d8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <qgis._core.QgsLayoutItem at 0x7f989db01dc8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91168>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <qgis._core.QgsLayoutItemPage at 0x7f989da911f8>]</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">In [</span><span style="font-weight:600;color:rgb(0,0,128)">7</span><span style="color:rgb(0,0,128)">]:</span> lo.items()</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><span style="color:rgb(139,0,0)">Out[</span><span style="font-weight:600;color:rgb(139,0,0)">7</span><span style="color:rgb(139,0,0)">]:</span> </p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap">[<PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91678>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91318>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989db01ee8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91708>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91798>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91828>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da918b8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da913a8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91438>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da914c8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91558>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01e58>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01f78>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91048>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da910d8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <qgis._core.QgsLayoutItem at 0x7f989db01dc8>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91168>,</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> <qgis._core.QgsLayoutItemPage at 0x7f989da911f8>]</p></div><div><br></div><div><br></div><div>Now, there is  another (possibly unrelated) issue: if I open the layout again and do nothing but hit "save" and close the layout, when re-running the code I get a brand new set of QGraphicsLineItem each time I save it.</div><div><br></div><div>This looks like a bug to me.</div><div><br></div><div></div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
On 21-09-18 16:29, Alessandro Pasotti wrote:<br>
> <br>
> Hi Raymond,<br>
> <br>
> You know what? I've just rebased and rebuilt current master and I cannot <br>
> reproduce it anymore :(<br>
> I checked the bindings code and it looks fine, can you check latest master?<br>
> <br>
> <br>
> On Fri, Sep 21, 2018 at 3:47 PM Raymond Nijssen <<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a> <br>
> <mailto:<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>>> wrote:<br>
> <br>
>     Will do so. Thank you Alessandro!<br>
> <br>
> <br>
> <br>
>     On 21-09-18 15:32, Alessandro Pasotti wrote:<br>
>      > Hi Raymond,<br>
>      ><br>
>      > confirmed, there is probably something broken in the bindings,<br>
>     please<br>
>      > file a ticket.<br>
>      ><br>
>      > On Fri, Sep 21, 2018 at 3:20 PM Raymond Nijssen<br>
>     <<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a> <mailto:<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>><br>
>      > <mailto:<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a> <mailto:<a href="mailto:r.nijssen@terglobo.nl" target="_blank">r.nijssen@terglobo.nl</a>>>> wrote:<br>
>      ><br>
>      >     Running this python script (in qgis 3.3):<br>
>      ><br>
>      >     p = QgsProject.instance()<br>
>      >     lom = p.layoutManager()<br>
>      >     lo = lom.layoutByName('a4')<br>
>      >     item = lo.itemById('label_title')<br>
>      >     print(item)<br>
>      ><br>
>      ><br>
>      >     a few weeks ago, it outputed this:<br>
>      >     <qgis._core.QgsLayoutItemLabel object at 0x7fe90b6d0318><br>
>      ><br>
>      ><br>
>      >     but today it outputs:<br>
>      >     <qgis._core.QgsLayoutItem object at 0x7fe90b6d0318><br>
>      ><br>
>      ><br>
>      ><br>
>      >     My next line is:<br>
>      ><br>
>      >     item.setText('hello')<br>
>      ><br>
>      >     which doesn't work anymore, because there is no setText()<br>
>     function on a<br>
>      >     QgsLayoutItem. Has anything changed recently? Does any one know a<br>
>      >     solution?<br>
>      ><br>
>      >     Regards,<br>
>      >     Raymond<br>
>      >     _______________________________________________<br>
>      >     QGIS-Developer mailing list<br>
>      > <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
>     <mailto:<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>><br>
>     <mailto:<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
>     <mailto:<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>>><br>
>      >     List info:<br>
>     <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>      >     Unsubscribe:<br>
>     <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>      ><br>
>      ><br>
>      ><br>
>      > --<br>
>      > Alessandro Pasotti<br>
>      > w3: <a href="http://www.itopen.it" rel="noreferrer" target="_blank">www.itopen.it</a> <<a href="http://www.itopen.it" rel="noreferrer" target="_blank">http://www.itopen.it</a>> <<a href="http://www.itopen.it" rel="noreferrer" target="_blank">http://www.itopen.it</a>><br>
> <br>
>     -- <br>
>     Terglobo<br>
>     Fahrenheitstraat 1<br>
>     5223 BJ 's-Hertogenbosch<br>
>     The Netherlands<br>
>     +31 (0) 6 25 31 49 83<br>
>     _______________________________________________<br>
>     QGIS-Developer mailing list<br>
>     <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a> <mailto:<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a>><br>
>     List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>     Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> <br>
> <br>
> <br>
> -- <br>
> Alessandro Pasotti<br>
> w3: <a href="http://www.itopen.it" rel="noreferrer" target="_blank">www.itopen.it</a> <<a href="http://www.itopen.it" rel="noreferrer" target="_blank">http://www.itopen.it</a>><br>
<br>
-- <br>
Terglobo<br>
Fahrenheitstraat 1<br>
5223 BJ 's-Hertogenbosch<br>
The Netherlands<br>
+31 (0) 6 25 31 49 83<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div></div>