1 from Tools.Profile import profile
3 # workaround for required config entry dependencies.
4 from Screens.MovieSelection import MovieSelection
6 from Screen import Screen
9 from enigma import iPlayableService
11 profile("LOAD:InfoBarGenerics")
12 from Screens.InfoBarGenerics import InfoBarShowHide, \
13 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
14 InfoBarEPG, InfoBarSeek, InfoBarInstantRecord, \
15 InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey, \
16 InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift, \
17 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
18 InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
19 InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarServiceErrorPopupSupport, InfoBarJobman
21 profile("LOAD:InitBar_Components")
22 from Components.ActionMap import HelpableActionMap
23 from Components.config import config
24 from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
26 profile("LOAD:HelpableScreen")
27 from Screens.HelpMenu import HelpableScreen
29 class InfoBar(InfoBarBase, InfoBarShowHide,
30 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
31 InfoBarInstantRecord, InfoBarAudioSelection,
32 HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarUnhandledKey,
33 InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek,
34 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
35 InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarServiceErrorPopupSupport, InfoBarJobman,
41 def __init__(self, session):
42 Screen.__init__(self, session)
43 self["actions"] = HelpableActionMap(self, "InfobarActions",
45 "showMovies": (self.showMovies, _("Play recorded movies...")),
46 "showRadio": (self.showRadio, _("Show the radio player...")),
47 "showTv": (self.showTv, _("Show the tv player...")),
52 for x in HelpableScreen, \
53 InfoBarBase, InfoBarShowHide, \
54 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
55 InfoBarInstantRecord, InfoBarAudioSelection, InfoBarUnhandledKey, \
56 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
57 InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
58 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \
59 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
62 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
63 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
65 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
67 iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
70 self.current_begin_time=0
71 assert InfoBar.instance is None, "class InfoBar is a singleton class and just one instance of this class is allowed!"
72 InfoBar.instance = self
75 InfoBar.instance = None
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 from Screens.ChannelSelection import ChannelSelectionRadio
113 self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
115 def ChannelSelectionRadioClosed(self, *arg):
116 self.rds_display.show() # in InfoBarRdsDecoder
118 def showMovies(self):
119 from Screens.MovieSelection import MovieSelection
120 self.session.openWithCallback(self.movieSelected, MovieSelection)
122 def movieSelected(self, service):
123 if service is not None:
124 self.session.open(MoviePlayer, service)
126 class MoviePlayer(InfoBarBase, InfoBarShowHide, \
128 InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
129 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
130 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
131 InfoBarServiceErrorPopupSupport, InfoBarExtensions, InfoBarPlugins, InfoBarPiP):
133 ENABLE_RESUME_SUPPORT = True
136 def __init__(self, session, service):
137 Screen.__init__(self, session)
139 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
141 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
144 self.allowPiP = False
146 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
147 InfoBarBase, InfoBarSeek, InfoBarShowMovies, \
148 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
149 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
150 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \
151 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport, InfoBarExtensions, \
152 InfoBarPlugins, InfoBarPiP:
155 self.lastservice = session.nav.getCurrentlyPlayingServiceReference()
156 session.nav.playService(service)
157 self.returning = False
158 self.onClose.append(self.__onClose)
161 self.session.nav.playService(self.lastservice)
163 def handleLeave(self, how):
164 self.is_closing = True
166 if config.usage.setup_level.index < 2: # -expert
169 (_("No"), "continue")
174 (_("Yes, returning to movie list"), "movielist"),
175 (_("Yes, and delete this movie"), "quitanddelete"),
176 (_("No"), "continue"),
177 (_("No, but restart from begin"), "restart")
180 from Screens.ChoiceBox import ChoiceBox
181 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
183 self.leavePlayerConfirmed([True, how])
185 def leavePlayer(self):
186 self.handleLeave(config.usage.on_movie_stop.value)
188 def deleteConfirmed(self, answer):
190 self.leavePlayerConfirmed((True, "quitanddeleteconfirmed"))
192 def leavePlayerConfirmed(self, answer):
193 answer = answer and answer[1]
195 if answer in ("quitanddelete", "quitanddeleteconfirmed"):
196 ref = self.session.nav.getCurrentlyPlayingServiceReference()
197 from enigma import eServiceCenter
198 serviceHandler = eServiceCenter.getInstance()
199 info = serviceHandler.info(ref)
200 name = info and info.getName(ref) or _("this recording")
202 if answer == "quitanddelete":
203 from Screens.MessageBox import MessageBox
204 self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % name)
207 elif answer == "quitanddeleteconfirmed":
208 offline = serviceHandler.offlineOperations(ref)
209 if offline.deleteFromDisk(0):
210 from Screens.MessageBox import MessageBox
211 self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)
214 if answer in ("quit", "quitanddeleteconfirmed"):
216 elif answer == "movielist":
217 ref = self.session.nav.getCurrentlyPlayingServiceReference()
218 self.returning = True
219 from Screens.MovieSelection import MovieSelection
220 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
221 self.session.nav.stopService()
222 elif answer == "restart":
225 def doEofInternal(self, playing):
230 self.handleLeave(config.usage.on_movie_eof.value)
232 def showMovies(self):
233 ref = self.session.nav.getCurrentlyPlayingServiceReference()
234 from Screens.MovieSelection import MovieSelection
235 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
237 def movieSelected(self, service):
238 if service is not None:
239 self.is_closing = False
240 self.session.nav.playService(service)
241 self.returning = False