[PyKDE] Qtranslator problems w/ setAccel

Phil Thompson phil at riverbankcomputing.co.uk
Sun Jan 11 13:08:00 GMT 2004


On Wednesday 07 January 2004 6:58 pm, stuff at mailzilla.net wrote:
> To followup on the problem I reported earlier, I've provided the pyuic
> generated main.py module as an attachment.  I've modified the __tr()
> method to print it's arguments.
>
> Output of executing test.py is now this:
>
> $ python test.py
> __tr(MainWindow, None)
> __tr(New, None)
> __tr(&New, None)
> __tr(Ctrl+N, None)
> Fatal Python error: PyEval_SaveThread: NULL tstate
> Aborted
>
>
> The __tr(Ctrl+N, None) line is a result of the setAccel() method in
> the MainWindow class.  Commenting out this line (and all other setAccel
> lines) and things work as they should.  However, with the pyuic generated
> code (where the setAccel() method invokes the __tr() method), the
> application crashes as indicated by the above output.
>
> I've confirmed this behavior on Windows and Linux (Redhat 9.0) using the
>
> PyQt distribution included with BlackAdder.  On my linux box:
> >>> from qt import *
> >>> PYQT_VERSION_STR
>
> '3.8'
>
> >>> QT_VERSION_STR
>
> '3.2.2'
>
>
> Interestingly, if I modify the __tr() method to simply return it's first
> argument (return s) the output is now:
>
> $ python test.py
> __tr(MainWindow, None)
> __tr(New, None)
> __tr(&New, None)
> __tr(Ctrl+N, None)
> Traceback (most recent call last):
>   File "test.py", line 11, in ?
>     m = MainWindow()
>   File "main.py", line 587, in __init__
>     self.languageChange()
>   File "main.py", line 613, in languageChange
>     self.fileNewAction.setAccel(self.__tr("Ctrl+N"))
> TypeError: Argument 1 of QAction.setAccel() has an invalid type
>
> I would appreciate it if someone could run the test.py script to see if it
> works on their version of PyQt/Qt.  Perhaps this problem has been fixed in
> a more recent version of either package (I did glance at the change log
> for PyQt but did not see anything pertinent).

With current snapshots (PyQt, SIP v3.x, SIP v4.x) there isn't a problem.

My guess is the bug is the one with the following entry in the PyQt ChangeLog:

2003/12/21 16:07:00  phil
Fixed a bug when automatically converting to a QKeySequence.

Phil




More information about the PyQt mailing list