fix subservicequickzap
[enigma2.git] / lib / python / Screens / Scart.py
1 from Screen import Screen
2 from MessageBox import MessageBox
3 from Components.AVSwitch import AVSwitch
4
5 class Scart(Screen):
6         def __init__(self, session, start_visible=True):
7                 Screen.__init__(self, session)
8
9                 self.avswitch = AVSwitch()
10
11                 if start_visible:
12                         self.onExecBegin.append(self.showMessageBox)
13                         self.msgVisible = None
14                 else:
15                         self.msgVisible = False
16
17         def showMessageBox(self):
18                 if self.msgVisible is None:
19                         self.onExecBegin.remove(self.showMessageBox)
20                         self.msgVisible = False
21
22                 if not self.msgVisible:
23                         self.msgVisible = True
24                         self.avswitch.setInput("SCART")
25                         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)
26
27         def MsgBoxClosed(self, *val):
28                 self.msgBox = None
29                 self.switchToTV()
30
31         def switchToTV(self, *val):
32                 if self.msgVisible:
33                         if self.msgBox:
34                                 self.msgBox.close() # ... MsgBoxClosed -> switchToTV again..
35                                 return
36                         self.avswitch.setInput("ENCODER")
37                         self.msgVisible = False