fix
[enigma2.git] / lib / python / Screens / Menu.py
index bba3628239c381f5f64c6bfe539533e8950ed549..f1a013483dba6ff255686caaed3f5f82ac0cedb1 100644 (file)
@@ -6,6 +6,7 @@ from Components.Button import Button
 from Components.Label import Label
 from Components.ProgressBar import ProgressBar
 from Components.config import configfile
+from Components.Clock import Clock
 
 from Tools.Directories import resolveFilename, SCOPE_SKIN
 
@@ -73,7 +74,34 @@ class MenuUpdater:
                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])
+
 class Menu(Screen):
        def okbuttonClick(self):
                print "okbuttonClick"
@@ -82,7 +110,7 @@ class Menu(Screen):
 
        def execText(self, text):
                exec text
-               
+
        def runScreen(self, arg):
                # arg[0] is the module (as string)
                # arg[1] is Screen inside this module 
@@ -197,6 +225,7 @@ class Menu(Screen):
                if a == "":                                                                                                             #if empty use name
                        a = _(getValbyAttr(parent, "text"))
                self["title"] = Header(a)
+               self.menu_title = a
 
        def closeNonRecursive(self):
                self.close(False)
@@ -204,6 +233,9 @@ class Menu(Screen):
        def closeRecursive(self):
                self.close(True)
 
+       def createSummary(self):
+               return MenuSummary
+
 class MainMenu(Menu):
        #add file load functions for the xml-file