1 from MenuList import MenuList
2 from Components.ParentalControl import parentalControl, IMG_WHITESERVICE, IMG_WHITEBOUQUET, IMG_BLACKSERVICE, IMG_BLACKBOUQUET
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 #Now there is a list of pictures instead of one...
11 entryPicture[IMG_BLACKSERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png"))
12 entryPicture[IMG_BLACKBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lockBouquet.png"))
13 entryPicture[IMG_WHITESERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlock.png"))
14 entryPicture[IMG_WHITEBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlockBouquet.png"))
16 def ParentalControlEntryComponent(service, name, protectionType):
17 locked = protectionType[0]
18 sImage = protectionType[1]
20 (service, name, locked),
21 (eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name)
23 #Changed logic: The image is defined by sImage, not by locked anymore
25 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, entryPicture[sImage]))
28 class ParentalControlList(MenuList):
29 def __init__(self, list, enableWrapAround = False):
30 MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
31 self.l.setFont(0, gFont("Regular", 20))
32 self.l.setItemHeight(32)
34 def toggleSelectedLock(self):
35 print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
36 print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
37 curSel = self.l.getCurrentSelection()
39 parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
41 parentalControl.protectService(self.l.getCurrentSelection()[0][0])
42 #Instead of just negating the locked- flag, now I call the getProtectionType every time...
43 self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
44 self.l.setList(self.list)