@chaley - thx for the info and that makes sense, but why would __init__() be being called more than once on a GUI plugin? Surely only one instance of the Reading List plugin is ever being created?
What happens with this plugin is that the configuration widget subscribes to some signals from the plugin action, which it uses to updates its grid to shwo device status, in case a user plugs in a device while they have the config screen open. It looks to me like those signals are not being disconnected in PeterT's case (I can't replicate the error myself).
At the moment I disconnect those signals in an __exit__() function on my config widget, but that must be the wrong place for PeterT. The problem is that there are no guaranteed callbacks to my widget from calibre's do_user_config code() if the user does not click on "ok" so that save_settings gets called. So where should I put my signal disconnections?
I am guessing that the Qt object the config widget uses is being garbage collected before the Python ConfigWidget is, so my __exit__ has not yet been called or something. However since from a config widget you have no hooks to the parent dialog I can't think of a way out of this that doesn't involve calibre looking for an optional functional name on the config widget to call as a "cleanup" that I could disconnect in that gets invoked when the config dialog is closed?
Last edited by kiwidude; 07-30-2012 at 03:53 AM.
|