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 HarddiskSetup import HarddiskSelection
11 from Components.Button import Button
12 from Components.Label import Label
13 from Components.ProgressBar import ProgressBar
14 from ConfigMenu import *
18 from TimerEdit import *
20 from enigma import quitMainloop
22 import xml.dom.minidom
23 from xml.dom import EMPTY_NAMESPACE
24 from skin import elementsWithTag
26 from Tools import XMLTools
30 screen["clock"] = Clock()
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="Sleep Timer"></item>
39 mdom = xml.dom.minidom.parseString(
41 <menu text="Mainmenu" title="Mainmenu">
42 <item text="Standby debug">quitMainloop()</item>
43 <item text="Timer">self.openDialog(TimerEditList)</item>
45 <menu text="Service Organising -disabled-">
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">self.openSetup("satconfig")</item>
52 <item text="Satfinder -disabled-"></item>
53 <item text="Rotor Control -disabled-"></item>
54 <item text="Edit Transponder -disabled-"></item>
55 <item text="Automatic Scan">self.openDialog(ServiceScan)</item>
58 <item text="Timezone">self.openSetup("timezone")</item>
59 <item text="Video Audio">self.openSetup("avsetup")</item>
60 <item text="UHF Modulator">self.openSetup("rfmod")</item>
61 <item text="Harddisk">self.openDialog(HarddiskSelection)</item>
62 <item text="Remote Control">self.openSetup("rc")</item>
63 <item text="Keyboard">self.openSetup("keyboard")</item>
64 <item text="OSD">self.openSetup("osd")</item>
65 <item text="LCD">self.openSetup("lcd")</item>
67 <item text="Common Interface"></item>
68 <item text="Parental Control">self.openSetup("parental")</item>
69 <item text="Expert">self.openSetup("expert")</item>
71 <item text="Games (not found)"></item>
72 <item text="Information">self.openDialog(About)</item>
74 <item text="PowerOff">quitMainloop()</item>
75 <item text="Restart">quitMainloop()</item>
76 <item text="Standby">quitMainloop()</item>
80 def getValbyAttr(x, attr):
81 for p in range(x.attributes.length):
82 a = x.attributes.item(p)
91 def __init__(self, fnc, *args):
97 class configOSD(Screen):
98 #this needs focus handling - so not useable
100 def okbuttonClick(self):
103 def __init__(self, session):
104 Screen.__init__(self, session)
106 self["actions"] = ActionMap(["OkCancelActions"],
108 "ok": self.okbuttonClick,
112 self["okbutton"] = Button("Save")
114 self["txt_alpha"] = Label("Alpha:")
115 self["sld_alpha"] = ProgressBar()
116 self["sld_alpha"].setValue(50)
118 self["txt_brightness"] = Label("Brightness:")
119 self["sld_brightness"] = ProgressBar()
120 self["sld_brightness"].setValue(50)
122 self["txt_gamma"] = Label("Contrast:")
123 self["sld_gamma"] = ProgressBar()
124 self["sld_gamma"].setValue(50)
127 def okbuttonClick(self):
128 print "okbuttonClick"
129 selection = self["menu"].getCurrent()
132 def evalText(self, text):
135 def nothing(self): #dummy
138 def openDialog(self, dialog): # in every layer needed
139 self.session.open(dialog)
141 def openSetup(self, dialog):
142 self.session.open(Setup, dialog)
144 def addMenu(self, destList, node):
145 MenuTitle = getValbyAttr(node, "text")
146 if MenuTitle != "": #check for title
147 a = boundFunction(self.session.open, Menu, node, node.childNodes)
148 #TODO add check if !empty(node.childNodes)
149 destList.append((MenuTitle, a))
151 def addItem(self, destList, node):
152 ItemText = getValbyAttr(node, "text")
153 if ItemText != "": #check for name
154 b = XMLTools.mergeText(node.childNodes)
155 if b != "": #check for function
156 destList.append((ItemText,boundFunction(self.evalText,b)))
158 destList.append((ItemText,self.nothing)) #use dummy as function
160 def __init__(self, session, parent, childNode):
161 Screen.__init__(self, session)
165 for x in childNode: #walk through the actual nodelist
166 if x.nodeType != xml.dom.minidom.Element.nodeType:
168 elif x.tagName == 'item':
169 self.addItem(list, x)
170 elif x.tagName == 'menu':
171 self.addMenu(list, x)
173 self["menu"] = MenuList(list)
175 self["actions"] = ActionMap(["OkCancelActions"],
177 "ok": self.okbuttonClick,
181 a = getValbyAttr(parent, "title")
182 if a == "": #if empty use name
183 a = getValbyAttr(parent, "text")
184 self["title"] = Header(a)
186 class FixedMenu(Screen):
187 def okbuttonClick(self):
188 selection = self["menu"].getCurrent()
191 def __init__(self, session, title, list):
192 Screen.__init__(self, session)
194 self["menu"] = MenuList(list)
196 self["actions"] = ActionMap(["OkCancelActions"],
198 "ok": self.okbuttonClick,
202 self["title"] = Header(title)
205 class MainMenu(Menu):
206 #add file load functions for the xml-file
207 #remove old code (i.e. goScan / goClock...)
209 def __init__(self, *x):
210 Menu.__init__(self, *x)
211 self.skinName = "Menu"
213 def openDialog(self, dialog):
214 self.session.open(dialog)
216 def openSetup(self, dialog):
217 self.session.open(Setup, dialog)
220 self.session.open(configTest)
223 print "set Mode to TV"
226 def setModeRadio(self):
227 print "set Mode to Radio"
230 def setModeFile(self):
231 print "set Mode to File"
235 self.session.open(ServiceScan)
238 self.session.open(clockDisplay, Clock())