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 4b0acdfacf6464ce349b5cd4e132050944b7f7a9..8db4ba9f9a8d313783d29bc7deaaf00d3618df48 100644 (file)
@@ -544,7 +544,7 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
                }
        } else
        {
-               serviceEvent(eventTuneFailed);
+               serviceEvent(eventNoResources);
                return res;
        }
 
index 9e8e20b65ce2179554c207ae573ac58ae81b4551..0fdc6468517152bdd736421d9588a7d9562c4ddf 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 33d51b24212731d8058ee422e08a7bf0092de512..b16b8730d3320dfdb6b1411b81a85d107063805d 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 989f90a9e6a5d9dfc6185ecf91955090bee06e2b..53492918b4bf240a74a114f493953a1feec124f8 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 26c2a607f98aa85135784346599c025fc6bc997f..0410a4e2d18bcfaa4fe55995829b6c5cc6786a84 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 ea014a19f61702ab07307793417243722d041e3d..254c12fd41ab62d1fc83446e7f21cb7d16ddaecd 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;
 }