37 lines
732 B
Python
37 lines
732 B
Python
# Bryan Schumaker
|
|
|
|
import ocarina
|
|
|
|
gtk = ocarina.gtk
|
|
Menu = gtk.Menu
|
|
MenuItem = gtk.MenuItem
|
|
|
|
lib_items = []
|
|
plist_items = []
|
|
|
|
def add_menu_item(items, text, func):
|
|
items.append( (text, func) )
|
|
items.sort()
|
|
|
|
def add_lib_menu_item(text, func):
|
|
add_menu_item(lib_items, text, func)
|
|
|
|
def add_plist_menu_item(text, func):
|
|
add_menu_item(plist_items, text, func)
|
|
|
|
|
|
def make_menu(items, button, time):
|
|
menu = Menu()
|
|
for (text, func) in items:
|
|
item = MenuItem(text)
|
|
item.connect("activate", func)
|
|
item.show()
|
|
menu.append(item)
|
|
menu.popup(None, None, None, button, time)
|
|
|
|
def make_lib_menu(button, time):
|
|
make_menu(lib_items, button, time)
|
|
|
|
def make_plist_menu(button, time):
|
|
make_menu(plist_items, button, time)
|