1 from Tools.Profile import profile
3 from Screen import Screen
6 from enigma import iPlayableService
8 profile("LOAD:InfoBarGenerics")
9 from Screens.InfoBarGenerics import InfoBarShowHide, \
10 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
11 InfoBarEPG, InfoBarSeek, InfoBarInstantRecord, \
12 InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
13 InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift, \
14 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
15 InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
16 InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, InfoBarJobman
18 profile("LOAD:InitBar_Components")
19 from Components.ActionMap import HelpableActionMap
20 from Components.config import config
21 from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
23 profile("LOAD:HelpableScreen")
24 from Screens.HelpMenu import HelpableScreen
26 class InfoBar(InfoBarBase, InfoBarShowHide,
27 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
28 InfoBarInstantRecord, InfoBarAudioSelection,
29 HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
30 InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek,
31 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
32 InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, InfoBarJobman,
38 def __init__(self, session):
39 Screen.__init__(self, session)
40 self["actions"] = HelpableActionMap(self, "InfobarActions",
42 "showMovies": (self.showMovies, _("Play recorded movies...")),
43 "showRadio": (self.showRadio, _("Show the radio player...")),
44 "showTv": (self.showTv, _("Show the tv player...")),
47 for x in HelpableScreen, \
48 InfoBarBase, InfoBarShowHide, \
49 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
50 InfoBarInstantRecord, InfoBarAudioSelection, \
51 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
52 InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
53 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \
54 InfoBarSleepTimer, InfoBarPlugins, InfoBarServiceErrorPopupSupport:
57 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
58 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
60 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
62 iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
65 self.current_begin_time=0
66 assert InfoBar.instance is None, "class InfoBar is a singleton class and just one instance of this class is allowed!"
67 InfoBar.instance = self
70 InfoBar.instance = None
72 def __eventInfoChanged(self):
74 service = self.session.nav.getCurrentService()
75 old_begin_time = self.current_begin_time
76 info = service and service.info()
77 ptr = info and info.getEvent(0)
78 self.current_begin_time = ptr and ptr.getBeginTime() or 0
79 if config.usage.show_infobar_on_event_change.value:
80 if old_begin_time and old_begin_time != self.current_begin_time:
83 def __checkServiceStarted(self):
84 self.__serviceStarted(True)
85 self.onExecBegin.remove(self.__checkServiceStarted)
87 def serviceStarted(self): #override from InfoBarShowHide
88 new = self.servicelist.newServicePlayed()
90 InfoBarShowHide.serviceStarted(self)
91 self.current_begin_time=0
92 elif not self.__checkServiceStarted in self.onShown and new:
93 self.onShown.append(self.__checkServiceStarted)
95 def __checkServiceStarted(self):
97 self.onShown.remove(self.__checkServiceStarted)
100 self.showTvChannelList(True)
103 if config.usage.e1like_radio_mode.value:
104 self.showRadioChannelList(True)
106 self.rds_display.hide() # in InfoBarRdsDecoder
107 from Screens.ChannelSelection import ChannelSelectionRadio
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 from Screens.MovieSelection import MovieSelection
115 self.session.openWithCallback(self.movieSelected, MovieSelection)
117 def movieSelected(self, service):
118 if service is not None:
119 self.session.open(MoviePlayer, service)
121 class MoviePlayer(InfoBarBase, InfoBarShowHide, \
123 InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
124 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
125 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
126 InfoBarServiceErrorPopupSupport):
128 ENABLE_RESUME_SUPPORT = True
131 def __init__(self, session, service):
132 Screen.__init__(self, session)
134 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
136 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
139 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
140 InfoBarBase, InfoBarSeek, InfoBarShowMovies, \
141 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
142 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
143 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \
144 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
147 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
148 self.session.nav.playService(service)
149 self.returning = False
150 self.onClose.append(self.__onClose)
153 self.session.nav.playService(self.lastservice)
155 def handleLeave(self, how):
156 self.is_closing = True
159 list.append((_("Yes"), "quit"))
160 if config.usage.setup_level.index >= 2: # expert+
161 list.append((_("Yes, returning to movie list"), "movielist"))
162 if config.usage.setup_level.index >= 2: # expert+
163 list.append((_("Yes, and delete this movie"), "quitanddelete"))
164 list.append((_("No"), "continue"))
165 if config.usage.setup_level.index >= 2: # expert+
166 list.append((_("No, but restart from begin"), "restart"))
168 from Screens.ChoiceBox import ChoiceBox
169 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
171 self.leavePlayerConfirmed([True, how])
173 def leavePlayer(self):
174 self.handleLeave(config.usage.on_movie_stop.value)
176 def deleteConfirmed(self, answer):
178 self.leavePlayerConfirmed((True, "quitanddeleteconfirmed"))
180 def leavePlayerConfirmed(self, answer):
181 answer = answer and answer[1]
183 if answer in ["quitanddelete", "quitanddeleteconfirmed"]:
184 ref = self.session.nav.getCurrentlyPlayingServiceReference()
185 from enigma import eServiceCenter
186 serviceHandler = eServiceCenter.getInstance()
187 info = serviceHandler.info(ref)
188 name = info and info.getName(ref) or _("this recording")
190 if answer == "quitanddelete":
191 from Screens.MessageBox import MessageBox
192 self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % name)
195 if answer == "quitanddeleteconfirmed":
196 offline = serviceHandler.offlineOperations(ref)
197 if offline.deleteFromDisk(0):
198 from Screens.MessageBox import MessageBox
199 self.session.openWithCallback(self.close, MessageBox, _("You cannot delete this!"), MessageBox.TYPE_ERROR)
202 if answer in ["quit", "quitanddeleteconfirmed"]:
203 config.movielist.last_videodir.cancel()
205 elif answer == "movielist":
206 ref = self.session.nav.getCurrentlyPlayingServiceReference()
207 self.returning = True
208 from Screens.MovieSelection import MovieSelection
209 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
210 self.session.nav.stopService()
211 elif answer == "restart":
214 def doEofInternal(self, playing):
219 self.handleLeave(config.usage.on_movie_eof.value)
221 def showMovies(self):
222 ref = self.session.nav.getCurrentlyPlayingServiceReference()
223 from Screens.MovieSelection import MovieSelection
224 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
226 def movieSelected(self, service):
227 if service is not None:
228 self.is_closing = False
229 self.session.nav.playService(service)
230 self.returning = False