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