aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/ParentalControlList.py
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2010-01-11 19:18:34 +0100
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2010-03-01 01:53:23 +0100
commiteca33f89346b4ad0e7bbaef7438e8a87daa963a9 (patch)
tree648e9f195053be7a9d5c466e542eb12f139ac809 /lib/python/Components/ParentalControlList.py
parentbdea0dd8ac75294737564b1c2a4178a32ba3d284 (diff)
downloadenigma2-eca33f89346b4ad0e7bbaef7438e8a87daa963a9.tar.gz
enigma2-eca33f89346b4ad0e7bbaef7438e8a87daa963a9.zip
Add some parental control improvements (made by Tode)
Diffstat (limited to 'lib/python/Components/ParentalControlList.py')
-rw-r--r--lib/python/Components/ParentalControlList.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/python/Components/ParentalControlList.py b/lib/python/Components/ParentalControlList.py
index 128e6d3e..797ea391 100644
--- a/lib/python/Components/ParentalControlList.py
+++ b/lib/python/Components/ParentalControlList.py
@@ -1,19 +1,28 @@
from MenuList import MenuList
-from Components.ParentalControl import parentalControl
+from Components.ParentalControl import parentalControl, IMG_WHITESERVICE, IMG_WHITEBOUQUET, IMG_BLACKSERVICE, IMG_BLACKBOUQUET
from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
from Tools.LoadPixmap import LoadPixmap
-lockPicture = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png"))
+#Now there is a list of pictures instead of one...
+entryPicture = {}
-def ParentalControlEntryComponent(service, name, locked = True):
+entryPicture[IMG_BLACKSERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png"))
+entryPicture[IMG_BLACKBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lockBouquet.png"))
+entryPicture[IMG_WHITESERVICE] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlock.png"))
+entryPicture[IMG_WHITEBOUQUET] = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/unlockBouquet.png"))
+
+def ParentalControlEntryComponent(service, name, protectionType):
+ locked = protectionType[0]
+ sImage = protectionType[1]
res = [
(service, name, locked),
(eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name)
]
- if locked:
- res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture))
+ #Changed logic: The image is defined by sImage, not by locked anymore
+ if sImage != "":
+ res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, entryPicture[sImage]))
return res
class ParentalControlList(MenuList):
@@ -25,9 +34,11 @@ class ParentalControlList(MenuList):
def toggleSelectedLock(self):
print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
- self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]);
- if self.l.getCurrentSelection()[0][2]:
- parentalControl.protectService(self.l.getCurrentSelection()[0][0])
+ curSel = self.l.getCurrentSelection()
+ if curSel[0][2]:
+ parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
else:
- parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])
+ parentalControl.protectService(self.l.getCurrentSelection()[0][0])
+ #Instead of just negating the locked- flag, now I call the getProtectionType every time...
+ self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(curSel[0][0], curSel[0][1], parentalControl.getProtectionType(curSel[0][0]))
self.l.setList(self.list)