fix 1st popup
This commit is contained in:
parent
fe2b8bf5d4
commit
0b2a9a2025
|
@ -51,16 +51,18 @@ def cb_none(args):
|
||||||
|
|
||||||
class LabelMenu(gtk.MenuItem):
|
class LabelMenu(gtk.MenuItem):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gtk.MenuItem.__init__(self, "Label")
|
gtk.MenuItem.__init__(self, _("Label"))
|
||||||
self.show_all()
|
|
||||||
|
self.sub_menu = gtk.Menu()
|
||||||
|
self.set_submenu(self.sub_menu)
|
||||||
|
|
||||||
#attach..
|
#attach..
|
||||||
torrentmenu = component.get("MenuBar").torrentmenu
|
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)
|
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()
|
self.on_show()
|
||||||
|
|
||||||
def get_torrent_ids(self):
|
def get_torrent_ids(self):
|
||||||
|
@ -73,15 +75,13 @@ class LabelMenu(gtk.MenuItem):
|
||||||
aclient.force_call(block=True)
|
aclient.force_call(block=True)
|
||||||
|
|
||||||
def cb_labels(self , labels):
|
def cb_labels(self , labels):
|
||||||
log.debug("cb_labels-start")
|
for child in self.sub_menu.get_children():
|
||||||
self.sub_menu = gtk.Menu()
|
self.sub_menu.remove(child)
|
||||||
for label in [NO_LABEL] + labels:
|
for label in [NO_LABEL] + labels:
|
||||||
item = gtk.MenuItem(label)
|
item = gtk.MenuItem(label.replace("_","__"))
|
||||||
item.connect("activate", self.on_select_label, label)
|
item.connect("activate", self.on_select_label, label)
|
||||||
self.sub_menu.append(item)
|
self.sub_menu.append(item)
|
||||||
self.set_submenu(self.sub_menu)
|
|
||||||
self.show_all()
|
self.show_all()
|
||||||
log.debug("cb_labels-end")
|
|
||||||
|
|
||||||
def on_select_label(self, widget=None, label_id = None):
|
def on_select_label(self, widget=None, label_id = None):
|
||||||
log.debug("select label:%s,%s" % (label_id ,self.get_torrent_ids()) )
|
log.debug("select label:%s,%s" % (label_id ,self.get_torrent_ids()) )
|
||||||
|
|
Loading…
Reference in New Issue