1 from HTMLComponent import *
2 from GUIComponent import *
4 from MenuList import MenuList
5 from Components.ParentalControl import parentalControl
6 from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
8 from enigma import loadPNG, eListbox, eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
10 lockPicture = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "lock-fs8.png"))
12 def ParentalControlEntryComponent(service, name, locked = True):
13 res = [ (service, name, locked) ]
14 res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name))
16 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture))
19 class ParentalControlList(MenuList, HTMLComponent, GUIComponent):
20 def __init__(self, list):
21 GUIComponent.__init__(self)
22 self.l = eListboxPythonMultiContent()
25 self.l.setFont(0, gFont("Regular", 20))
26 self.l.setItemHeight(32)
30 def setList(self, list):
34 def postWidgetCreate(self, instance):
35 instance.setContent(self.l)
37 def toggleSelectedLock(self):
38 print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
39 print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
40 self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]);
41 if self.l.getCurrentSelection()[0][2]:
42 parentalControl.protectService(self.l.getCurrentSelection()[0][0])
44 parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
45 self.l.setList(self.list)