Skip to content

Commit

Permalink
[VirtualKeyBoard] add missing summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Huevos committed Oct 17, 2024
1 parent c9a671f commit 3f7e412
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/python/Components/Input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
24 changes: 23 additions & 1 deletion lib/python/Screens/VirtualKeyBoard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit 3f7e412

Please sign in to comment.