def setUp(self): self.my_t1 = MyToggleItem('Toggle 1', 't1') self.my_t2 = MyToggleItem('Toggle 2', 't2') self.menu = Menu('main', [ SubMenu('File', [ Action('Save', 'save', '<Ctrl>S', g.STOCK_SAVE), Action('Parent', 'up', '', g.STOCK_GO_UP), Action('Close', 'close', '', g.STOCK_CLOSE), Separator(), Action('New', 'new', '', g.STOCK_NEW) ]), Action('Help', 'help', 'F1', g.STOCK_HELP), self.my_t1, self.my_t2, ])
def set_menu(self, attach=None, full=None): if attach is not None: self.attach = attach if full is not None: self.full = full menuList = [] menuName = 'actions' menuList.extend(self.additions['topActions']) menuList.extend( actionsMenu ) menuList.extend(self.additions['bottomActions']) if self.full: menuName = 'main' menuList.append( SEPARATOR ) menuList.extend(self.additions['topMain']) menuList.extend( mainMenu ) menuList.extend(self.additions['bottomMain']) self.menu = Menu(menuName, menuList) if attach: self.menu.attach(self, self)