[PyKDE] Idle thoughts on Python and KWin

Jim Bublitz jbublitz at nwinternet.com
Sun Sep 12 04:40:23 BST 2004


On Saturday 11 September 2004 08:11, Peter Clark wrote:
>  I'm in the middle of writing v.0.2 of the Fahrenheit window decoration for
> KDE, and remembering how much I dislike programming in C++. Even when I
> know how to do something (which is not often), it's no fun. It would be so
> much nicer if it could be done in PyKDE. But I don't know how possible that
> would be, since KWin themes need to be shared object files (as far as I
> know). Has anyone tried this? How would a window decoration written in
> PyKDE interact with KWin? Would the performance costs make it a waste of
> time?

>  As I said, idle thoughts, but it would be interesting if someone had some
> insight into them.

I don't know much about theming, but I'll give it a shot. I assume the .so 
files needed are plugins, and in general terms, it's possible to to write 
plugins in Python. The interfacing that's required to do that varies a lot - 
in some cases it can be done transparently, some cases require C++ code, but 
the C++ is "boilerplate" that could be generated automatically, and there are 
probably cases where you'd have to write app specific C++ code every time. 
I'd guess this would fall somewhere in the middle of that range.

Performance is also a little hard to estimate. GUI apps that I've done in 
PyKDE have satisfactory speed and responsiveness, but almost all of the 
actual pixel-pushing is still done in the C++ layer that PyKDE binds. If you 
did the actual pixel-pushing in Python, it would certainly be slower; if you 
stuck to Qt methods to draw lines, do fill or whatever, it's likely to be in 
between the two previous extremes. 

The only thing I've done that's even close is writing plugins for KSpread, and 
on large spreadsheets I didn't notice any difference in speed doing low level 
calculations in Python. That may or may not be comparable.

Like I said, I haven't looked at this much at all. Does this involve KStyle 
plugins and similar things?

There are a lot of ways to approach this, depending on what the requirements 
and results are. It's possible, for example, to write a layer that still does 
the performance sensitive code in C++ and then wrap that in Python. It might 
be possible to generalize something like that. The biggest problem right now 
is finding someone with the time to work on it.

If you can point me to something like a tutorial or sample code, or write up a 
brief description of what's involved, I can give you a better idea of what 
might be feasible.

Jim





More information about the PyQt mailing list