Wrong context detected by pylupdate

Phil Thompson phil at riverbankcomputing.com
Sun Jul 5 15:11:26 BST 2020


On 24/06/2020 10:59, Giuseppe Corbelli wrote:
> Hi all
> I found that under rather common circumstances pylupdate uses the
> wrong context while generating TS files. I did not investigate much
> but I expect trouble since the Qt tr() implementation uses
> QMetaObject::className which is of course different.
> Please see the attached test case and TS output.
> 
> pylupdate5 v5.15.0
> Python 3.5.4
> Linux, if it matters.
> 
> Yes, I know that Qt6 is on its way and pylupdate will be revamped. I
> already found a workaround (do not define nested class) so it's no big
> deal for me right now but maybe it's worth considering.

The problem is the nested class. pylupdate, being based on an ancient 
copy of lupdate, doesn't understand Python indentation. Putting the 
nested class after the method should also work.

Phil


More information about the PyQt mailing list