Merge branch 'enable_experimental_m2ts_support' into experimental
[enigma2.git] / lib / python / Screens / Standby.py
index 4a9dca4046fa7bbe0320cd0c600c836e5fa5c504..c598b5459b9209d7ca705ed5d0f93b5e170b740a 100644 (file)
@@ -46,16 +46,18 @@ class Standby(Screen):
                #mute adc
                self.setMute()
 
-               if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS:
-                       #get currently playing service reference
-                       self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceReference()
-                       #stop actual played dvb-service
-                       self.session.nav.stopService()
-                       self.paused_service = None
-               elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES:
-                       self.paused_service = self.session.current_dialog
-                       self.paused_service.pauseService()
-                       self.prev_running_service = None
+               self.paused_service = None
+               self.prev_running_service = None
+               if self.session.current_dialog:
+                       if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS:
+                               #get currently playing service reference
+                               self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceReference()
+                               #stop actual played dvb-service
+                               self.session.nav.stopService()
+                       elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES:
+                               self.paused_service = self.session.current_dialog
+                               self.paused_service.pauseService()
+
                #set input to vcr scart
                if SystemInfo["ScartSwitch"]:
                        self.avswitch.setInput("SCART")
@@ -63,28 +65,26 @@ class Standby(Screen):
                        self.avswitch.setInput("AUX")
                #set lcd brightness to standby value
                config.lcd.standby.apply()
-               self.onShow.append(self.__onShow)
-               self.onHide.append(self.__onHide)
+               self.onFirstExecBegin.append(self.__onFirstExecBegin)
                self.onClose.append(self.__onClose)
 
        def __onClose(self):
+               global inStandby
+               inStandby = None
                if self.prev_running_service:
                        self.session.nav.playService(self.prev_running_service)
                elif self.paused_service:
                        self.paused_service.unPauseService()
+               self.session.screen["Standby"].boolean = False
 
-       def createSummary(self):
-               return StandbySummary
-
-       def __onShow(self):
+       def __onFirstExecBegin(self):
                global inStandby
                inStandby = self
                self.session.screen["Standby"].boolean = True
+               config.misc.standbyCounter.value += 1
 
-       def __onHide(self):
-               global inStandby
-               inStandby = None
-               self.session.screen["Standby"].boolean = False
+       def createSummary(self):
+               return StandbySummary
 
 class StandbySummary(Screen):
        skin = """
@@ -160,9 +160,14 @@ class TryQuitMainloop(MessageBox):
                        self.conntected=False
                        self.session.nav.record_event.remove(self.getRecordEvent)
                if value:
-                       quitMainloop(self.retval)
-               else:
-                       MessageBox.close(self, True)
+                       # hack .. we dont like to show any other screens when this screen has closed
+                       self.onClose = [self.__closed]
+                       self.session.dialog_stack = []
+                       self.session.summary_stack = [None]
+               MessageBox.close(self, True)
+
+       def __closed(self):
+               quitMainloop(self.retval)
 
        def __onShow(self):
                global inTryQuitMainloop