1 from Screen import Screen
2 from MessageBox import MessageBox
3 from Components.AVSwitch import AVSwitch
4 from Tools import Notifications
7 def __init__(self, session, start_visible=True):
8 Screen.__init__(self, session)
10 self.notificationVisible = None
12 self.avswitch = AVSwitch()
15 self.onExecBegin.append(self.showMessageBox)
16 self.msgVisible = None
18 self.msgVisible = False
20 def showMessageBox(self):
21 if self.msgVisible is None:
22 self.onExecBegin.remove(self.showMessageBox)
23 self.msgVisible = False
25 if not self.msgVisible:
26 self.msgVisible = True
27 self.avswitch.setInput("SCART")
28 if not self.session.in_exec:
29 self.notificationVisible = True
30 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")
32 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)
34 def MsgBoxClosed(self, *val):
38 def switchToTV(self, *val):
41 self.msgBox.close() # ... MsgBoxClosed -> switchToTV again..
43 self.avswitch.setInput("ENCODER")
44 self.msgVisible = False
45 if self.notificationVisible:
46 self.avswitch.setInput("ENCODER")
47 self.notificationVisible = False
48 for notification in Notifications.current_notifications:
50 if notification[1].msgBoxID == "scart_msgbox":
51 notification[1].close()
53 print "other notification is open. try another one."