From 0ed166647d7c26acfc62e795c7d4fd7088a381aa Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Mon, 23 Mar 2009 19:20:45 +0000 Subject: [PATCH] do a lazy import of gtk to stop the core trying to import it --- deluge/plugins/execute/execute/gtkui.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/deluge/plugins/execute/execute/gtkui.py b/deluge/plugins/execute/execute/gtkui.py index e6d035764..71c8f8b9e 100644 --- a/deluge/plugins/execute/execute/gtkui.py +++ b/deluge/plugins/execute/execute/gtkui.py @@ -23,7 +23,6 @@ # import os -import gtk import pkg_resources from deluge.log import LOG as log @@ -32,17 +31,24 @@ from deluge.plugins.pluginbase import GtkPluginBase import deluge.component as component import deluge.common +gtk = None + EXECUTE_ID = 0 EXECUTE_EVENT = 1 EXECUTE_COMMAND = 2 EVENT_MAP = { - "complete": _("Torrent Complete") + "complete": _("Torrent Complete"), + "added": _("Torrent Added") } +EVENTS = ["complete", "added"] + class ExecutePreferences(object): def __init__(self, plugin): self.plugin = plugin + global gtk + import gtk def load(self): log.debug("Adding Execute Preferences page") @@ -54,7 +60,9 @@ class ExecutePreferences(object): events = self.glade.get_widget("event_combobox") store = gtk.ListStore(str, str) - store.append((_("Torrent Complete"), "complete")) + for event in EVENTS: + event_label = EVENT_MAP[event] + store.append((event_label, event)) events.set_model(store) self.plugin.add_preferences_page(_("Execute"),