[PyQt] Phonon.AudioOutput is NOT a subclass of Phonon.MediaNode
Jan Holthuis
jan at holmek.de
Sun Nov 30 12:58:52 GMT 2008
Hello!
In Qt4, Phonon's AudioOutput-class inherits QObject and MediaNode:
http://doc.trolltech.com/4.4/phonon-audiooutput.html
In PyKDE4, AudioOutput does NOT inherit MediaNode, as you can easily
find out is you try something like this:
from PyKDE4.phonon import *
audiooutput = Phonon.AudioOutput(Phonon.MusicCategory)
print audiooutput.isValid()
This will throw an "AttributeError: isValid", but AudioOutput should have
inherited the isValid()-method from MediaNode. Because AudioOutput is
not a subclass of MediaNode, It's not possible to do something like this:
m_media = Phonon.MediaObject()
audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
Phonon.createPath(m_media,audioOutput)
The code above doesn't work. There is a "TypeError: argument 2 of
createPath() has an invalid type", because both arguments need to
be a (sub)class of MediaNode. MediaObject is, but AudioOutput isn't.
I'm fairly sure this is a bug and it needs to be fixed, but is there any
way to get around this problem at the moment?
I tried subclassing them:
class AudioOutput2(Phonon.AudioOutput,Phonon.MediaNode):
def __init__(self,category=None,parent=None):
Phonon.AudioOutput.__init__(self,category,parent)
Phonon.MediaNode.__init__(self)
But now i'm getting something like this:
Phonon.createPath(m_media,audioOutput)
SystemError: error return without exception set
Can anyone help me?
Thanks in advance,
Jan Holthuis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081130/04a68c64/attachment.bin
More information about the PyQt
mailing list