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...")),
48 # ikseong action for subtitle hotkey
49 "showSubtitle":(self.showSubtitle, _("Show the Subtitle...")),
54 for x in HelpableScreen, \
55 InfoBarBase, InfoBarShowHide, \
56 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
57 InfoBarInstantRecord, InfoBarAudioSelection, InfoBarUnhandledKey, \
58 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
59 InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
60 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \
61 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
64 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
65 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
67 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
69 iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
72 self.current_begin_time=0
73 assert InfoBar.instance is None, "class InfoBar is a singleton class and just one instance of this class is allowed!"
74 InfoBar.instance = self
77 InfoBar.instance = None
79 def __eventInfoChanged(self):
81 service = self.session.nav.getCurrentService()
82 old_begin_time = self.current_begin_time
83 info = service and service.info()
84 ptr = info and info.getEvent(0)
85 self.current_begin_time = ptr and ptr.getBeginTime() or 0
86 if config.usage.show_infobar_on_event_change.value:
87 if old_begin_time and old_begin_time != self.current_begin_time:
90 def __checkServiceStarted(self):
91 self.__serviceStarted(True)
92 self.onExecBegin.remove(self.__checkServiceStarted)
94 def serviceStarted(self): #override from InfoBarShowHide
95 new = self.servicelist.newServicePlayed()
97 InfoBarShowHide.serviceStarted(self)
98 self.current_begin_time=0
99 elif not self.__checkServiceStarted in self.onShown and new:
100 self.onShown.append(self.__checkServiceStarted)
102 def __checkServiceStarted(self):
103 self.serviceStarted()
104 self.onShown.remove(self.__checkServiceStarted)
107 self.showTvChannelList(True)
110 if config.usage.e1like_radio_mode.value:
111 self.showRadioChannelList(True)
113 self.rds_display.hide() # in InfoBarRdsDecoder
114 from Screens.ChannelSelection import ChannelSelectionRadio
115 self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
117 def ChannelSelectionRadioClosed(self, *arg):
118 self.rds_display.show() # in InfoBarRdsDecoder
120 def showMovies(self):
121 from Screens.MovieSelection import MovieSelection
122 self.session.openWithCallback(self.movieSelected, MovieSelection)
124 def movieSelected(self, service):
125 if service is not None:
126 self.session.open(MoviePlayer, service)
128 # ikseong action for subtitle hotkey
129 def showSubtitle(self):
130 from Screens.Subtitles import Subtitles
131 self.session.open(Subtitles)
133 class MoviePlayer(InfoBarBase, InfoBarShowHide, \
135 InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
136 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
137 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
138 InfoBarServiceErrorPopupSupport, InfoBarExtensions, InfoBarPlugins, InfoBarPiP):
140 ENABLE_RESUME_SUPPORT = True
143 def __init__(self, session, service):
144 Screen.__init__(self, session)
146 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
148 # ikseong action for subtitle hotkey
149 "showSubtitle":(self.showSubtitle, _("Show the Subtitle...")),
150 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
153 self.allowPiP = False
155 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
156 InfoBarBase, InfoBarSeek, InfoBarShowMovies, \
157 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
158 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
159 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \
160 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport, InfoBarExtensions, \
161 InfoBarPlugins, InfoBarPiP:
164 self.lastservice = session.nav.getCurrentlyPlayingServiceReference()
165 session.nav.playService(service)
166 self.returning = False
167 self.onClose.append(self.__onClose)
170 self.session.nav.playService(self.lastservice)
172 def handleLeave(self, how):
173 self.is_closing = True
175 if config.usage.setup_level.index < 2: # -expert
178 (_("No"), "continue")
183 (_("Yes, returning to movie list"), "movielist"),
184 (_("Yes, and delete this movie"), "quitanddelete"),
185 (_("No"), "continue"),
186 (_("No, but restart from begin"), "restart")
189 from Screens.ChoiceBox import ChoiceBox
190 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
192 self.leavePlayerConfirmed([True, how])
194 def leavePlayer(self):
195 self.handleLeave(config.usage.on_movie_stop.value)
197 def deleteConfirmed(self, answer):
199 self.leavePlayerConfirmed((True, "quitanddeleteconfirmed"))
201 def leavePlayerConfirmed(self, answer):
202 answer = answer and answer[1]
204 if answer in ("quitanddelete", "quitanddeleteconfirmed"):
205 ref = self.session.nav.getCurrentlyPlayingServiceReference()
206 from enigma import eServiceCenter
207 serviceHandler = eServiceCenter.getInstance()
208 info = serviceHandler.info(ref)
209 name = info and info.getName(ref) or _("this recording")
211 if answer == "quitanddelete":
212 from Screens.MessageBox import MessageBox
213 self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % name)
216 elif answer == "quitanddeleteconfirmed":
217 offline = serviceHandler.offlineOperations(ref)
218 if offline.deleteFromDisk(0):
219 from Screens.MessageBox import MessageBox
220 self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)
223 if answer in ("quit", "quitanddeleteconfirmed"):
225 elif answer == "movielist":
226 ref = self.session.nav.getCurrentlyPlayingServiceReference()
227 self.returning = True
228 from Screens.MovieSelection import MovieSelection
229 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
230 self.session.nav.stopService()
231 elif answer == "restart":
233 self.setSeekState(self.SEEK_STATE_PLAY)
235 def doEofInternal(self, playing):
240 self.handleLeave(config.usage.on_movie_eof.value)
242 def showMovies(self):
243 ref = self.session.nav.getCurrentlyPlayingServiceReference()
244 from Screens.MovieSelection import MovieSelection
245 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
247 def movieSelected(self, service):
248 if service is not None:
249 self.is_closing = False
250 self.session.nav.playService(service)
251 self.returning = False
255 # ikseong action for subtitle hotkey
256 def showSubtitle(self):
257 from Screens.Subtitles import Subtitles
258 self.session.open(Subtitles)