X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/389ae07e59aaf1b8e504801cd49409072f7d3b6b..58965c6783464b3390b7ad0687f4ed4a559f9ce2:/lib/python/Screens/Scart.py diff --git a/lib/python/Screens/Scart.py b/lib/python/Screens/Scart.py index 50e65f17..00e78593 100644 --- a/lib/python/Screens/Scart.py +++ b/lib/python/Screens/Scart.py @@ -1,23 +1,54 @@ from Screen import Screen from MessageBox import MessageBox - from Components.AVSwitch import AVSwitch - -from enigma import * +from Tools import Notifications class Scart(Screen): - def __init__(self, session): + def __init__(self, session, start_visible=True): Screen.__init__(self, session) - + self.msgBox = None + self.notificationVisible = None + self.avswitch = AVSwitch() - - self.avswitch.setInput("SCART") - - self.onShown.append(self.showMessageBox) - + + if start_visible: + self.onExecBegin.append(self.showMessageBox) + self.msgVisible = None + else: + self.msgVisible = False + def showMessageBox(self): - self.session.openWithCallback(self.switchToTV, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR) - - def switchToTV(self, val): - self.avswitch.setInput("ENCODER") - self.close() \ No newline at end of file + if self.msgVisible is None: + self.onExecBegin.remove(self.showMessageBox) + self.msgVisible = False + + if not self.msgVisible: + self.msgVisible = True + self.avswitch.setInput("SCART") + if not self.session.in_exec: + self.notificationVisible = True + Notifications.AddNotificationWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR, msgBoxID = "scart_msgbox") + else: + self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR) + + def MsgBoxClosed(self, *val): + self.msgBox = None + self.switchToTV() + + def switchToTV(self, *val): + if self.msgVisible: + if self.msgBox: + self.msgBox.close() # ... MsgBoxClosed -> switchToTV again.. + return + self.avswitch.setInput("ENCODER") + self.msgVisible = False + if self.notificationVisible: + self.avswitch.setInput("ENCODER") + self.notificationVisible = False + for notification in Notifications.current_notifications: + try: + if notification[1].msgBoxID == "scart_msgbox": + notification[1].close() + except: + print "other notification is open. try another one." + \ No newline at end of file