diff options
| -rwxr-xr-x | data/skin_default.xml | 8 | ||||
| -rwxr-xr-x[-rw-r--r--] | lib/python/Screens/ParentalControlSetup.py | 70 |
2 files changed, 62 insertions, 16 deletions
diff --git a/data/skin_default.xml b/data/skin_default.xml index 36b1e1c4..0192d805 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -655,18 +655,10 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) <widget name="key0" position="132,92" size="130,30" font="Console;12" halign="center" valign="center" /> <widget name="help2" position="262,92" size="130,30" font="Console;16" halign="center" valign="center" /> </screen> - <!-- Parental control - change pin --> - <screen name="ParentalControlChangePin" position="center,center" size="520,160" title="Change pin code"> - <widget name="config" position="10,10" size="500,350" scrollbarMode="showOnDemand" /> - </screen> <!-- Parental control - editor --> <screen name="ParentalControlEditor" position="center,center" size="520,400" title="Parental control services Editor"> <widget name="servicelist" position="10,10" size="500,350" scrollbarMode="showOnDemand" /> </screen> - <!-- Parental control - setup --> - <screen name="ParentalControlSetup" position="center,center" size="520,400" title="Parental control setup"> - <widget name="config" position="10,10" size="500,350" scrollbarMode="showOnDemand" /> - </screen> <!-- Picture in picture --> <screen name="PictureInPicture" position="400,60" zPosition="-1" size="240,192" flags="wfNoBorder"> <widget name="video" position="0,0" size="240,192" backgroundColor="transparent" /> diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py index 4c63dd5c..a123d2d3 100644..100755 --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -4,6 +4,7 @@ from Components.ActionMap import NumberActionMap from Components.config import config, getConfigListEntry, ConfigNothing, NoSave, ConfigPIN from Components.ParentalControlList import ParentalControlEntryComponent, ParentalControlList from Components.ParentalControl import parentalControl +from Components.Sources.StaticText import StaticText from Screens.ChoiceBox import ChoiceBox from Screens.MessageBox import MessageBox from Screens.InputBox import PinInput @@ -39,23 +40,35 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): def __init__(self, session): Screen.__init__(self, session) ProtectedScreen.__init__(self) + # for the skin: first try ParentalControlSetup, then Setup, this allows individual skinning + self.skinName = ["ParentalControlSetup", "Setup" ] + self.setup_title = _("Parental control setup") + self.onChangedEntry = [ ] + self.list = [] - ConfigListScreen.__init__(self, self.list) + ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) self.createSetup() - + self["actions"] = NumberActionMap(["SetupActions"], { - "cancel": self.keyCancel + "cancel": self.keyCancel, + "save": self.keyCancel }, -2) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(self.setup_title) def isProtected(self): return config.ParentalControl.setuppinactive.value and config.ParentalControl.configured.value - + def createSetup(self): self.editListEntry = None self.changePin = None self.changeSetupPin = None - + self.list = [] self.list.append(getConfigListEntry(_("Enable parental control"), config.ParentalControl.configured)) print "config.ParentalControl.configured.value", config.ParentalControl.configured.value @@ -77,7 +90,7 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): #self.list.append(getConfigListEntry(_("Remember service pin"), config.ParentalControl.storeservicepin)) self.editListEntry = getConfigListEntry(_("Edit services list"), NoSave(ConfigNothing())) self.list.append(self.editListEntry) - + self["config"].list = self.list self["config"].setList(self.list) @@ -136,6 +149,20 @@ class ParentalControlSetup(Screen, ConfigListScreen, ProtectedScreen): def keyNumberGlobal(self, number): pass + # for summary: + def changedEntry(self): + for x in self.onChangedEntry: + x() + + def getCurrentEntry(self): + return self["config"].getCurrent()[0] + + def getCurrentValue(self): + return str(self["config"].getCurrent()[1].getText()) + + def createSummary(self): + from Screens.Setup import SetupSummary + return SetupSummary SPECIAL_CHAR = 96 class ParentalControlEditor(Screen): @@ -224,6 +251,11 @@ class ParentalControlEditor(Screen): class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): def __init__(self, session, pin, pinname): Screen.__init__(self, session) + # for the skin: first try ParentalControlChangePin, then Setup, this allows individual skinning + self.skinName = ["ParentalControlChangePin", "Setup" ] + self.setup_title = _("Change pin code") + self.onChangedEntry = [ ] + self.pin = pin self.list = [] self.pin1 = ConfigPIN(default = 1111, censor = "*") @@ -232,16 +264,24 @@ class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2)) self.list.append(getConfigListEntry(_("New pin"), NoSave(self.pin1))) self.list.append(getConfigListEntry(_("Reenter new pin"), NoSave(self.pin2))) - ConfigListScreen.__init__(self, self.list) + ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) # print "old pin:", pin #if pin.value != "aaaa": #self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.pin.value], title = _("please enter the old pin"), windowTitle = _("Change pin code"))) ProtectedScreen.__init__(self) - + self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"], { "cancel": self.cancel, + "red": self.cancel, + "save": self.keyOK, }, -1) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(self.setup_title) def valueChanged(self, pin, value): if pin == 1: @@ -279,3 +319,17 @@ class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): def keyNumberGlobal(self, number): ConfigListScreen.keyNumberGlobal(self, number) + # for summary: + def changedEntry(self): + for x in self.onChangedEntry: + x() + + def getCurrentEntry(self): + return self["config"].getCurrent()[0] + + def getCurrentValue(self): + return str(self["config"].getCurrent()[1].getText()) + + def createSummary(self): + from Screens.Setup import SetupSummary + return SetupSummary |
