Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-23 Thread Nyall Dawson
On Sun, 23 Sep 2018 at 21:50, Raymond Nijssen  wrote:
>
> Thank you Nyall and Allesandro.
>
> So I don't need to file the bus anymore. But who could/would dive into
> this and fix it? And how much would it cost? I might be able to find
> some funding.

Let me kick off some discussions with PyQt upstream, just to confirm
that this is an upstream bug and if so, what would be involved in a
fix.

Nyall

>
> For now I will use the workaround.
>
> Raymond
>
>
>
> On 23-09-18 11:48, Nyall Dawson wrote:
> > On Sun, 23 Sep 2018 at 19:37, Alessandro Pasotti  wrote:
> >>
> >> Do you have any clue about why this issue is not always reproducible?
> >
> > I suspect it's something to do with whether the item was created in
> > Python or c++.
> >
> > Nyall
> >
> >>
> >>
> >> On Sun, Sep 23, 2018, 11:27 Nyall Dawson  wrote:
> >>>
> >>> On Fri, 21 Sep 2018 at 23:20, Raymond Nijssen  
> >>> wrote:
> >>>
>  which doesn't work anymore, because there is no setText() function on a
>  QgsLayoutItem. Has anything changed recently? Does any one know a 
>  solution?
> >>>
> >>> Nothing has changed recently -- this has always been fragile, and the
> >>> bug lies deep within the library used to create the Python bindings.
> >>>
> >>> See e.g.
> >>>
> >>> http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html
> >>>
> >>> for a workaround
> >>>
> >>> Nyall
> >>>
> >>> Nyall
> >>>
> 
>  Regards,
>  Raymond
>  ___
>  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
> >>> ___
> >>> 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
> >
>
> --
> 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
___
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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-23 Thread Raymond Nijssen

Thank you Nyall and Allesandro.

So I don't need to file the bus anymore. But who could/would dive into 
this and fix it? And how much would it cost? I might be able to find 
some funding.


For now I will use the workaround.

Raymond



On 23-09-18 11:48, Nyall Dawson wrote:

On Sun, 23 Sep 2018 at 19:37, Alessandro Pasotti  wrote:


Do you have any clue about why this issue is not always reproducible?


I suspect it's something to do with whether the item was created in
Python or c++.

Nyall




On Sun, Sep 23, 2018, 11:27 Nyall Dawson  wrote:


On Fri, 21 Sep 2018 at 23:20, Raymond Nijssen  wrote:


which doesn't work anymore, because there is no setText() function on a
QgsLayoutItem. Has anything changed recently? Does any one know a solution?


Nothing has changed recently -- this has always been fragile, and the
bug lies deep within the library used to create the Python bindings.

See e.g.

http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html

for a workaround

Nyall

Nyall



Regards,
Raymond
___
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

___
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




--
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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-23 Thread Nyall Dawson
On Sun, 23 Sep 2018 at 19:37, Alessandro Pasotti  wrote:
>
> Do you have any clue about why this issue is not always reproducible?

I suspect it's something to do with whether the item was created in
Python or c++.

Nyall

>
>
> On Sun, Sep 23, 2018, 11:27 Nyall Dawson  wrote:
>>
>> On Fri, 21 Sep 2018 at 23:20, Raymond Nijssen  wrote:
>>
>> > which doesn't work anymore, because there is no setText() function on a
>> > QgsLayoutItem. Has anything changed recently? Does any one know a solution?
>>
>> Nothing has changed recently -- this has always been fragile, and the
>> bug lies deep within the library used to create the Python bindings.
>>
>> See e.g.
>>
>> http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html
>>
>> for a workaround
>>
>> Nyall
>>
>> Nyall
>>
>> >
>> > Regards,
>> > Raymond
>> > ___
>> > 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
>> ___
>> 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
___
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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-23 Thread Alessandro Pasotti
Do you have any clue about why this issue is not always reproducible?


On Sun, Sep 23, 2018, 11:27 Nyall Dawson  wrote:

> On Fri, 21 Sep 2018 at 23:20, Raymond Nijssen 
> wrote:
>
> > which doesn't work anymore, because there is no setText() function on a
> > QgsLayoutItem. Has anything changed recently? Does any one know a
> solution?
>
> Nothing has changed recently -- this has always been fragile, and the
> bug lies deep within the library used to create the Python bindings.
>
> See e.g.
>
>
> http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html
>
> for a workaround
>
> Nyall
>
> Nyall
>
> >
> > Regards,
> > Raymond
> > ___
> > 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
> ___
> 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
___
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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-23 Thread Nyall Dawson
On Fri, 21 Sep 2018 at 23:20, Raymond Nijssen  wrote:

> which doesn't work anymore, because there is no setText() function on a
> QgsLayoutItem. Has anything changed recently? Does any one know a solution?

Nothing has changed recently -- this has always been fragile, and the
bug lies deep within the library used to create the Python bindings.

See e.g.

http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-QgsLayout-itemById-returns-wrong-object-td5350947.html

for a workaround

Nyall

Nyall

>
> Regards,
> Raymond
> ___
> 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
___
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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-23 Thread Alessandro Pasotti
On Fri, Sep 21, 2018 at 8:36 PM Raymond Nijssen 
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]: 

In [4]: lo.itemById('my_label')

Out[4]: 


In [5]: lo.items()

Out[5]:

[,

,

,

,

,

,

,

]


In [6]: lo.items()

Out[6]:

[,

,

,

,

,

,

,

,

,

,

,

,

]


In [7]: lo.items()

Out[7]:

[,

,

,

,

,

,

,

,

,

,

,

,

,

,

,

,

,

]


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  > > 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
> > 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:
> >  > 
> >  >
> >  >
> >  > but today it outputs:
> >  > 
> >  >
> >  >
> >  >
> >  > 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
> > 
> >  > >
> >  > 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  
> >
> > --
> > 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  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 
>
> --
> 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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-21 Thread Raymond Nijssen
Not working for me. I just built todays master (e85c09254c) and get the 
same result. What version did you build?




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 > 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
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:
 >     
 >
 >
 >     but today it outputs:
 >     
 >
 >
 >
 >     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

>
 >     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  

-- 
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 


--
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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-21 Thread Alessandro Pasotti
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 
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  > > 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:
> > 
> >
> >
> > but today it outputs:
> > 
> >
> >
> >
> > 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  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 
>
> --
> 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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-21 Thread Raymond Nijssen

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 > 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:



but today it outputs:




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 
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 


--
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

Re: [QGIS-Developer] Has QgsLayout.itemById() changed?

2018-09-21 Thread Alessandro Pasotti
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 
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:
> 
>
>
> but today it outputs:
> 
>
>
>
> 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
> 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