aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Screens/InfoBarGenerics.py6
-rw-r--r--lib/python/Screens/MessageBox.py19
-rw-r--r--lib/python/Screens/Screen.py46
-rw-r--r--lib/python/Tools/Notifications.py4
4 files changed, 43 insertions, 32 deletions
diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
index 9e8e20b6..0fdc6468 100644
--- a/lib/python/Screens/InfoBarGenerics.py
+++ b/lib/python/Screens/InfoBarGenerics.py
@@ -1891,12 +1891,12 @@ class InfoBarServiceErrorPopupSupport:
eDVBServicePMTHandler.eventSOF: None,
eDVBServicePMTHandler.eventEOF: None
}
-
+
if error not in errors:
error = None
- error = error and errors[error]
-
+ error = error is not None and errors[error]
+
if error is not None:
Notifications.AddPopup(text = error, type = MessageBox.TYPE_ERROR, timeout = 5, id = "ZapError")
else:
diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py
index 33d51b24..b16b8730 100644
--- a/lib/python/Screens/MessageBox.py
+++ b/lib/python/Screens/MessageBox.py
@@ -67,15 +67,16 @@ class MessageBox(Screen):
self.timer.start(1000)
def timerTick(self):
- self.timeout -= 1
- if self.origTitle is None:
- self.origTitle = self.instance.getTitle()
- self.setTitle(self.origTitle + " (" + str(self.timeout) + ")")
- if self.timeout == 0:
- self.timer.stop()
- self.timerRunning = False
- self.timeoutCallback()
-
+ if self.execing:
+ self.timeout -= 1
+ if self.origTitle is None:
+ self.origTitle = self.instance.getTitle()
+ self.setTitle(self.origTitle + " (" + str(self.timeout) + ")")
+ if self.timeout == 0:
+ self.timer.stop()
+ self.timerRunning = False
+ self.timeoutCallback()
+
def timeoutCallback(self):
print "Timeout!"
self.ok()
diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py
index 989f90a9..53492918 100644
--- a/lib/python/Screens/Screen.py
+++ b/lib/python/Screens/Screen.py
@@ -30,29 +30,36 @@ class Screen(dict, HTMLSkin, GUISkin):
# we need the list in every screen. how ironic.
self.helpList = [ ]
+ self.close_on_next_exec = None
+
def execBegin(self):
self.active_components = [ ]
+ if self.close_on_next_exec is not None:
+ tmp = self.close_on_next_exec
+ self.close_on_next_exec = None
+ self.execing = True
+ self.close(tmp)
+ else:
+ single = self.onFirstExecBegin
+ self.onFirstExecBegin = []
+ for x in self.onExecBegin + single:
+ x()
+ if self.session.current_dialog != self:
+ return
- single = self.onFirstExecBegin
- self.onFirstExecBegin = []
- for x in self.onExecBegin + single:
- x()
- if self.session.current_dialog != self:
- return
+# assert self.session == None, "a screen can only exec once per time"
+# self.session = session
-# assert self.session == None, "a screen can only exec once per time"
-# self.session = session
+ for val in self.values() + self.renderer:
+ val.execBegin()
+ if self.session.current_dialog != self:
+ return
+ self.active_components.append(val)
- for val in self.values() + self.renderer:
- val.execBegin()
- if self.session.current_dialog != self:
- return
- self.active_components.append(val)
-
- self.execing = True
+ self.execing = True
- for x in self.onShown:
- x()
+ for x in self.onShown:
+ x()
def execEnd(self):
# for (name, val) in self.items():
@@ -94,7 +101,10 @@ class Screen(dict, HTMLSkin, GUISkin):
self.__dict__.clear()
def close(self, *retval):
- self.session.close(self, *retval)
+ if not self.execing:
+ self.close_on_next_exec = retval
+ else:
+ self.session.close(self, *retval)
def setFocus(self, o):
self.instance.setFocus(o.instance)
diff --git a/lib/python/Tools/Notifications.py b/lib/python/Tools/Notifications.py
index 26c2a607..0410a4e2 100644
--- a/lib/python/Tools/Notifications.py
+++ b/lib/python/Tools/Notifications.py
@@ -3,7 +3,6 @@ notifications = [ ]
notificationAdded = [ ]
-
# notifications which are currently on screen (and might be closed by similiar notifications)
current_notifications = [ ]
@@ -37,9 +36,10 @@ def RemovePopup(id):
print "(found in current notifications)"
x[1].close()
+from Screens.MessageBox import MessageBox
+
def AddPopup(text, type, timeout, id = None):
if id is not None:
RemovePopup(id)
- from Screens.MessageBox import MessageBox
print "AddPopup, id =", id
AddNotificationWithID(id, MessageBox, text = text, type = type, timeout = timeout, close_on_any_key = True)