1 from MenuList import MenuList
2 from Components.ParentalControl import parentalControl
3 from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
5 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
6 from Tools.LoadPixmap import LoadPixmap
8 lockPicture = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png"))
10 def ParentalControlEntryComponent(service, name, locked = True):
12 (service, name, locked),
13 (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):
20 def __init__(self, list, enableWrapAround = False):
21 MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
22 self.l.setFont(0, gFont("Regular", 20))
23 self.l.setItemHeight(32)
25 def toggleSelectedLock(self):
26 print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
27 print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
28 self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]);
29 if self.l.getCurrentSelection()[0][2]:
30 parentalControl.protectService(self.l.getCurrentSelection()[0][0])
32 parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
33 self.l.setList(self.list)