Example #1
0
 def change_item(self, old, new):
     """
     Replace the item 'old' with the 'new'.
     """
     ItemList.change_item(self, old, new)
     old.menu = None
     new.menu = weakref(self)
Example #2
0
 def change_item(self, old, new):
     """
     Replace the item 'old' with the 'new'.
     """
     ItemList.change_item(self, old, new)
     old.menu = None
     new.menu = weakref(self)
Example #3
0
 def set_items(self, items, refresh=True):
     """
     Set/replace the items in this menu. If refresh is True, the menu
     stack will be refreshed and redrawn.
     """
     # delete ref to menu for old choices
     for c in self.choices:
         c.menu = None
     # set new choices and selection
     ItemList.set_items(self, items)
     # set menu (self) pointer to the items
     sref = weakref(self)
     for c in self.choices:
         c.menu = sref
     if refresh and self.stack:
         self.stack.refresh()
Example #4
0
 def set_items(self, items, refresh=True):
     """
     Set/replace the items in this menu. If refresh is True, the menu
     stack will be refreshed and redrawn.
     """
     # delete ref to menu for old choices
     for c in self.choices:
         c.menu = None
     # set new choices and selection
     ItemList.set_items(self, items)
     # set menu (self) pointer to the items
     sref = weakref(self)
     for c in self.choices:
         c.menu = sref
     if refresh and self.stack:
         self.stack.refresh()
Example #5
0
 def __init__(self, heading, choices=None, reload_func=None, type=None):
     ItemList.__init__(self, choices)
     self.heading = heading
     self.stack = None
     # unique id of the menu object
     Menu.next_id += 1
     self.id = Menu.next_id
     # position in the menu stack
     self.pos = -1
     # special items for the new skin to use in the view or info
     # area. If None, menu.selected will be taken
     self.infoitem = None
     # Called when a child menu returns. This function returns a new menu
     # or None and the old menu will be reused
     self.reload_func = reload_func
     self.type = type
     # Autoselect menu if it has only one item
     self.autoselect = False
     # how many rows and cols does the menu has
     # (will be changed by the skin code)
     self.cols = 1
     self.rows = 1
Example #6
0
 def __init__(self, heading, choices=None, reload_func = None, type = None):
     ItemList.__init__(self, choices)
     self.heading = heading
     self.stack   = None
     # unique id of the menu object
     Menu.next_id += 1
     self.id = Menu.next_id
     # position in the menu stack
     self.pos = -1
     # special items for the new skin to use in the view or info
     # area. If None, menu.selected will be taken
     self.infoitem = None
     # Called when a child menu returns. This function returns a new menu
     # or None and the old menu will be reused
     self.reload_func = reload_func
     self.type = type
     # Autoselect menu if it has only one item
     self.autoselect = False
     # how many rows and cols does the menu has
     # (will be changed by the skin code)
     self.cols = 1
     self.rows = 1