diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py index 4beae57fae..423eae7cf4 100644 --- a/lib/python/Components/Input.py +++ b/lib/python/Components/Input.py @@ -22,6 +22,7 @@ def __init__(self, text="", maxSize=False, visible_width=False, type=TEXT, currP self.visible_width = visible_width self.offset = 0 self.overwrite = maxSize or self.type == self.NUMBER + self.onChangedEntry = [] self.setText(text) def __len__(self): @@ -56,6 +57,9 @@ def update(self): self.text += (x == " " and " " or "*") else: self.text = str(self.Text) + " " + for cb in self.onChangedEntry: + if callable(cb): + cb() def setText(self, text): if not len(text): diff --git a/lib/python/Screens/VirtualKeyBoard.py b/lib/python/Screens/VirtualKeyBoard.py index a211c935df..3d5a463ee7 100644 --- a/lib/python/Screens/VirtualKeyBoard.py +++ b/lib/python/Screens/VirtualKeyBoard.py @@ -12,7 +12,7 @@ from Components.Sources.StaticText import StaticText from Screens.ChoiceBox import ChoiceBox from Screens.HelpMenu import HelpableScreen -from Screens.Screen import Screen +from Screens.Screen import Screen, ScreenSummary from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename from Tools.LoadPixmap import LoadPixmap from Tools.NumericalTextInput import NumericalTextInput @@ -1173,3 +1173,25 @@ def selectAsciiKey(self, char): return True selkey += 1 return False + + def createSummary(self): + return VirtualKeyBoardSummary + + +class VirtualKeyBoardSummary(ScreenSummary): + def __init__(self, session, parent): + ScreenSummary.__init__(self, session, parent=parent) + self.skinName = ["VirtualKeyBoardSummary", "PluginBrowserSummary"] + self["entry"] = StaticText() + self.onShow.append(self.addWatcher) + self.onHide.append(self.removeWatcher) + + def addWatcher(self): + self.parent["text"].onChangedEntry.append(self.selectionChanged) + self.selectionChanged() + + def removeWatcher(self): + self.parent["text"].onChangedEntry.remove(self.selectionChanged) + + def selectionChanged(self): + self["entry"].text = self.parent["text"].getText()