add a radiomode background picture (mvi file.. changable in
[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, InfoBarRdsDecoder, \
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, InfoBarRdsDecoder,
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, InfoBarRdsDecoder, \
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.rds_display.hide() # in InfoBarRdsDecoder
71                         self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
72
73         def ChannelSelectionRadioClosed(self, *arg):
74                 self.rds_display.show()  # in InfoBarRdsDecoder
75
76         def showMovies(self):
77                 self.session.openWithCallback(self.movieSelected, MovieSelection)
78
79         def movieSelected(self, service):
80                 if service is not None:
81                         self.session.open(MoviePlayer, service)
82
83 class MoviePlayer(InfoBarShowHide, \
84                 InfoBarMenu, \
85                 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
86                 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
87                 InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarExtensions, InfoBarTeletextPlugin,
88                 InfoBarServiceErrorPopupSupport):
89
90         ENABLE_RESUME_SUPPORT = True
91         ALLOW_SUSPEND = True
92                 
93         def __init__(self, session, service):
94                 Screen.__init__(self, session)
95                 
96                 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
97                         {
98                                 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
99                         })
100                 
101                 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
102                                 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
103                                 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
104                                 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
105                                 InfoBarSummarySupport, InfoBarSubtitleSupport, InfoBarExtensions, \
106                                 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
107                         x.__init__(self)
108
109                 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
110                 self.session.nav.playService(service)
111
112         def leavePlayer(self):
113                 self.is_closing = True
114                 self.session.openWithCallback(self.leavePlayerConfirmed, MessageBox, _("Stop playing this movie?"))
115         
116         def leavePlayerConfirmed(self, answer):
117                 if answer == True:
118                         self.session.nav.playService(self.lastservice)
119                         self.close()
120                         
121         def showMovies(self):
122                 ref = self.session.nav.getCurrentlyPlayingServiceReference()
123                 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
124
125         def movieSelected(self, service):
126                 if service is not None:
127                         self.session.nav.playService(service)