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 *
17 from TimerEdit import *
19 from enigma import quitMainloop
21 import xml.dom.minidom
22 from xml.dom import EMPTY_NAMESPACE
23 from skin import elementsWithTag
25 from Tools import XMLTools
29 screen["clock"] = Clock()
32 # <item text="TV-Mode">self.setModeTV()</item>
33 # <item text="Radio-Mode">self.setModeRadio()</item>
34 # <item text="File-Mode">self.setModeFile()</item>
35 # <item text="Scart">self.openDialog(ScartLoopThrough)</item>
36 # <item text="Sleep Timer"></item>
38 mdom = xml.dom.minidom.parseString(
40 <menu text="Mainmenu" title="Mainmenu">
41 <item text="Standby debug">quitMainloop()</item>
42 <item text="Timer">self.openDialog(TimerEditList)</item>
44 <menu text="Service Organising -disabled-">
45 <item text="New Bouquets"></item>
46 <item text="Add to Bouquets"></item>
47 <item text="Edit Bouquets"></item>
49 <menu text="Service Searching">
50 <item text="Satelliteconfig">self.openSetup("satconfig")</item>
51 <item text="Satfinder -disabled-"></item>
52 <item text="Rotor Control -disabled-"></item>
53 <item text="Edit Transponder -disabled-"></item>
54 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
57 <item text="Timezone">self.openSetup("timezone")</item>
58 <item text="Video Audio">self.openSetup("avsetup")</item>
59 <item text="UHF Modulator">self.openSetup("rfmod")</item>
60 <item text="Harddisk"></item>
61 <item text="Remote Control">self.openSetup("rc")</item>
62 <item text="Keyboard">self.openSetup("keyboard")</item>
63 <item text="OSD">self.openSetup("osd")</item>
64 <item text="LCD">self.openSetup("lcd")</item>
66 <item text="Common Interface"></item>
67 <item text="Parental Control">self.openSetup("parental")</item>
68 <item text="Expert">self.openSetup("expert")</item>
70 <item text="Games (not found)"></item>
71 <item text="Information">self.openDialog(About)</item>
73 <item text="PowerOff">quitMainloop()</item>
74 <item text="Restart">quitMainloop()</item>
75 <item text="Standby">quitMainloop()</item>
79 def getValbyAttr(x, attr):
80 for p in range(x.attributes.length):
81 a = x.attributes.item(p)
90 def __init__(self, fnc, *args):
96 class configOSD(Screen):
97 #this needs focus handling - so not useable
99 def okbuttonClick(self):
102 def __init__(self, session):
103 Screen.__init__(self, session)
105 self["actions"] = ActionMap(["OkCancelActions"],
107 "ok": self.okbuttonClick,
111 self["okbutton"] = Button("Save")
113 self["txt_alpha"] = Label("Alpha:")
114 self["sld_alpha"] = ProgressBar()
115 self["sld_alpha"].setValue(50)
117 self["txt_brightness"] = Label("Brightness:")
118 self["sld_brightness"] = ProgressBar()
119 self["sld_brightness"].setValue(50)
121 self["txt_gamma"] = Label("Contrast:")
122 self["sld_gamma"] = ProgressBar()
123 self["sld_gamma"].setValue(50)
126 def okbuttonClick(self):
127 print "okbuttonClick"
128 selection = self["menu"].getCurrent()
131 def evalText(self, text):
134 def nothing(self): #dummy
137 def openDialog(self, dialog): # in every layer needed
138 self.session.open(dialog)
140 def openSetup(self, dialog):
141 self.session.open(Setup, dialog)
143 def addMenu(self, destList, node):
144 MenuTitle = getValbyAttr(node, "text")
145 if MenuTitle != "": #check for title
146 a = boundFunction(self.session.open, Menu, node, node.childNodes)
147 #TODO add check if !empty(node.childNodes)
148 destList.append((MenuTitle, a))
150 def addItem(self, destList, node):
151 ItemText = getValbyAttr(node, "text")
152 if ItemText != "": #check for name
153 b = XMLTools.mergeText(node.childNodes)
154 if b != "": #check for function
155 destList.append((ItemText,boundFunction(self.evalText,b)))
157 destList.append((ItemText,self.nothing)) #use dummy as function
159 def __init__(self, session, parent, childNode):
160 Screen.__init__(self, session)
164 for x in childNode: #walk through the actual nodelist
165 if x.nodeType != xml.dom.minidom.Element.nodeType:
167 elif x.tagName == 'item':
168 self.addItem(list, x)
169 elif x.tagName == 'menu':
170 self.addMenu(list, x)
172 self["menu"] = MenuList(list)
174 self["actions"] = ActionMap(["OkCancelActions"],
176 "ok": self.okbuttonClick,
180 a = getValbyAttr(parent, "title")
181 if a == "": #if empty use name
182 a = getValbyAttr(parent, "text")
183 self["title"] = Header(a)
185 class FixedMenu(Screen):
186 def okbuttonClick(self):
187 selection = self["menu"].getCurrent()
190 def __init__(self, session, title, list):
191 Screen.__init__(self, session)
193 self["menu"] = MenuList(list)
195 self["actions"] = ActionMap(["OkCancelActions"],
197 "ok": self.okbuttonClick,
201 self["title"] = Header(title)
204 class MainMenu(Menu):
205 #add file load functions for the xml-file
206 #remove old code (i.e. goScan / goClock...)
208 def __init__(self, *x):
209 Menu.__init__(self, *x)
210 self.skinName = "Menu"
212 def openDialog(self, dialog):
213 self.session.open(dialog)
215 def openSetup(self, dialog):
216 self.session.open(Setup, dialog)
219 self.session.open(configTest)
222 print "set Mode to TV"
225 def setModeRadio(self):
226 print "set Mode to Radio"
229 def setModeFile(self):
230 print "set Mode to File"
234 self.session.open(ServiceScan)
237 self.session.open(clockDisplay, Clock())