# Bryan Schumaker (2 / 26 / 2011) import gtk import libsaria common = [ ("Pause after current song", libsaria.controls.do_pause_after) ] class MenuItem(gtk.MenuItem): def __init__(self, source, text, func): gtk.MenuItem.__init__(self, text) self.source = source if func: self.connect("activate", func) self.show() class Menu(gtk.Menu): def __init__(self, source, items): gtk.Menu.__init__(self) for (text, func) in common: self.append(MenuItem(source, text, func)) self.append(MenuItem(source, None, None)) for (text, func) in items: self.append(MenuItem(source, text, func)) def show(self, event): self.popup(None, None, None, event.button, event.time)