1 from Screen import Screen
3 from Screens.MovieSelection import MovieSelection
4 from Screens.ChannelSelection import ChannelSelectionRadio
5 from Screens.MessageBox import MessageBox
6 from Screens.Ci import CiHandler
8 from Components.Sources.Clock import Clock
9 from Components.ActionMap import HelpableActionMap
10 from Components.config import config
11 from Components.ServiceEventTracker import ServiceEventTracker
13 from Tools.Notifications import AddNotificationWithCallback
15 from Screens.InfoBarGenerics import InfoBarShowHide, \
16 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
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
24 from Screens.HelpMenu import HelpableScreen, HelpMenu
26 from enigma import iPlayableService
28 class InfoBar(InfoBarShowHide,
29 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
30 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection,
31 HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
32 InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
33 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
34 InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport,
39 def __init__(self, session):
40 Screen.__init__(self, session)
42 CiHandler.setSession(session)
44 self["actions"] = HelpableActionMap(self, "InfobarActions",
46 "showMovies": (self.showMovies, _("Play recorded movies...")),
47 "showRadio": (self.showRadio, _("Show the radio player...")),
48 "showTv": (self.showTv, _("Show the tv player...")),
51 for x in HelpableScreen, \
53 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
54 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
55 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
56 InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
57 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \
58 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
61 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
62 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
64 self["CurrentTime"] = Clock()
66 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
68 iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
71 self.current_begin_time=0
73 def __eventInfoChanged(self):
75 service = self.session.nav.getCurrentService()
76 old_begin_time = self.current_begin_time
77 info = service and service.info()
78 ptr = info and info.getEvent(0)
79 self.current_begin_time = ptr and ptr.getBeginTime() or 0
80 if config.usage.show_infobar_on_event_change.value:
81 if old_begin_time and old_begin_time != self.current_begin_time:
84 def __checkServiceStarted(self):
85 self.__serviceStarted(True)
86 self.onExecBegin.remove(self.__checkServiceStarted)
88 def serviceStarted(self): #override from InfoBarShowHide
89 new = self.servicelist.newServicePlayed()
91 InfoBarShowHide.serviceStarted(self)
92 self.current_begin_time=0
93 elif not self.__checkServiceStarted in self.onShown and new:
94 self.onShown.append(self.__checkServiceStarted)
96 def __checkServiceStarted(self):
98 self.onShown.remove(self.__checkServiceStarted)
101 self.showTvChannelList(True)
104 if config.usage.e1like_radio_mode.value:
105 self.showRadioChannelList(True)
107 self.rds_display.hide() # in InfoBarRdsDecoder
108 self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
110 def ChannelSelectionRadioClosed(self, *arg):
111 self.rds_display.show() # in InfoBarRdsDecoder
113 def showMovies(self):
114 self.session.openWithCallback(self.movieSelected, MovieSelection)
116 def movieSelected(self, service):
117 if service is not None:
118 self.session.open(MoviePlayer, service)
120 class MoviePlayer(InfoBarShowHide, \
122 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
123 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
124 InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
125 InfoBarServiceErrorPopupSupport):
127 ENABLE_RESUME_SUPPORT = True
130 def __init__(self, session, service):
131 Screen.__init__(self, session)
133 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
135 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
138 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
139 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
140 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
141 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
142 InfoBarSummarySupport, InfoBarSubtitleSupport, \
143 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
146 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
147 self.session.nav.playService(service)
149 def leavePlayer(self):
150 self.is_closing = True
151 self.session.openWithCallback(self.leavePlayerConfirmed, MessageBox, _("Stop playing this movie?"))
153 def leavePlayerConfirmed(self, answer):
155 self.session.nav.playService(self.lastservice)
158 def showMovies(self):
159 ref = self.session.nav.getCurrentlyPlayingServiceReference()
160 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
162 def movieSelected(self, service):
163 if service is not None:
164 self.session.nav.playService(service)