2 from Components.MenuList import MenuList
3 from Components.ActionMap import ActionMap
4 from Components.Header import Header
6 # hack ... must be made dynamic
7 from ServiceScan import ServiceScan
8 from ScartLoopThrough import ScartLoopThrough
9 from Components.Button import Button
10 from Components.Label import Label
11 from Components.ProgressBar import ProgressBar
12 from ConfigMenu import *
14 from TimerEdit import *
16 from enigma import quitMainloop
18 import xml.dom.minidom
19 from xml.dom import EMPTY_NAMESPACE
20 from skin import elementsWithTag
24 screen["clock"] = Clock()
27 mdom = xml.dom.minidom.parseString(
29 <menu text="Mainmenu" title="the real Mainmenu">
30 <item text="Standby debug">quitMainloop()</item>
31 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
33 <item text="TV-Mode">self.setModeTV()</item>
34 <item text="Radio-Mode">self.setModeRadio()</item>
35 <item text="File-Mode">self.setModeFile()</item>
36 <item text="Scart">self.openDialog(ScartLoopThrough)</item>
37 <item text="Timer">self.openDialog(TimerEditList)</item>
39 <menu text="Service Organising">
40 <item text="New Bouquets"></item>
41 <item text="Add to Bouquets"></item>
42 <item text="Edit Bouquets"></item>
44 <menu text="Service Searching">
45 <item text="Satelliteconfig"></item>
46 <item text="Satfinder"></item>
47 <item text="Rotor Control"></item>
48 <item text="Edit Transponder"></item>
49 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
50 <item text="Automatic 'Multisat' Scan"></item>
51 <item text="Manual Scan"></item>
54 <item text="Time Date"></item>
55 <item text="Video Audio"></item>
56 <item text="UHF Modulator"></item>
57 <item text="Harddisk"></item>
58 <item text="Keyboard"></item>
59 <item text="OSD">self.openDialog(configOSD)</item>
60 <item text="Language"></item>
61 <item text="LCD"></item>
63 <item text="Common Interface"></item>
64 <item text="Parental Control"></item>
65 <item text="Expert"></item>
67 <item text="Games"></item>
68 <item text="Information"></item>
70 <item text="PowerOff"></item>
71 <item text="Restart"></item>
72 <item text="Standby"></item>
73 <item text="Sleep Timer">self.goSetup()</item>
77 def getText(nodelist):
80 if node.nodeType == node.TEXT_NODE:
84 def getValbyAttr(x, attr):
85 for p in range(x.attributes.length):
86 a = x.attributes.item(p)
95 def __init__(self, fnc, *args):
101 class configOSD(Screen):
102 #this needs focus handling - so not useable
104 def okbuttonClick(self):
107 def __init__(self, session):
108 Screen.__init__(self, session)
110 self["actions"] = ActionMap(["OkCancelActions"],
112 "ok": self.okbuttonClick,
116 self["okbutton"] = Button("Save")
118 self["txt_alpha"] = Label("Alpha:")
119 self["sld_alpha"] = ProgressBar()
120 self["sld_alpha"].setValue(50)
122 self["txt_brightness"] = Label("Brightness:")
123 self["sld_brightness"] = ProgressBar()
124 self["sld_brightness"].setValue(50)
126 self["txt_gamma"] = Label("Contrast:")
127 self["sld_gamma"] = ProgressBar()
128 self["sld_gamma"].setValue(50)
134 #add file load functions for the xml-file
135 #remove old code (i.e. goScan / goClock...)
137 def openDialog(self, dialog):
138 self.session.open(dialog)
141 self.session.open(configTest)
144 print "set Mode to TV"
147 def setModeRadio(self):
148 print "set Mode to Radio"
151 def setModeFile(self):
152 print "set Mode to File"
156 self.session.open(ServiceScan)
159 self.session.open(clockDisplay, Clock())
161 def okbuttonClick(self):
162 selection = self["menu"].getCurrent()
165 def evalText(self, text):
168 def nothing(self): #dummy
171 def addMenu(self, destList, node):
172 MenuTitle = getValbyAttr(node, "text")
173 if MenuTitle != "": #check for title
174 a = boundFunction(self.session.open, Menu, node, node.childNodes)
175 #TODO add check if !empty(node.childNodes)
176 destList.append((MenuTitle, a))
178 def addItem(self, destList, node):
179 ItemText = getValbyAttr(node, "text")
180 if ItemText != "": #check for name
181 b = getText(node.childNodes)
182 if b != "": #check for function
183 destList.append((ItemText,boundFunction(self.evalText,b)))
185 destList.append((ItemText,self.nothing)) #use dummy as function
187 def __init__(self, session, parent, childNode):
188 Screen.__init__(self, session)
192 for x in childNode: #walk through the actual nodelist
193 if x.nodeType != xml.dom.minidom.Element.nodeType:
195 elif x.tagName == 'item':
196 self.addItem(list, x)
197 elif x.tagName == 'menu':
198 self.addMenu(list, x)
200 self["menu"] = MenuList(list)
202 self["actions"] = ActionMap(["OkCancelActions"],
204 "ok": self.okbuttonClick,
208 a = getValbyAttr(parent, "title")
209 if a == "": #if empty use name
210 a = getValbyAttr(parent, "text")
211 self["title"] = Header(a)