From 01abec53c6856c24666967ee51d25d09fc6b8863 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Tue, 10 Oct 2006 03:00:49 +0000 Subject: add parental control (still somehow buggy and some minor features missing... don't trust it yet to protect your children) --- lib/python/Components/ParentalControlList.py | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lib/python/Components/ParentalControlList.py (limited to 'lib/python/Components/ParentalControlList.py') diff --git a/lib/python/Components/ParentalControlList.py b/lib/python/Components/ParentalControlList.py new file mode 100644 index 00000000..6315963f --- /dev/null +++ b/lib/python/Components/ParentalControlList.py @@ -0,0 +1,55 @@ +from HTMLComponent import * +from GUIComponent import * + +from MenuList import MenuList +from Components.ParentalControl import parentalControl +from Tools.Directories import * + +from enigma import * + +RT_HALIGN_LEFT = 0 +RT_HALIGN_RIGHT = 1 +RT_HALIGN_CENTER = 2 +RT_HALIGN_BLOCK = 4 + +RT_VALIGN_TOP = 0 +RT_VALIGN_CENTER = 8 +RT_VALIGN_BOTTOM = 16 + +lockPicture = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "lock-fs8.png")) + +def ParentalControlEntryComponent(service, name, locked = True): + res = [ (service, name, locked) ] + res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 200, 50, 0, RT_HALIGN_LEFT, name)) + if locked: + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture)) + + return res + +class ParentalControlList(MenuList, HTMLComponent, GUIComponent): + def __init__(self, list): + GUIComponent.__init__(self) + self.l = eListboxPythonMultiContent() + self.list = list + self.l.setList(list) + self.l.setFont(0, gFont("Regular", 20)) + + GUI_WIDGET = eListbox + + def setList(self, list): + self.list = list + self.l.setList(list) + + def postWidgetCreate(self, instance): + instance.setContent(self.l) + instance.setItemHeight(32) + + 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]) + else: + parentalControl.unProtectService(self.l.getCurrentSelection()[0][0]) + self.l.setList(self.list) -- cgit v1.2.3