Add URI display, remove attrib print.
[dom-editor.git] / Dome / Menu.py
blob28b5813145127e5e88b1ad21b245dae235f3442a
1 from gtk import *
3 class Menu:
4 def __init__(self, items):
5 "'items' is a list of (label, callback) tuples."
6 "If callback is None then the item is shaded."
8 menu = GtkMenu()
10 for (label, callback) in items:
11 item = GtkMenuItem(label)
12 if callback:
13 item.connect('activate', lambda widget, cb = callback: cb())
14 else:
15 item.set_sensitive(FALSE)
16 menu.append(item)
17 item.show_all()
19 self.menu = menu
21 def popup(self, button, time):
22 self.menu.popup(None, None, None, button, time)