From 0b2a9a202537c1d1f647129a0457eec419b73ece Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Wed, 13 Aug 2008 18:46:00 +0000 Subject: [PATCH] fix 1st popup --- deluge/plugins/label/label/gtkui/submenu.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/deluge/plugins/label/label/gtkui/submenu.py b/deluge/plugins/label/label/gtkui/submenu.py index 7ebe455e0..9adbd829b 100644 --- a/deluge/plugins/label/label/gtkui/submenu.py +++ b/deluge/plugins/label/label/gtkui/submenu.py @@ -51,16 +51,18 @@ def cb_none(args): class LabelMenu(gtk.MenuItem): def __init__(self): - gtk.MenuItem.__init__(self, "Label") - self.show_all() + gtk.MenuItem.__init__(self, _("Label")) + + self.sub_menu = gtk.Menu() + self.set_submenu(self.sub_menu) #attach.. torrentmenu = component.get("MenuBar").torrentmenu - torrentmenu.connect("show", self.on_show, None) - + self.sub_menu.connect("show", self.on_show, None) aclient.connect_on_new_core(self._on_new_core) - def _on_new_core(self, data): + + def _on_new_core(self, data = None): self.on_show() def get_torrent_ids(self): @@ -73,15 +75,13 @@ class LabelMenu(gtk.MenuItem): aclient.force_call(block=True) def cb_labels(self , labels): - log.debug("cb_labels-start") - self.sub_menu = gtk.Menu() + for child in self.sub_menu.get_children(): + self.sub_menu.remove(child) for label in [NO_LABEL] + labels: - item = gtk.MenuItem(label) + item = gtk.MenuItem(label.replace("_","__")) item.connect("activate", self.on_select_label, label) self.sub_menu.append(item) - self.set_submenu(self.sub_menu) self.show_all() - log.debug("cb_labels-end") def on_select_label(self, widget=None, label_id = None): log.debug("select label:%s,%s" % (label_id ,self.get_torrent_ids()) )