[PyKDE] PyQt4 and designer plugins

Jim Bublitz jbublitz at nwinternet.com
Fri Dec 23 06:29:32 GMT 2005

On Thursday 22 December 2005 16:04, Andreas Pakulat wrote:
> Hi,
> just started with a mainwindows-example to get a feel for PyQt(4)
> programming. I first wanted to "start at the beginning", i.e. porting
> the designer examples. But then I came across the problem: Those are
> normally shared libs... So I guess as long as there's no PyQt-based
> designer there is no possibility to have custom widget plugins written
> in PyQt? Or am I totally wrong on that, if so: Is there some docs about
> how I could port those?

It's possible to write either a .so lib that all custom widgets can use or at 
least a template customized by changing a few #defines that will work for 
each widget. KPanelApplets and KPanelExtensions can use the former with 
kicker, everything else in KDE requires the latter method - what determines 
which method to use is how the calling application (Qt Designer in this case) 
loads the plugin. I'd expect the latter case for Qt Designer. In either case, 
the .so lib has to be written in C++.

Someone or some group of people had a Qt3 Designer interface working to some 
extent a few years ago. The problem, IIRC, was in the preview function, 
because of the way the Python interpreter was  invoked in two separate ways 
(sorry, but I'm not real clear on it, and it was a little complicated). Since 
that time, sip enhancements should make it easier.

Simon Edwards' KDE control module stuff could be used as a starting point 
(don't recall the name or location of the package offhand, but someone can 
supply it). I have some stuff that works for applets and extensions for 
kicker and is supposed to work for control modules, but doesn't - if someone 
wants to look at that I can make it available.

This does require a small amount of C/C++ coding, but it's entirely feasible 
(and fairly simple) to write a standard build process so that the .so lib 
required is generated automatically and Python programmers don't have to use 
C++ once that's been set up.

I can post some more details/code if someone is interested.


More information about the PyQt mailing list