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 Screens.Setup import Setup
8 from ServiceScan import ServiceScan
9 from ScartLoopThrough import ScartLoopThrough
10 from Components.Button import Button
11 from Components.Label import Label
12 from Components.ProgressBar import ProgressBar
13 from ConfigMenu import *
15 from TimerEdit import *
17 from enigma import quitMainloop
19 import xml.dom.minidom
20 from xml.dom import EMPTY_NAMESPACE
21 from skin import elementsWithTag
23 from Tools import XMLTools
27 screen["clock"] = Clock()
30 mdom = xml.dom.minidom.parseString(
32 <menu text="Mainmenu" title="the real Mainmenu">
33 <item text="Standby debug">quitMainloop()</item>
34 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
36 <item text="Blub1">self.openSetup("rc")</item>
37 <item text="Blub2">self.openSetup("blasel")</item>
39 <item text="TV-Mode">self.setModeTV()</item>
40 <item text="Radio-Mode">self.setModeRadio()</item>
41 <item text="File-Mode">self.setModeFile()</item>
42 <item text="Scart">self.openDialog(ScartLoopThrough)</item>
43 <item text="Timer">self.openDialog(TimerEditList)</item>
45 <menu text="Service Organising">
46 <item text="New Bouquets"></item>
47 <item text="Add to Bouquets"></item>
48 <item text="Edit Bouquets"></item>
50 <menu text="Service Searching">
51 <item text="Satelliteconfig"></item>
52 <item text="Satfinder"></item>
53 <item text="Rotor Control"></item>
54 <item text="Edit Transponder"></item>
55 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
56 <item text="Automatic 'Multisat' Scan"></item>
57 <item text="Manual Scan"></item>
60 <item text="Time Date"></item>
61 <item text="Video Audio"></item>
62 <item text="UHF Modulator"></item>
63 <item text="Harddisk"></item>
64 <item text="Keyboard"></item>
65 <item text="OSD">self.openDialog(configOSD)</item>
66 <item text="Language"></item>
67 <item text="LCD"></item>
69 <item text="Common Interface"></item>
70 <item text="Parental Control"></item>
71 <item text="Expert"></item>
73 <item text="Games"></item>
74 <item text="Information"></item>
76 <item text="PowerOff"></item>
77 <item text="Restart"></item>
78 <item text="Standby"></item>
79 <item text="Sleep Timer">self.goSetup()</item>
83 def getValbyAttr(x, attr):
84 for p in range(x.attributes.length):
85 a = x.attributes.item(p)
94 def __init__(self, fnc, *args):
100 class configOSD(Screen):
101 #this needs focus handling - so not useable
103 def okbuttonClick(self):
106 def __init__(self, session):
107 Screen.__init__(self, session)
109 self["actions"] = ActionMap(["OkCancelActions"],
111 "ok": self.okbuttonClick,
115 self["okbutton"] = Button("Save")
117 self["txt_alpha"] = Label("Alpha:")
118 self["sld_alpha"] = ProgressBar()
119 self["sld_alpha"].setValue(50)
121 self["txt_brightness"] = Label("Brightness:")
122 self["sld_brightness"] = ProgressBar()
123 self["sld_brightness"].setValue(50)
125 self["txt_gamma"] = Label("Contrast:")
126 self["sld_gamma"] = ProgressBar()
127 self["sld_gamma"].setValue(50)
130 def okbuttonClick(self):
131 print "okbuttonClick"
132 selection = self["menu"].getCurrent()
135 def evalText(self, text):
138 def nothing(self): #dummy
141 def openDialog(self, dialog): # in every layer needed
142 self.session.open(dialog)
144 def openSetup(self, dialog):
145 self.session.open(setup, dialog)
147 def addMenu(self, destList, node):
148 MenuTitle = getValbyAttr(node, "text")
149 if MenuTitle != "": #check for title
150 a = boundFunction(self.session.open, Menu, node, node.childNodes)
151 #TODO add check if !empty(node.childNodes)
152 destList.append((MenuTitle, a))
154 def addItem(self, destList, node):
155 ItemText = getValbyAttr(node, "text")
156 if ItemText != "": #check for name
157 b = XMLTools.mergeText(node.childNodes)
158 if b != "": #check for function
159 destList.append((ItemText,boundFunction(self.evalText,b)))
161 destList.append((ItemText,self.nothing)) #use dummy as function
163 def __init__(self, session, parent, childNode):
164 Screen.__init__(self, session)
168 for x in childNode: #walk through the actual nodelist
169 if x.nodeType != xml.dom.minidom.Element.nodeType:
171 elif x.tagName == 'item':
172 self.addItem(list, x)
173 elif x.tagName == 'menu':
174 self.addMenu(list, x)
176 self["menu"] = MenuList(list)
178 self["actions"] = ActionMap(["OkCancelActions"],
180 "ok": self.okbuttonClick,
184 a = getValbyAttr(parent, "title")
185 if a == "": #if empty use name
186 a = getValbyAttr(parent, "text")
187 self["title"] = Header(a)
189 class FixedMenu(Screen):
190 def okbuttonClick(self):
191 selection = self["menu"].getCurrent()
194 def __init__(self, session, title, list):
195 Screen.__init__(self, session)
197 self["menu"] = MenuList(list)
199 self["actions"] = ActionMap(["OkCancelActions"],
201 "ok": self.okbuttonClick,
205 self["title"] = Header(title)
208 class MainMenu(Menu):
209 #add file load functions for the xml-file
210 #remove old code (i.e. goScan / goClock...)
212 def __init__(self, *x):
213 Menu.__init__(self, *x)
214 self.skinName = "Menu"
216 def openDialog(self, dialog):
217 self.session.open(dialog)
219 def openSetup(self, dialog):
220 self.session.open(Setup, dialog)
223 self.session.open(configTest)
226 print "set Mode to TV"
229 def setModeRadio(self):
230 print "set Mode to Radio"
233 def setModeFile(self):
234 print "set Mode to File"
238 self.session.open(ServiceScan)
241 self.session.open(clockDisplay, Clock())