From 7c8c2b339b747763eede225a0ca554a405e5ac7b Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Sat, 30 Dec 2006 15:07:29 +0000 Subject: [PATCH] send evStart before tuneFailed Events.. fix evNoResources fix some bluescreens caused by notification handling --- lib/dvb/pmt.cpp | 2 +- lib/python/Screens/InfoBarGenerics.py | 6 ++-- lib/python/Screens/MessageBox.py | 19 +++++------ lib/python/Screens/Screen.py | 46 ++++++++++++++++----------- lib/python/Tools/Notifications.py | 4 +-- lib/service/servicedvb.cpp | 4 ++- 6 files changed, 47 insertions(+), 34 deletions(-) diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 4b0acdfa..8db4ba9f 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -544,7 +544,7 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux, } } else { - serviceEvent(eventTuneFailed); + serviceEvent(eventNoResources); return res; } 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) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index ea014a19..254c12fd 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1049,6 +1049,7 @@ void eDVBServicePlay::serviceEvent(int event) } break; } + case eDVBServicePMTHandler::eventNoResources: case eDVBServicePMTHandler::eventNoPAT: case eDVBServicePMTHandler::eventNoPATEntry: case eDVBServicePMTHandler::eventNoPMT: @@ -1108,6 +1109,8 @@ RESULT eDVBServicePlay::start() if (m_is_pvr) m_cue = new eCueSheet(); + m_event(this, evStart); + m_first_program_info = 1; eServiceReferenceDVB &service = (eServiceReferenceDVB&)m_reference; r = m_service_handler.tune(service, m_is_pvr, m_cue); @@ -1130,7 +1133,6 @@ RESULT eDVBServicePlay::start() if (m_is_pvr) loadCuesheet(); - m_event(this, evStart); m_event((iPlayableService*)this, evSeekableStatusChanged); return 0; } -- 2.30.2