From dd3aab1cefa709b0c26284aa88ac7332c33b45d3 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 27 Feb 2012 12:06:24 +0000 Subject: [PATCH] Catch glade object issue when re-enabling Autoadd Found an additional glade object from the previous instance of Autoadd calling cb_get_config resulting in an exceptions.AttributeError. This workaround simply checks that get_widget is not None. --- deluge/plugins/autoadd/autoadd/gtkui.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deluge/plugins/autoadd/autoadd/gtkui.py b/deluge/plugins/autoadd/autoadd/gtkui.py index 7b069f3cd..77dffd1fb 100644 --- a/deluge/plugins/autoadd/autoadd/gtkui.py +++ b/deluge/plugins/autoadd/autoadd/gtkui.py @@ -256,7 +256,6 @@ class GtkUI(GtkPluginBase): component.get("Preferences").add_page("AutoAdd", self.glade.get_widget("prefs_box")) self.on_show_prefs() - def disable(self): component.get("Preferences").remove_page("AutoAdd") component.get("PluginManager").deregister_hook("on_apply_prefs", self.on_apply_prefs) @@ -341,7 +340,8 @@ class GtkUI(GtkPluginBase): self.store.clear() for watchdir_id, watchdir in self.watchdirs.iteritems(): self.store.append([watchdir_id, watchdir['enabled'], watchdir['path']]) - # Disable the remove and edit buttons, because nothing in the store is selected - self.glade.get_widget('remove_button').set_sensitive(False) - self.glade.get_widget('edit_button').set_sensitive(False) - + # Workaround for cached glade signal appearing when re-enabling plugin in same session + if self.glade.get_widget('edit_button'): + # Disable the remove and edit buttons, because nothing in the store is selected + self.glade.get_widget('edit_button').set_sensitive(False) + self.glade.get_widget('remove_button').set_sensitive(False)