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, InfoBarRedButton, \
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, InfoBarRedButton,
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...")),
48 "showSubtitle":(self.showSubtitle, _("Show the Subtitle...")),
53 for x in HelpableScreen, \
54 InfoBarBase, InfoBarShowHide, \
55 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
56 InfoBarInstantRecord, InfoBarAudioSelection, InfoBarRedButton, InfoBarUnhandledKey, \
57 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
58 InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
59 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \
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
72 assert InfoBar.instance is None, "class InfoBar is a singleton class and just one instance of this class is allowed!"
73 InfoBar.instance = self
76 InfoBar.instance = None
78 def __eventInfoChanged(self):
80 service = self.session.nav.getCurrentService()
81 old_begin_time = self.current_begin_time
82 info = service and service.info()
83 ptr = info and info.getEvent(0)
84 self.current_begin_time = ptr and ptr.getBeginTime() or 0
85 if config.usage.show_infobar_on_event_change.value:
86 if old_begin_time and old_begin_time != self.current_begin_time:
89 def __checkServiceStarted(self):
90 self.__serviceStarted(True)
91 self.onExecBegin.remove(self.__checkServiceStarted)
93 def serviceStarted(self): #override from InfoBarShowHide
94 new = self.servicelist.newServicePlayed()
96 InfoBarShowHide.serviceStarted(self)
97 self.current_begin_time=0
98 elif not self.__checkServiceStarted in self.onShown and new:
99 self.onShown.append(self.__checkServiceStarted)
101 def __checkServiceStarted(self):
102 self.serviceStarted()
103 self.onShown.remove(self.__checkServiceStarted)
106 self.showTvChannelList(True)
109 if config.usage.e1like_radio_mode.value:
110 self.showRadioChannelList(True)
112 self.rds_display.hide() # in InfoBarRdsDecoder
113 from Screens.ChannelSelection import ChannelSelectionRadio
114 self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
116 def ChannelSelectionRadioClosed(self, *arg):
117 self.rds_display.show() # in InfoBarRdsDecoder
119 def showMovies(self):
120 from Screens.MovieSelection import MovieSelection
121 self.session.openWithCallback(self.movieSelected, MovieSelection)
123 def movieSelected(self, service):
124 if service is not None:
125 self.session.open(MoviePlayer, service)
127 def showSubtitle(self):
128 from Screens.Subtitles import Subtitles
129 self.session.open(Subtitles)
131 class MoviePlayer(InfoBarBase, InfoBarShowHide, \
133 InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
134 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
135 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
136 InfoBarServiceErrorPopupSupport, InfoBarExtensions, InfoBarPlugins, InfoBarPiP):
138 ENABLE_RESUME_SUPPORT = True
141 def __init__(self, session, service):
142 Screen.__init__(self, session)
144 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
146 "showSubtitle":(self.showSubtitle, _("Show the Subtitle...")),
147 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
150 self.allowPiP = False
152 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
153 InfoBarBase, InfoBarSeek, InfoBarShowMovies, \
154 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
155 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
156 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \
157 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport, InfoBarExtensions, \
158 InfoBarPlugins, InfoBarPiP:
161 self.lastservice = session.nav.getCurrentlyPlayingServiceReference()
162 session.nav.playService(service)
163 self.returning = False
164 self.onClose.append(self.__onClose)
167 self.session.nav.playService(self.lastservice)
169 def handleLeave(self, how):
170 self.is_closing = True
172 if config.usage.setup_level.index < 2: # -expert
175 (_("No"), "continue")
180 (_("Yes, returning to movie list"), "movielist"),
181 (_("Yes, and delete this movie"), "quitanddelete"),
182 (_("No"), "continue"),
183 (_("No, but restart from begin"), "restart")
186 from Screens.ChoiceBox import ChoiceBox
187 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
189 self.leavePlayerConfirmed([True, how])
191 def leavePlayer(self):
192 self.handleLeave(config.usage.on_movie_stop.value)
194 def deleteConfirmed(self, answer):
196 self.leavePlayerConfirmed((True, "quitanddeleteconfirmed"))
198 def leavePlayerConfirmed(self, answer):
199 answer = answer and answer[1]
201 if answer in ("quitanddelete", "quitanddeleteconfirmed"):
202 ref = self.session.nav.getCurrentlyPlayingServiceReference()
203 from enigma import eServiceCenter
204 serviceHandler = eServiceCenter.getInstance()
205 info = serviceHandler.info(ref)
206 name = info and info.getName(ref) or _("this recording")
208 if answer == "quitanddelete":
209 from Screens.MessageBox import MessageBox
210 self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % name)
213 elif answer == "quitanddeleteconfirmed":
214 offline = serviceHandler.offlineOperations(ref)
215 if offline.deleteFromDisk(0):
216 from Screens.MessageBox import MessageBox
217 self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)
220 if answer in ("quit", "quitanddeleteconfirmed"):
222 elif answer == "movielist":
223 ref = self.session.nav.getCurrentlyPlayingServiceReference()
224 self.returning = True
225 from Screens.MovieSelection import MovieSelection
226 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
227 self.session.nav.stopService()
228 elif answer == "restart":
230 self.setSeekState(self.SEEK_STATE_PLAY)
232 def doEofInternal(self, playing):
237 self.handleLeave(config.usage.on_movie_eof.value)
239 def showMovies(self):
240 ref = self.session.nav.getCurrentlyPlayingServiceReference()
241 from Screens.MovieSelection import MovieSelection
242 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
244 def movieSelected(self, service):
245 if service is not None:
246 self.is_closing = False
247 self.session.nav.playService(service)
248 self.returning = False
252 def showSubtitle(self):
253 from Screens.Subtitles import Subtitles
254 self.session.open(Subtitles)