42 |
def item_index(self, item): |
def item_index(self, item): |
43 |
"""Return the index of item in the menu. |
"""Return the index of item in the menu. |
44 |
|
|
45 |
The item parameter may be the name of a non-menu entry or the |
item -- may be the name of a non-menu entry or the |
46 |
name of a menu or a menu itself. |
name of a menu or a menu itself. |
47 |
|
|
48 |
Return None it item is not found. |
Return None it item is not found. |
49 |
""" |
""" |
129 |
def SetItems(self, items): |
def SetItems(self, items): |
130 |
"""Replace the contents of the menu by items.""" |
"""Replace the contents of the menu by items.""" |
131 |
self.items = items |
self.items = items |
132 |
|
|
133 |
|
def RemoveItem(self, item): |
134 |
|
"""Remove an item from the menu. |
135 |
|
|
136 |
|
item -- the (internal) name of the item. |
137 |
|
""" |
138 |
|
i = self.item_index(item) |
139 |
|
if i is not None: |
140 |
|
self.items.pop(i) |