On Fri, Sep 21, 2018 at 8:36 PM Raymond Nijssen <r.nijs...@terglobo.nl> wrote:
> Not working for me. I just built todays master (e85c09254c) and get the > same result. What version did you build? > Same as yours. Btw, please file a ticket, I just re-tested it now and got the issue again, this is my workflow: - Open a project that has no layouts - Create a new layout through the manager - Add a label and set id = "my_label" - Save and close the layout and the manager - Run python code and: In [1]: p = QgsProject.instance() ...: lom = p.layoutManager() ...: lo = lom.layoutByName('Layout 1') ...: In [2]: lo Out[2]: <qgis._core.QgsPrintLayout at 0x7f981f368d38> In [4]: lo.itemById('my_label') Out[4]: <qgis._core.QgsLayoutItem at 0x7f989db01dc8> In [5]: lo.items() Out[5]: [<PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989db01ee8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01e58>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01f78>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91048>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da910d8>, <qgis._core.QgsLayoutItem at 0x7f989db01dc8>, <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91168>, <qgis._core.QgsLayoutItemPage at 0x7f989da911f8>] In [6]: lo.items() Out[6]: [<PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91318>, <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989db01ee8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da913a8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91438>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da914c8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91558>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01e58>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01f78>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91048>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da910d8>, <qgis._core.QgsLayoutItem at 0x7f989db01dc8>, <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91168>, <qgis._core.QgsLayoutItemPage at 0x7f989da911f8>] In [7]: lo.items() Out[7]: [<PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91678>, <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91318>, <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989db01ee8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91708>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91798>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91828>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da918b8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da913a8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91438>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da914c8>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91558>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01e58>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989db01f78>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da91048>, <PyQt5.QtWidgets.QGraphicsLineItem at 0x7f989da910d8>, <qgis._core.QgsLayoutItem at 0x7f989db01dc8>, <PyQt5.QtWidgets.QGraphicsRectItem at 0x7f989da91168>, <qgis._core.QgsLayoutItemPage at 0x7f989da911f8>] 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. This looks like a bug to me. > > > On 21-09-18 16:29, Alessandro Pasotti wrote: > > > > Hi Raymond, > > > > You know what? I've just rebased and rebuilt current master and I cannot > > reproduce it anymore :( > > I checked the bindings code and it looks fine, can you check latest > master? > > > > > > On Fri, Sep 21, 2018 at 3:47 PM Raymond Nijssen <r.nijs...@terglobo.nl > > <mailto:r.nijs...@terglobo.nl>> wrote: > > > > Will do so. Thank you Alessandro! > > > > > > > > On 21-09-18 15:32, Alessandro Pasotti wrote: > > > Hi Raymond, > > > > > > confirmed, there is probably something broken in the bindings, > > please > > > file a ticket. > > > > > > On Fri, Sep 21, 2018 at 3:20 PM Raymond Nijssen > > <r.nijs...@terglobo.nl <mailto:r.nijs...@terglobo.nl> > > > <mailto:r.nijs...@terglobo.nl <mailto:r.nijs...@terglobo.nl>>> > wrote: > > > > > > Running this python script (in qgis 3.3): > > > > > > p = QgsProject.instance() > > > lom = p.layoutManager() > > > lo = lom.layoutByName('a4') > > > item = lo.itemById('label_title') > > > print(item) > > > > > > > > > a few weeks ago, it outputed this: > > > <qgis._core.QgsLayoutItemLabel object at 0x7fe90b6d0318> > > > > > > > > > but today it outputs: > > > <qgis._core.QgsLayoutItem object at 0x7fe90b6d0318> > > > > > > > > > > > > My next line is: > > > > > > item.setText('hello') > > > > > > which doesn't work anymore, because there is no setText() > > function on a > > > QgsLayoutItem. Has anything changed recently? Does any one > know a > > > solution? > > > > > > Regards, > > > Raymond > > > _______________________________________________ > > > QGIS-Developer mailing list > > > QGIS-Developer@lists.osgeo.org > > <mailto:QGIS-Developer@lists.osgeo.org> > > <mailto:QGIS-Developer@lists.osgeo.org > > <mailto:QGIS-Developer@lists.osgeo.org>> > > > List info: > > https://lists.osgeo.org/mailman/listinfo/qgis-developer > > > Unsubscribe: > > https://lists.osgeo.org/mailman/listinfo/qgis-developer > > > > > > > > > > > > -- > > > Alessandro Pasotti > > > w3: www.itopen.it <http://www.itopen.it> <http://www.itopen.it> > > > > -- > > Terglobo > > Fahrenheitstraat 1 > > 5223 BJ 's-Hertogenbosch > > The Netherlands > > +31 (0) 6 25 31 49 83 > > _______________________________________________ > > QGIS-Developer mailing list > > QGIS-Developer@lists.osgeo.org <mailto: > QGIS-Developer@lists.osgeo.org> > > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > > > > > > > -- > > Alessandro Pasotti > > w3: www.itopen.it <http://www.itopen.it> > > -- > Terglobo > Fahrenheitstraat 1 > 5223 BJ 's-Hertogenbosch > The Netherlands > +31 (0) 6 25 31 49 83 > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer -- Alessandro Pasotti w3: www.itopen.it
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer