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