ocarina/src/extra/guiGTK/menu.py

41 lines
771 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Jan 14, 2010 10:39:29 PM$"
import window
import gtk
class Bar(gtk.MenuBar):
def __init__(self):
gtk.MenuBar.__init__(self)
self.show()
class Item(gtk.MenuItem):
def __init__(self,name, func=None, subs=[]):
gtk.MenuItem.__init__(self, name)
if not func == None:
self.connect("activate", func)
if len(subs) > 0:
menu = gtk.Menu()
for sub in subs:
menu.append(sub)
self.set_submenu(menu)
self.show()
def makeBar():
def pluginWindow(item):
w = window.PluginWindow()
bar = Bar()
plugins = Item("Plugins",pluginWindow)
tools = Item("Tools",None,[plugins])
bar.append(tools)
return bar