- add mark in channellist
[enigma2.git] / lib / python / Screens / Menu.py
index c3809318d2111f3215b578660b13dc0bcc494344..503990b6d2dc6620c6e812e0bb7d0b99af0d83ac 100644 (file)
@@ -19,6 +19,8 @@ import xml.dom.minidom
 from xml.dom import EMPTY_NAMESPACE
 from skin import elementsWithTag
 
+from Tools import XMLTools
+
 # some screens
 def doGlobal(screen):
        screen["clock"] = Clock()
@@ -74,13 +76,6 @@ mdom = xml.dom.minidom.parseString(
                </menu>
        </menu>""")
 
-def getText(nodelist):
-       rc = ""
-       for node in nodelist:
-               if node.nodeType == node.TEXT_NODE:
-                       rc = rc + node.data
-       return rc
-
 def getValbyAttr(x, attr):
        for p in range(x.attributes.length):
                a = x.attributes.item(p)
@@ -127,38 +122,9 @@ class configOSD(Screen):
                self["sld_gamma"] = ProgressBar()
                self["sld_gamma"].setValue(50)
 
-
-
-
 class Menu(Screen):
-       #add file load functions for the xml-file
-       #remove old code (i.e. goScan / goClock...)
-
-       def openDialog(self, dialog):
-               self.session.open(dialog)
-
-       def goSetup(self):
-               self.session.open(configTest)
-       
-       def setModeTV(self):
-               print "set Mode to TV"
-               pass
-
-       def setModeRadio(self):
-               print "set Mode to Radio"
-               pass
-
-       def setModeFile(self):
-               print "set Mode to File"
-               pass
-
-       def goScan(self):
-               self.session.open(ServiceScan)
-       
-       def goClock(self):
-               self.session.open(clockDisplay, Clock())
-
        def okbuttonClick(self):
+               print "okbuttonClick"
                selection = self["menu"].getCurrent()
                selection[1]()
 
@@ -178,7 +144,7 @@ class Menu(Screen):
        def addItem(self, destList, node):
                ItemText = getValbyAttr(node, "text")
                if ItemText != "":                                                                                                                                      #check for name
-                       b = getText(node.childNodes)
+                       b = XMLTools.mergeText(node.childNodes)
                        if b != "":                                                                                                                                                             #check for function
                                destList.append((ItemText,boundFunction(self.evalText,b)))
                        else:
@@ -210,3 +176,53 @@ class Menu(Screen):
                        a = getValbyAttr(parent, "text")
                self["title"] = Header(a)
 
+class FixedMenu(Screen):
+       def okbuttonClick(self):
+               selection = self["menu"].getCurrent()
+               selection[1]()
+
+       def __init__(self, session, title, list):
+               Screen.__init__(self, session)
+               
+               self["menu"] = MenuList(list)   
+                                                       
+               self["actions"] = ActionMap(["OkCancelActions"], 
+                       {
+                               "ok": self.okbuttonClick,
+                               "cancel": self.close
+                       })
+               
+               self["title"] = Header(title)
+
+
+class MainMenu(Menu):
+       #add file load functions for the xml-file
+       #remove old code (i.e. goScan / goClock...)
+       
+       def __init__(self, *x):
+               Menu.__init__(self, *x)
+               self.skinName = "Menu"
+
+       def openDialog(self, dialog):
+               self.session.open(dialog)
+
+       def goSetup(self):
+               self.session.open(configTest)
+       
+       def setModeTV(self):
+               print "set Mode to TV"
+               pass
+
+       def setModeRadio(self):
+               print "set Mode to Radio"
+               pass
+
+       def setModeFile(self):
+               print "set Mode to File"
+               pass
+
+       def goScan(self):
+               self.session.open(ServiceScan)
+       
+       def goClock(self):
+               self.session.open(clockDisplay, Clock())