def add(self, items):
        '''add a submenu'''
        if not isinstance(items, list):
            items = [items]
        for m in items:
            updated = False
            for i in range(len(self.items)):
                if self.items[i].name == m.name:
                    self.items[i] = m
                    updated = True
            if not updated:
                self.items.append(m)
def add ( self , items ) : if not isinstance ( items , list ) : items = [ items ] for m in items : updated = False for i in range ( len ( self . items ) ) : if self . items [ i ] . name == m . name : self . items [ i ] = m updated = True if not updated : self . items . append ( m )
add a submenu