[PATCH] Suppress errors in Python AppletScripts

Simon Edwards simon at simonzone.com
Wed Jul 28 23:21:54 CEST 2010


Hello,

On 07/28/2010 12:03 AM, Luca Beltrame wrote:
> 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.

It looks pretty good, just fix up the indentation and make sure you test 
it a bit before you commit. Also wait until after 4.5 is out before you 
commit on the 4.5 branch. Do you know why shape() is called before the 
applet is ready?

cheers,

-- 
Simon Edwards             | KDE-NL, Guidance tools, Guarddog Firewall
simon at simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."


More information about the Plasma-devel mailing list