diff options
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/Components/ConfigList.py | 4 | ||||
| -rw-r--r-- | lib/python/Components/config.py | 7 | ||||
| -rw-r--r-- | lib/python/Screens/ParentalControlSetup.py | 8 |
3 files changed, 19 insertions, 0 deletions
diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py index 7ed6031a..47b577e2 100644 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -48,6 +48,10 @@ class ConfigList(HTMLComponent, GUIComponent, object): def getCurrentIndex(self): return self.l.getCurrentSelectionIndex() + def setCurrentIndex(self, index): + if self.instance is not None: + self.instance.moveSelectionTo(index) + def invalidateCurrent(self): self.l.invalidateEntry(self.l.getCurrentSelectionIndex()) diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index a872c300..de06871a 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -328,6 +328,8 @@ class ConfigSequence(ConfigElement): self.default = default self.value = copy.copy(default) + + self.endNotifier = [] def validate(self): max_pos = 0 @@ -344,6 +346,8 @@ class ConfigSequence(ConfigElement): num += 1 if self.marked_pos >= max_pos: + for x in self.endNotifier: + x(self) self.marked_pos = max_pos - 1 if self.marked_pos < 0: @@ -357,6 +361,9 @@ class ConfigSequence(ConfigElement): if self.marked_pos >= total_len: self.marked_pos = total_len - 1 + + def addEndNotifier(self, notifier): + self.endNotifier.append(notifier) def handleKey(self, key): if key == KEY_LEFT: diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py index abe09af0..f5f48e25 100644 --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -230,6 +230,8 @@ class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): self.list = [] self.pin1 = ConfigPIN(default = 1111, censor = "*") self.pin2 = ConfigPIN(default = 1112, censor = "*") + self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1)) + 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) @@ -243,6 +245,12 @@ class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen): "cancel": self.cancel, }, -1) + def valueChanged(self, pin, value): + if pin == 1: + self["config"].setCurrentIndex(1) + elif pin == 2: + self.keyOK() + def getPinText(self): return _("Please enter the old pin code") |
