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 enigma import quitMainloop
16 import xml.dom.minidom
17 from xml.dom import EMPTY_NAMESPACE
18 from skin import elementsWithTag
22 screen["clock"] = Clock()
25 mdom = xml.dom.minidom.parseString(
27 <menu text="Mainmenu" title="the real Mainmenu">
28 <item text="Standby debug">quitMainloop()</item>
29 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
31 <item text="TV-Mode">self.setModeTV()</item>
32 <item text="Radio-Mode">self.setModeRadio()</item>
33 <item text="File-Mode">self.setModeFile()</item>
34 <item text="Scart">self.openDialog(ScartLoopThrough)</item>
35 <item text="Timer"></item>
37 <menu text="Service Organising">
38 <item text="New Bouquets"></item>
39 <item text="Add to Bouquets"></item>
40 <item text="Edit Bouquets"></item>
42 <menu text="Service Searching">
43 <item text="Satelliteconfig"></item>
44 <item text="Satfinder"></item>
45 <item text="Rotor Control"></item>
46 <item text="Edit Transponder"></item>
47 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
48 <item text="Automatic 'Multisat' Scan"></item>
49 <item text="Manual Scan"></item>
52 <item text="Time Date"></item>
53 <item text="Video Audio"></item>
54 <item text="UHF Modulator"></item>
55 <item text="Harddisk"></item>
56 <item text="Keyboard"></item>
57 <item text="OSD">self.openDialog(configOSD)</item>
58 <item text="Language"></item>
59 <item text="LCD"></item>
61 <item text="Common Interface"></item>
62 <item text="Parental Control"></item>
63 <item text="Expert"></item>
65 <item text="Games"></item>
66 <item text="Information"></item>
68 <item text="PowerOff"></item>
69 <item text="Restart"></item>
70 <item text="Standby"></item>
71 <item text="Sleep Timer">self.goSetup()</item>
75 def getText(nodelist):
78 if node.nodeType == node.TEXT_NODE:
82 def getValbyAttr(x, attr):
83 for p in range(x.attributes.length):
84 a = x.attributes.item(p)
93 def __init__(self, fnc, *args):
99 class configOSD(Screen):
100 #this needs focus handling - so not useable
102 def okbuttonClick(self):
105 def __init__(self, session):
106 Screen.__init__(self, session)
108 self["actions"] = ActionMap(["OkCancelActions"],
110 "ok": self.okbuttonClick,
114 self["okbutton"] = Button("Save")
116 self["txt_alpha"] = Label("Alpha:")
117 self["sld_alpha"] = ProgressBar()
118 self["sld_alpha"].setValue(50)
120 self["txt_brightness"] = Label("Brightness:")
121 self["sld_brightness"] = ProgressBar()
122 self["sld_brightness"].setValue(50)
124 self["txt_gamma"] = Label("Contrast:")
125 self["sld_gamma"] = ProgressBar()
126 self["sld_gamma"].setValue(50)
132 #add file load functions for the xml-file
133 #remove old code (i.e. goScan / goClock...)
135 def openDialog(self, dialog):
136 self.session.open(dialog)
139 self.session.open(configTest)
142 print "set Mode to TV"
145 def setModeRadio(self):
146 print "set Mode to Radio"
149 def setModeFile(self):
150 print "set Mode to File"
154 self.session.open(ServiceScan)
157 self.session.open(clockDisplay, Clock())
159 def okbuttonClick(self):
160 selection = self["menu"].getCurrent()
163 def evalText(self, text):
166 def nothing(self): #dummy
169 def addMenu(self, destList, node):
170 MenuTitle = getValbyAttr(node, "text")
171 if MenuTitle != "": #check for title
172 a = boundFunction(self.session.open, Menu, node, node.childNodes)
173 #TODO add check if !empty(node.childNodes)
174 destList.append((MenuTitle, a))
176 def addItem(self, destList, node):
177 ItemText = getValbyAttr(node, "text")
178 if ItemText != "": #check for name
179 b = getText(node.childNodes)
180 if b != "": #check for function
181 destList.append((ItemText,boundFunction(self.evalText,b)))
183 destList.append((ItemText,self.nothing)) #use dummy as function
185 def __init__(self, session, parent, childNode):
186 Screen.__init__(self, session)
190 for x in childNode: #walk through the actual nodelist
191 if x.nodeType != xml.dom.minidom.Element.nodeType:
193 elif x.tagName == 'item':
194 self.addItem(list, x)
195 elif x.tagName == 'menu':
196 self.addMenu(list, x)
198 self["menu"] = MenuList(list)
200 self["actions"] = ActionMap(["OkCancelActions"],
202 "ok": self.okbuttonClick,
206 a = getValbyAttr(parent, "title")
207 if a == "": #if empty use name
208 a = getValbyAttr(parent, "text")
209 self["title"] = Header(a)