[PyKDE] KDE Panel Applets in Python
Jim Bublitz
jbublitz at nwinternet.com
Thu Apr 10 20:04:00 BST 2003
On 10-Apr-03 POYEN OP Olivier (DCL) wrote:
> Of course, I'd be interested. I can even try to help you, but my
> C++ skills may not be want you really need !
>
> Anyway, to sum up what you propose with my own word:
> to create an applet, you code some stuff (ie the applet) in
> python, then, through somme kind of wizard, create a DSO file
> that Kicker can read and understand.
> Drawback:
> -no more interactive testing (but one could think of some way to
> communicate throught dcop interface)
The .so file is completely independent of the Python script and
should work every time (famous last words), but it may be difficult
or impossible to run the script under a debugger or even use print
stmts for debugging, but you could dump output to a file instead of
printing (and tail the file).
> -10 Mb per panel applet at least.
>
> Good point:
> - this may work
> - just a wizard, and no configure/make/make install
>
> Seems quit good to me !
> BTW, I can't figure out why one could not, as you mention in an
> other post, create an embed python interpreter in an applet, that
> could wrap things up. The DSO created by your wizard would then
> be interpreted by your interpreter applet , through some rules
> (get the init method from the Python-DSO librairy), and would
> work, of course !
> But, since I know almost nothing about Kicker, I say some
> non-sense.
What kicker does is call
init (parent, configFile)
'parent' doesn't contain any useful info (for loading). 'configFile'
contains the applet name (eg 'khelloworldapplet plus some garbage
plus '_rc' for one of the example applets), but it forms the value
of configFile from the lib name. If you name the lib
"libXXXapplet.so" in the .desktop file, configFile ==
XXXappletzzzzz_rc, even if the desktop file is "YYYapplet". The
only possibility is if there's a way to specify an arbitrary name
for the config file in the .desktop file, but I didn't find one.
The way it looks, every applet needs a distinct lib name.
There is one other possibility - create a single lib that puts
"Python applet" in the Add | Applet menu. In the factory function
for that lib (init) popup another menu that lists the available
Python applets (ie - put the Python applets in
share/apps/kicker/applets with the rest of the desktop files, then
have the Python applet loader scan there for *.py files. Seems like
that should work - I haven't given it much thought though.
I'm not promising quick delivery (there's quite a bit of C++
involved), but this is kind of interesting and like I said -
related to some other stuff I want to do. I'll try to get to it.
Jim
More information about the PyQt
mailing list