diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-10-10 03:00:49 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-10-10 03:00:49 +0000 |
| commit | 01abec53c6856c24666967ee51d25d09fc6b8863 (patch) | |
| tree | 19d7bbbd3ce91544c36ba2fc38af83c877d82b01 /lib/python/Screens/ChannelSelection.py | |
| parent | ce7847e4311c165e5441ac2dbb0d9cdbe95b68b9 (diff) | |
| download | enigma2-01abec53c6856c24666967ee51d25d09fc6b8863.tar.gz enigma2-01abec53c6856c24666967ee51d25d09fc6b8863.zip | |
add parental control (still somehow buggy and some minor features missing... don't trust it
yet to protect your children)
Diffstat (limited to 'lib/python/Screens/ChannelSelection.py')
| -rw-r--r-- | lib/python/Screens/ChannelSelection.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 6c3abb5d..58c57f41 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -11,8 +11,11 @@ from Tools.NumericalTextInput import NumericalTextInput from Components.NimManager import nimmanager from Components.Sources.Clock import Clock from Components.Input import Input -from Screens.InputBox import InputBox +from Components.ParentalControl import parentalControl +from Screens.InputBox import InputBox, PinInput +from Screens.MessageBox import MessageBox from ServiceReference import ServiceReference +from Tools.BoundFunction import boundFunction from re import * from os import remove @@ -75,6 +78,11 @@ class ChannelContextMenu(Screen): if not csel.bouquet_mark_edit and not csel.movemode: if not inBouquetRootList: if (csel.getCurrentSelection().flags & eServiceReference.flagDirectory) != eServiceReference.flagDirectory: + if config.ParentalControl.configured.value: + if parentalControl.getProtectionLevel(csel.getCurrentSelection()) == -1: + menu.append((_("add to parental protection"), boundFunction(self.addParentalProtection, csel.getCurrentSelection()))) + else: + menu.append((_("remove from parental protection"), boundFunction(self.removeParentalProtection, csel.getCurrentSelection()))) if haveBouquets: menu.append((_("add service to bouquet"), self.addServiceToBouquetSelected)) else: @@ -130,6 +138,21 @@ class ChannelContextMenu(Screen): self.csel.addBouquet(bouquet, None) self.close() + def addParentalProtection(self, service): + parentalControl.protectService(service) + self.close() + + def removeParentalProtection(self, service): + self.session.openWithCallback(boundFunction(self.pinEntered, service), PinInput, pinList = [config.ParentalControl.servicepin[0].value], title = _("Enter the service pin"), windowTitle = _("Change pin code")) + + def pinEntered(self, service, result): + if result[0]: + parentalControl.unProtectService(service) + self.close() + else: + self.session.openWithCallback(self.close, MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR) + + def addServiceToBouquetSelected(self): bouquets = self.csel.getBouquetList() if bouquets is None: |
