1 from Tools.Profile import profile, profile_final
3 from Screen import Screen
6 from enigma import iPlayableService
8 profile("LOAD:ChannelSelectionRadio")
9 from Screens.ChannelSelection import ChannelSelectionRadio
10 profile("LOAD:MovieSelection")
11 from Screens.MovieSelection import MovieSelection
12 profile("LOAD:ChoiceBox")
13 from Screens.ChoiceBox import ChoiceBox
15 profile("LOAD:InfoBarGenerics")
16 from Screens.InfoBarGenerics import InfoBarShowHide, \
17 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
18 InfoBarEPG, InfoBarSeek, InfoBarInstantRecord, \
19 InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
20 InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift, \
21 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
22 InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
23 InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport
25 profile("LOAD:InitBar_Components")
26 from Components.ActionMap import HelpableActionMap
27 from Components.config import config
28 from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
30 profile("LOAD:HelpableScreen")
31 from Screens.HelpMenu import HelpableScreen
33 class InfoBar(InfoBarBase, InfoBarShowHide,
34 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
35 InfoBarInstantRecord, InfoBarAudioSelection,
36 HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
37 InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek,
38 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
39 InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport,
44 def __init__(self, session):
45 Screen.__init__(self, session)
46 self["actions"] = HelpableActionMap(self, "InfobarActions",
48 "showMovies": (self.showMovies, _("Play recorded movies...")),
49 "showRadio": (self.showRadio, _("Show the radio player...")),
50 "showTv": (self.showTv, _("Show the tv player...")),
53 for x in HelpableScreen, \
54 InfoBarBase, InfoBarShowHide, \
55 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
56 InfoBarInstantRecord, InfoBarAudioSelection, \
57 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
58 InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
59 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \
60 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
63 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
64 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
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(InfoBarBase, InfoBarShowHide, \
122 InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
123 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
124 InfoBarMoviePlayerSummarySupport, 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 InfoBarBase, InfoBarSeek, InfoBarShowMovies, \
140 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
141 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
142 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \
143 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
146 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
147 self.session.nav.playService(service)
148 self.returning = False
150 def leavePlayer(self):
151 self.is_closing = True
153 if config.usage.on_movie_stop.value == "ask":
155 list.append((_("Yes"), "quit"))
156 if config.usage.setup_level.index >= 2: # expert+
157 list.append((_("Yes, returning to movie list"), "movielist"))
158 list.append((_("No"), "continue"))
159 if config.usage.setup_level.index >= 2: # expert+
160 list.append((_("No, but restart from begin"), "restart"))
161 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
163 self.leavePlayerConfirmed([True, config.usage.on_movie_stop.value])
165 def leavePlayerConfirmed(self, answer):
166 answer = answer and answer[1]
168 self.session.nav.playService(self.lastservice)
169 config.movielist.last_videodir.cancel()
171 elif answer == "movielist":
172 ref = self.session.nav.getCurrentlyPlayingServiceReference()
173 self.returning = True
174 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
175 self.session.nav.playService(self.lastservice)
176 elif answer == "restart":
179 def doEofInternal(self, playing):
184 self.is_closing = True
185 if config.usage.on_movie_eof.value == "ask":
187 list.append((_("Yes"), "quit"))
188 if config.usage.setup_level.index >= 2: # expert+
189 list.append((_("Yes, returning to movie list"), "movielist"))
190 list.append((_("No"), "continue"))
191 if config.usage.setup_level.index >= 2: # expert+
192 list.append((_("No, but restart from begin"), "restart"))
193 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
195 self.leavePlayerConfirmed([True, config.usage.on_movie_eof.value])
197 def showMovies(self):
198 ref = self.session.nav.getCurrentlyPlayingServiceReference()
199 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
201 def movieSelected(self, service):
202 if service is not None:
203 self.is_closing = False
204 self.session.nav.playService(service)
205 self.returning = False