[PyKDE] Re: Kcontrol modules

David Boddie david at boddie.org.uk
Wed Jul 9 20:00:01 BST 2003


On Tue, 8 Jul 2003 20:21:21, Simon Edwards <simon at simonzone.com> wrote:

> Anyone here tried doing kcontrol modules in Python+PyKDE?

Not yet.

> After seeing the success of IOSlaves in Python, I would like to be able to
> kcontrol modules (kcm). I've been playing a bit with coding some admin
> progs that really should be integrated with the control center.
>
> I had a look at the IOSlave code and saw that it works quite differently
> than kcms. Kcms are basically shared libraries that have a factory method
> that returns a instances of a subclass of KCModule.

Yes, when I started looking at panel applets I realised what all the fuss
was about!

> What I would like is some opinions on the three ways of doing in kcms in
> Python. (the 3 ways that I can think of ;-) ):
>
> 1) Implement in C/C++ a kcm that takes a python script from somewhere,
> creates a KCModule instance using the script and returns it back to KDE
> Control for running/embedding. This would be a case of C++ calling a
> library which returns a PyKDE/Python object. I don't know if this is
> possible.

I'd try this method. Recent recommendations by Phil to use various sip
functions might turn out to be very useful in this context.

> 2) Implement in C/C++ a kcm and a subclass of KCModule (Pykcm). Pykcm
> embeds the Python interpretter, and takes a python script from somewhere.
> It then delegates its methods out to the corresponding methods in the
> script. This sounds possible, and it probably a good solution (if it works.
> ;-) )

This is a lot of work.

> 3) Implement in C/C++ a kcm that runs an external python script that then
> uses   QXEmbed (see the KDE API docs) to embed itself in the KDE Control
> center. This is quite do-able I think, but there may be some draw backs.

I've no idea whether this would work!

> Any thoughts?

I'm going to pursue option 1 as I think that it'll provide the most flexible
solution, if it works. Don't let me stop anyone else from trying any of the
above methods.

All the best,

David




More information about the PyQt mailing list