[PATCH] Suppress errors in Python AppletScripts

Luca Beltrame einar at heavensinferno.net
Wed Jul 28 00:03:19 CEST 2010


(CCing Simon Edwards as well to get his input)

Hello,

while making a Python
plasmoid today, I noticed that the logs spammed Python exceptions to the
console once the plasmoid got deleted:

AttributeError: 'PythonAppletScript'
object has no attribute 'pluginName'

and also other errors when hovering
over the plasmoid when using plasmoidviewer:

TypeError: invalid result type
from PythonAppletScript.shape()

The attached patch fixes this in
pyappletscript.py, by making shape() return an empty QPainterPath if the
applet is not initialized (removes second error) and by putting a check in
__dtor__ for the applet initialization (fixes first error).

As they're
mostly cosmetic things I'd like to commit them to trunk and 4.5. I haven't
noticed any weird behavior when using them. 

 Let me know if it's OK.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma_no_python_exceptions.patch
Type: text/x-patch
Size: 771 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20100728/9baf7212/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20100728/9baf7212/attachment.sig 


More information about the Plasma-devel mailing list