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
22 from Tools import XMLTools
26 screen["clock"] = Clock()
29 mdom = xml.dom.minidom.parseString(
31 <menu text="Mainmenu" title="the real Mainmenu">
32 <item text="Standby debug">quitMainloop()</item>
33 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
35 <item text="TV-Mode">self.setModeTV()</item>
36 <item text="Radio-Mode">self.setModeRadio()</item>
37 <item text="File-Mode">self.setModeFile()</item>
38 <item text="Scart">self.openDialog(ScartLoopThrough)</item>
39 <item text="Timer">self.openDialog(TimerEditList)</item>
41 <menu text="Service Organising">
42 <item text="New Bouquets"></item>
43 <item text="Add to Bouquets"></item>
44 <item text="Edit Bouquets"></item>
46 <menu text="Service Searching">
47 <item text="Satelliteconfig"></item>
48 <item text="Satfinder"></item>
49 <item text="Rotor Control"></item>
50 <item text="Edit Transponder"></item>
51 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
52 <item text="Automatic 'Multisat' Scan"></item>
53 <item text="Manual Scan"></item>
56 <item text="Time Date"></item>
57 <item text="Video Audio"></item>
58 <item text="UHF Modulator"></item>
59 <item text="Harddisk"></item>
60 <item text="Keyboard"></item>
61 <item text="OSD">self.openDialog(configOSD)</item>
62 <item text="Language"></item>
63 <item text="LCD"></item>
65 <item text="Common Interface"></item>
66 <item text="Parental Control"></item>
67 <item text="Expert"></item>
69 <item text="Games"></item>
70 <item text="Information"></item>
72 <item text="PowerOff"></item>
73 <item text="Restart"></item>
74 <item text="Standby"></item>
75 <item text="Sleep Timer">self.goSetup()</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 addMenu(self, destList, node):
138 MenuTitle = getValbyAttr(node, "text")
139 if MenuTitle != "": #check for title
140 a = boundFunction(self.session.open, Menu, node, node.childNodes)
141 #TODO add check if !empty(node.childNodes)
142 destList.append((MenuTitle, a))
144 def addItem(self, destList, node):
145 ItemText = getValbyAttr(node, "text")
146 if ItemText != "": #check for name
147 b = XMLTools.mergeText(node.childNodes)
148 if b != "": #check for function
149 destList.append((ItemText,boundFunction(self.evalText,b)))
151 destList.append((ItemText,self.nothing)) #use dummy as function
153 def __init__(self, session, parent, childNode):
154 Screen.__init__(self, session)
158 for x in childNode: #walk through the actual nodelist
159 if x.nodeType != xml.dom.minidom.Element.nodeType:
161 elif x.tagName == 'item':
162 self.addItem(list, x)
163 elif x.tagName == 'menu':
164 self.addMenu(list, x)
166 self["menu"] = MenuList(list)
168 self["actions"] = ActionMap(["OkCancelActions"],
170 "ok": self.okbuttonClick,
174 a = getValbyAttr(parent, "title")
175 if a == "": #if empty use name
176 a = getValbyAttr(parent, "text")
177 self["title"] = Header(a)
179 class FixedMenu(Screen):
180 def okbuttonClick(self):
181 selection = self["menu"].getCurrent()
184 def __init__(self, session, title, list):
185 Screen.__init__(self, session)
187 self["menu"] = MenuList(list)
189 self["actions"] = ActionMap(["OkCancelActions"],
191 "ok": self.okbuttonClick,
195 self["title"] = Header(title)
198 class MainMenu(Menu):
199 #add file load functions for the xml-file
200 #remove old code (i.e. goScan / goClock...)
202 def __init__(self, *x):
203 Menu.__init__(self, *x)
204 self.skinName = "Menu"
206 def openDialog(self, dialog):
207 self.session.open(dialog)
210 self.session.open(configTest)
213 print "set Mode to TV"
216 def setModeRadio(self):
217 print "set Mode to Radio"
220 def setModeFile(self):
221 print "set Mode to File"
225 self.session.open(ServiceScan)
228 self.session.open(clockDisplay, Clock())