+
+class MenuUpdater:
+ def __init__(self):
+ self.updatedMenuItems = {}
+
+ def addMenuItem(self, id, pos, text, module, screen):
+ if not self.updatedMenuAvailable(id):
+ self.updatedMenuItems[id] = []
+ self.updatedMenuItems[id].append([text, pos, module, screen])
+
+ def delMenuItem(self, id, pos, text, module, screen):
+ self.updatedMenuItems[id].remove([text, pos, module, screen])
+
+ def updatedMenuAvailable(self, id):
+ return self.updatedMenuItems.has_key(id)
+
+ def getUpdatedMenu(self, id):
+ return self.updatedMenuItems[id]
+
+menuupdater = MenuUpdater()
+
+class MenuSummary(Screen):
+ skin = """
+ <screen position="0,0" size="132,64">
+ <widget name="MenuTitle" position="0,4" size="132,21" font="Regular;18" />
+ <widget name="MenuEntry" position="0,25" size="132,21" font="Regular;16" />
+ <widget name="Clock" position="50,46" size="82,18" font="Regular;16" />
+ </screen>"""
+
+ def __init__(self, session, parent):
+ Screen.__init__(self, session)
+ self["MenuTitle"] = Label(parent.menu_title)
+ self["MenuEntry"] = Label("")
+ self["Clock"] = Clock()
+ self.parent = parent
+ self.onShow.append(self.addWatcher)
+ self.onHide.append(self.removeWatcher)
+
+ def addWatcher(self):
+ self.parent["menu"].onSelectionChanged.append(self.selectionChanged)
+ self.selectionChanged()
+
+ def removeWatcher(self):
+ self.parent["menu"].onSelectionChanged.remove(self.selectionChanged)
+
+ def selectionChanged(self):
+ self["MenuEntry"].setText(self.parent["menu"].getCurrent()[0])