Python and KDE

D

Dylan Parry

Hi,

I've got a couple of question regarding Python integration with KDE in
Linux.

I was wondering if it is possible, through some module, to check
whether the screensaver is running in KDE? The reason being that I have
some Python applications that I have running all of the time while I am
logged in to KDE, but as they provide purely eye candy I would like to
make it so they basically do nothing while the screensaver is running,
thus reducing the processor overhead and saving a minute amount of power!

I would also like to be able to play a wav file, or similar, given a
certain condition in an IF statement. Is it possible to play sounds using
Python? If so, how would I go about it?

Thank for your help folks,
 
D

Dan Sommers

I was wondering if it is possible, through some module, to check
whether the screensaver is running in KDE? The reason being that I
have some Python applications that I have running all of the time
while I am logged in to KDE, but as they provide purely eye candy I
would like to make it so they basically do nothing while the
screensaver is running, thus reducing the processor overhead and
saving a minute amount of power!
I would also like to be able to play a wav file, or similar, given a
certain condition in an IF statement. Is it possible to play sounds
using Python? If so, how would I go about it?

Do you know about PyKDE? (I don't know too much about it, except that
it exists, and you didn't mention it.) You may have good/better luck
with its mailing list, too:

<http://mats.imk.fraunhofer.de/mailman/listinfo/pykde>

Regards,
Dan
 
D

Dylan Parry

Dan said:
Do you know about PyKDE? (I don't know too much about it, except that
it exists, and you didn't mention it.)

Oh, I had heard of it, but I thought it was just for creating KDE widgets
using Python. After reading the homepage it seems to do a lot more... it
looks blinking complicated too, so maybe I'll take a little while to mull
it over :D
 
B

Bill Dandreta

Hi Dylan,
whether the screensaver is running in KDE? <<

This system command will give the PID number if the screensaver is
running and no output if it is not:

ps -e | grep xscreensaver
about it? <<

Quick and dirty solution install madplay (command-line MPEG decoder and
player) which can play wav files as well as other file formats). Then
run this system command:

madplay mysound.wav

Bill
 
D

Dylan Parry

Bill said:
Quick and dirty solution

Cheers. I like quick and dirty solutions :) Since it's only for my own
personal use, I think going with the quick and dirty would be the best
option. Thanks again ;)
 
J

Jim

Dylan said:
Dan Sommers wrote:
Oh, I had heard of it, but I thought it was just for creating KDE widgets
using Python. After reading the homepage it seems to do a lot more... it
looks blinking complicated too, so maybe I'll take a little while to mull
it over :D

Ahem ...

PyKDE (and PyQt - both at http://riverbankcomputing.co.uk) can be used to
create anything from simple to very complex applications. The basic
framework for starting an app is a little non-obvious if you've never done
C++ coding with Qt or KDE, but there are several program templates provided
with PyKDE to make it easy to get started. Boudewijn Rempt's PyQt text is
also available online, which will give you an intro to programming with
both PyQt and PyKDE: http://www.opendocspublishing.com/pyqt/

PyKDE was recently enhanced to make DCOP communication between programs
really easy to accomplish. Support for panel applets has been withdrawn
from PyKDE but will be appearing in the future in a separate set of
extensions, which will also include support for authoring KParts in Python,
IOSlaves, Control Center modules and other related stuff.

PyKDE is now also included in the KDE kdebindings package and is available
in KDE CVS (although KDE CVS lags the riverbank version by a little).
Indications are that that will allow PyKDE to appear in most major
distributions in the near future (PyQt and sip already do).

Having said all that, the "quick and dirty" suggestions up-thread are
probably a better way to solve the problem you originally posed.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,208
Latest member
RandallLay

Latest Threads

Top