[PyQt] Need help using QWebPluginFactory

Phil Thompson phil at riverbankcomputing.com
Mon Feb 20 14:49:42 GMT 2012


On Mon, 20 Feb 2012 15:37:36 +0100, Detlev Offenbach
<detlev at die-offenbachs.de> wrote:
> Hello,
> 
> I am having a bit of trouble using QWebPluginFactory.Plugin. I want to
> attach 
> a MimeType object to it's mimeTypes list, but the list stays empty (s.
> below). 
> What am I doing wrong?
> 
> Python 3.2.2 (default, Oct 23 2011, 17:46:58) [GCC] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from PyQt4.QtWebKit import QWebPluginFactory
>>>> p=QWebPluginFactory.Plugin()
>>>> p
> <PyQt4.QtWebKit.Plugin object at 0xa2bd00>
>>>> p.mimeTypes
> []
>>>> mt=QWebPluginFactory.MimeType
>>>> p.mimeTypes.append(mt)
>>>> p.mimeTypes
> []
>>>>

PyQt (actually SIP) only supports the binding of attributes so you have to
do something like...

mime_types = p.mimeTypes
mime_types.append(mt)
p.mimeTypes = mime_types

Phil


More information about the PyQt mailing list