[PyQt] Extending qtproxies for KDE widgets

Luca Beltrame einar at heavensinferno.net
Wed Jul 13 15:29:11 BST 2011


I'm currently mentoring a season of KDE student to improve KDE's UI compiler 
(pykdeuic4). Currently pykdeuic4[1] monkey patches a compile filter into 
PyQt's UI compiler and overrides some of qtproxies's string functions to 
replace tr() calls with KDE's i18n() functions. 

This approach has been shown to be fragile, because pykdeuic4 breaks the 
moment PyQt changes, and being a monkey patch, the solution sometimes breaks 
with specific widgets, that get the wrong parameters assigned when being 
compiled. Also, run-time compilation as with PyQt's uic.loadUi() is not 

The plan I and my student came forward to was to create an extension of KDE's 
widgets in the same manner PyQt does, by creating a "kdeproxies" module which 
could be used to override PyQt with KDE widgets. To this aim, we're interested 
in some more information on qtproxies usage in PyQt, and more importantly in 
how it is used to generate Python objects out of ui files.

A partial alternative solution, at least for translated strings,  would be to 
allow, like the C++ ui compiler, the possibility to override tr() and use 
kdecore.i18n() from PyKDE4 when compiling widgets (since also Qt widgets use 
i18n() when in a KDE application). 

If all else fails, extensions could be written as a plugin of uic: however at 
the time I am not sure it is possible to allow uic to handle other types of 

Any suggestions on the topic are appreciated. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110713/350796e9/attachment.pgp>

More information about the PyQt mailing list