revert local change
[enigma2.git] / lib / python / Screens / InfoBar.py
1 from Screen import Screen
2
3 from Screens.MovieSelection import MovieSelection
4 from Screens.ChannelSelection import ChannelSelectionRadio
5 from Screens.MessageBox import MessageBox
6 from Screens.Ci import CiHandler
7
8 from Components.Sources.Clock import Clock
9 from Components.ActionMap import HelpableActionMap
10 from Components.config import config
11
12 from Tools.Notifications import AddNotificationWithCallback
13
14 from Screens.InfoBarGenerics import InfoBarShowHide, \
15         InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRadioText, \
16         InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarSeek, InfoBarInstantRecord, \
17         InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
18         InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift,  \
19         InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
20         InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
21         InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport
22
23 from Screens.HelpMenu import HelpableScreen, HelpMenu
24
25 class InfoBar(InfoBarShowHide,
26         InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRadioText,
27         InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, 
28         HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
29         InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
30         InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
31         InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport,
32         Screen):
33         
34         ALLOW_SUSPEND = True
35
36         def __init__(self, session):
37                 Screen.__init__(self, session)
38
39                 CiHandler.setSession(session)
40
41                 self["actions"] = HelpableActionMap(self, "InfobarActions",
42                         {
43                                 "showMovies": (self.showMovies, _("Play recorded movies...")),
44                                 "showRadio": (self.showRadio, _("Show the radio player...")),
45                                 "showTv": (self.showTv, _("Show the tv player...")),
46                         }, prio=2)
47                 
48                 for x in HelpableScreen, \
49                                 InfoBarShowHide, \
50                                 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRadioText, \
51                                 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
52                                 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
53                                 InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
54                                 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \
55                                 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
56                         x.__init__(self)
57
58                 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
59                 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
60
61                 self["CurrentTime"] = Clock()
62
63         def showTv(self):
64                 self.showTvChannelList(True)
65
66         def showRadio(self):
67                 if config.usage.e1like_radio_mode.value:
68                         self.showRadioChannelList(True)
69                 else:
70                         self.session.open(ChannelSelectionRadio)
71
72         def showMovies(self):
73                 self.session.openWithCallback(self.movieSelected, MovieSelection)
74
75         def movieSelected(self, service):
76                 if service is not None:
77                         self.session.open(MoviePlayer, service)
78
79 class MoviePlayer(InfoBarShowHide, \
80                 InfoBarMenu, \
81                 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
82                 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
83                 InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarExtensions, InfoBarTeletextPlugin,
84                 InfoBarServiceErrorPopupSupport):
85
86         ENABLE_RESUME_SUPPORT = True
87         ALLOW_SUSPEND = True
88                 
89         def __init__(self, session, service):
90                 Screen.__init__(self, session)
91                 
92                 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
93                         {
94                                 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
95                         })
96                 
97                 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
98                                 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
99                                 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
100                                 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
101                                 InfoBarSummarySupport, InfoBarSubtitleSupport, InfoBarExtensions, \
102                                 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
103                         x.__init__(self)
104
105                 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
106                 self.session.nav.playService(service)
107
108         def leavePlayer(self):
109                 self.is_closing = True
110                 self.session.openWithCallback(self.leavePlayerConfirmed, MessageBox, _("Stop playing this movie?"))
111         
112         def leavePlayerConfirmed(self, answer):
113                 if answer == True:
114                         self.session.nav.playService(self.lastservice)
115                         self.close()
116                         
117         def showMovies(self):
118                 ref = self.session.nav.getCurrentlyPlayingServiceReference()
119                 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
120
121         def movieSelected(self, service):
122                 if service is not None:
123                         self.session.nav.playService(service)