126 |
self.InsertItem(newmenu, menu = menu, after = after) |
self.InsertItem(newmenu, menu = menu, after = after) |
127 |
return newmenu |
return newmenu |
128 |
|
|
129 |
|
def FindOrInsertMenu(self, name, title, menu = (), after = None): |
130 |
|
""" |
131 |
|
Find the menu with the specified name. If found, return it. |
132 |
|
Else insert the menu as specified and return it. |
133 |
|
|
134 |
|
Parameters: See InsertMenu(). |
135 |
|
""" |
136 |
|
|
137 |
|
m = self.find_menu(name) |
138 |
|
if m is None: |
139 |
|
m = self.InsertMenu(name, title, menu, after) |
140 |
|
return m |
141 |
|
|
142 |
|
|
143 |
def SetItems(self, items): |
def SetItems(self, items): |
144 |
"""Replace the contents of the menu by items.""" |
"""Replace the contents of the menu by items.""" |
145 |
self.items = items |
self.items = items |