Skip to content

Commit

Permalink
Merge pull request #3165 from openatv/IanSav-MessageBox
Browse files Browse the repository at this point in the history
[MessageBox.py] Correct summary display
  • Loading branch information
jbleyel authored Dec 2, 2023
2 parents 1175c71 + b760bd3 commit 68ff67f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/python/Screens/MessageBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, session, text, type=TYPE_YESNO, timeout=-1, list=None, defaul
elif isinstance(default, int):
self.startIndex = default
else:
print("[MessageBox] Error: The context of the default (%s) can't be determined!" % default)
print(f"[MessageBox] Error: The context of the default ({default}) can't be determined!")
else:
self["list"] = MenuList([])
self["list"].hide()
Expand Down Expand Up @@ -108,7 +108,7 @@ def __init__(self, session, text, type=TYPE_YESNO, timeout=-1, list=None, defaul
self.onLayoutFinish.append(self.layoutFinished)

def __repr__(self):
return "%s(%s)" % (str(type(self)), self.text)
return f"{str(type(self))}({self.text})"

def layoutFinished(self):
if self.list:
Expand All @@ -127,7 +127,7 @@ def layoutFinished(self):
self.baseTitle = self.baseTitle % prefix
self.setTitle(self.baseTitle, showPath=False)
if self.timeout > 0:
print("[MessageBox] Timeout set to %d seconds." % self.timeout)
print(f"[MessageBox] Timeout set to {self.timeout} seconds.")
self.timer.start(25)

def processTimer(self):
Expand All @@ -139,7 +139,7 @@ def processTimer(self):
self.baseTitle = self.activeTitle
if self.timeout > 0:
if self.baseTitle:
self.setTitle("%s (%d)" % (self.baseTitle, self.timeout), showPath=False)
self.setTitle(f"{self.baseTitle} ({self.timeout})", showPath=False)
self.timer.start(1000)
self.timeout -= 1
else:
Expand All @@ -150,7 +150,7 @@ def processTimer(self):
self.select()

def stopTimer(self, reason):
print("[MessageBox] %s" % reason)
print(f"[MessageBox] {reason}")
self.timer.stop()
self.timeout = 0
if self.baseTitle is not None:
Expand Down Expand Up @@ -205,7 +205,7 @@ def __init__(self, session, parent):
ScreenSummary.__init__(self, session, parent=parent)
self["text"] = StaticText(parent.text)
self["option"] = StaticText("")
if hasattr(self, "list"):
if hasattr(parent, "list"):
if self.addWatcher not in self.onShow:
self.onShow.append(self.addWatcher)
if self.removeWatcher not in self.onHide:
Expand Down

0 comments on commit 68ff67f

Please sign in to comment.