[PyQt] Goods news about the "menu text missing in PyKDE apps with Oxygen" bug

Simon Edwards simon at simonzone.com
Thu Apr 10 20:14:50 BST 2008


Hello all,

Some people here might have crossed paths with the "menu text missing in 
PyKDE apps with Oxygen" bug. Basically menu labels are not rendered when 
a PyKDE4 application is used with the Oxygen widget style. After quite a 
lot of hair-pulling work over the last few days I've figured out what 
the problem is.

First, a solution. Put the following lines in your PyKDE4/__init__.py 
file in your Python installation's site-packages directory. (typically 
/lib/python2.5/site-packages/PyKDE4/__init__.py).

   import sys, dl
   sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)

I'm sure what the 'official' solution is going to be, but Jim and I will 
work it out. This _might_ fix the problems some people have been having 
with KConfig and friends. Let me + Jim know if that is the case.

Phil: Does this problem affect PyQt4? I don't know if they use 
dynamic_cast much.

For those who are interested in the gory details, the problem is 
described here:

   http://gcc.gnu.org/faq.html#dso

A dynamic_cast was failing in Oxygen in the menu drawing code, and a 
default value was being used instead (an empty string). The thing is 
that Python dlopens()s kdeui instead of just being linked to it like a 
normal C++ program. This breaks dynamic_cast between kdeui.so and 
oxygen.so. I've tested this out with test code here, and the problem 
fits this analysis exactly.

A workaround in Python:

   http://mail.python.org/pipermail/c++-sig/2005-April/008829.html


cheers,

-- 
Simon Edwards             | KDE-NL, Guidance tools, Guarddog Firewall
simon at simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."


More information about the PyQt mailing list