[PyKDE] Qtranslator problems w/ setAccel

stuff at mailzilla.net stuff at mailzilla.net
Wed Jan 7 16:33:01 GMT 2004


I've been having issues using pyQt 3.8 when using the QTranslator class.
After creating a simple mainwindow (using just the defaults from 
the Qt Desginer which include a menu and toolbar) and generating a python 
file, main.py I receive the following error when running it from a test 
script that uses the QTranslator:

Fatal Python error: PyEval_SaveThread: NULL tstate
Aborted


Here is the small test script:

------------------------------

from main import MainWindow
import sys

app = QApplication(sys.argv)

translator = QTranslator(app)

app.installTranslator(translator)

m = MainWindow()

app.setMainWidget(m)
m.show()
app.exec_loop()

----------------------------

Note that this is a simple script that demonstrates the problem (which I
have seen in a larger, more complex application).  Also, note that there
is no need to even invoke translator.load() to produce the problem...  
simply calling app.installTranslator() results in the thread state issue
when the MainWindow class invokes the self.__tr() method from any of it's
setAccel() methods.

I determined that the setAccel method was causing the problem my manually
editing the MainWindow (main.py) class and adding a print statement in the
__tr() method.  Also, if I comment out the setAccel methods things behave
normally.

The problem of course is, the setAccel methods are placed there 
by the designer/pyuic so manually commenting them out really isn't an 
option (not to mention the fact that I want to use the accelerators 
withing my application).

Thanks for any help,

Phil




More information about the PyQt mailing list