send evStart before tuneFailed Events..
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 30 Dec 2006 15:07:29 +0000 (15:07 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 30 Dec 2006 15:07:29 +0000 (15:07 +0000)
fix evNoResources
fix some bluescreens caused by notification handling

lib/dvb/pmt.cpp
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/MessageBox.py
lib/python/Screens/Screen.py
lib/python/Tools/Notifications.py
lib/service/servicedvb.cpp

index 4b0acdf..8db4ba9 100644 (file)
@@ -544,7 +544,7 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
                }
        } else
        {
-               serviceEvent(eventTuneFailed);
+               serviceEvent(eventNoResources);
                return res;
        }
 
index 9e8e20b..0fdc646 100644 (file)
@@ -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:
index 33d51b2..b16b873 100644 (file)
@@ -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()
index 989f90a..5349291 100644 (file)
@@ -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)
index 26c2a60..0410a4e 100644 (file)
@@ -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)
index ea014a1..254c12f 100644 (file)
@@ -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;
 }