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, InfoBarEvent, InfoBarServiceName, InfoBarSeek, InfoBarInstantRecord, \
19 InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
20 InfoBarSubserviceSelection, InfoBarTuner, 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.Sources.Source import ObsoleteSource
27 from Components.ActionMap import HelpableActionMap
28 from Components.config import config
29 from Components.ServiceEventTracker import ServiceEventTracker
31 profile("LOAD:HelpableScreen")
32 from Screens.HelpMenu import HelpableScreen
34 class InfoBar(InfoBarShowHide,
35 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
36 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection,
37 HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
38 InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
39 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
40 InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport,
45 def __init__(self, session):
46 Screen.__init__(self, session)
48 self["actions"] = HelpableActionMap(self, "InfobarActions",
50 "showMovies": (self.showMovies, _("Play recorded movies...")),
51 "showRadio": (self.showRadio, _("Show the radio player...")),
52 "showTv": (self.showTv, _("Show the tv player...")),
55 for x in HelpableScreen, \
57 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
58 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
59 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
60 InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
61 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \
62 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
65 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
66 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
68 self["CurrentTime"] = ObsoleteSource(new_source = "global.CurrentTime", removal_date = "2008-01")
70 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
72 iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
75 self.current_begin_time=0
77 def __eventInfoChanged(self):
79 service = self.session.nav.getCurrentService()
80 old_begin_time = self.current_begin_time
81 info = service and service.info()
82 ptr = info and info.getEvent(0)
83 self.current_begin_time = ptr and ptr.getBeginTime() or 0
84 if config.usage.show_infobar_on_event_change.value:
85 if old_begin_time and old_begin_time != self.current_begin_time:
88 def __checkServiceStarted(self):
89 self.__serviceStarted(True)
90 self.onExecBegin.remove(self.__checkServiceStarted)
92 def serviceStarted(self): #override from InfoBarShowHide
93 new = self.servicelist.newServicePlayed()
95 InfoBarShowHide.serviceStarted(self)
96 self.current_begin_time=0
97 elif not self.__checkServiceStarted in self.onShown and new:
98 self.onShown.append(self.__checkServiceStarted)
100 def __checkServiceStarted(self):
101 self.serviceStarted()
102 self.onShown.remove(self.__checkServiceStarted)
105 self.showTvChannelList(True)
108 if config.usage.e1like_radio_mode.value:
109 self.showRadioChannelList(True)
111 self.rds_display.hide() # in InfoBarRdsDecoder
112 self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
114 def ChannelSelectionRadioClosed(self, *arg):
115 self.rds_display.show() # in InfoBarRdsDecoder
117 def showMovies(self):
118 self.session.openWithCallback(self.movieSelected, MovieSelection)
120 def movieSelected(self, service):
121 if service is not None:
122 self.session.open(MoviePlayer, service)
124 class MoviePlayer(InfoBarShowHide, \
126 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
127 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
128 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
129 InfoBarServiceErrorPopupSupport):
131 ENABLE_RESUME_SUPPORT = True
134 def __init__(self, session, service):
135 Screen.__init__(self, session)
137 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
139 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
142 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
143 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
144 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
145 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
146 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \
147 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
150 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
151 self.session.nav.playService(service)
152 self.returning = False
154 def leavePlayer(self):
155 self.is_closing = True
157 if config.usage.on_movie_stop.value == "ask":
159 list.append((_("Yes"), "quit"))
160 if config.usage.setup_level.index >= 2: # expert+
161 list.append((_("Yes, returning to movie list"), "movielist"))
162 list.append((_("No"), "continue"))
163 if config.usage.setup_level.index >= 2: # expert+
164 list.append((_("No, but restart from begin"), "restart"))
165 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
167 self.leavePlayerConfirmed([True, config.usage.on_movie_stop.value])
169 def leavePlayerConfirmed(self, answer):
170 answer = answer and answer[1]
172 self.session.nav.playService(self.lastservice)
173 config.movielist.last_videodir.cancel()
175 elif answer == "movielist":
176 ref = self.session.nav.getCurrentlyPlayingServiceReference()
177 self.returning = True
178 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
179 self.session.nav.playService(self.lastservice)
180 elif answer == "restart":
183 def doEofInternal(self, playing):
186 self.is_closing = True
187 if config.usage.on_movie_eof.value == "ask":
189 list.append((_("Yes"), "quit"))
190 if config.usage.setup_level.index >= 2: # expert+
191 list.append((_("Yes, returning to movie list"), "movielist"))
192 list.append((_("No"), "continue"))
193 if config.usage.setup_level.index >= 2: # expert+
194 list.append((_("No, but restart from begin"), "restart"))
195 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
197 self.leavePlayerConfirmed([True, config.usage.on_movie_eof.value])
199 def showMovies(self):
200 ref = self.session.nav.getCurrentlyPlayingServiceReference()
201 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
203 def movieSelected(self, service):
204 if service is not None:
205 self.is_closing = False
206 self.session.nav.playService(service)
207 self.returning = False