1 from Tools.Profile import profile, profile_final
3 from Screen import Screen
5 profile("LOAD:MovieSelection")
6 from Screens.MovieSelection import MovieSelection
7 profile("LOAD:ChannelSelectionRadio")
8 from Screens.ChannelSelection import ChannelSelectionRadio
9 profile("LOAD:ChoiceBox")
10 from Screens.ChoiceBox import ChoiceBox
12 profile("LOAD:InitBar_Components")
13 from Components.Sources.Source import ObsoleteSource
14 from Components.ActionMap import HelpableActionMap
15 from Components.config import config
16 from Components.ServiceEventTracker import ServiceEventTracker
18 profile("LOAD:InfoBarGenerics")
19 from Screens.InfoBarGenerics import InfoBarShowHide, \
20 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
21 InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarSeek, InfoBarInstantRecord, \
22 InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
23 InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift, \
24 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
25 InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
26 InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport
28 profile("LOAD:HelpableScreen")
29 from Screens.HelpMenu import HelpableScreen
31 profile("LOAD:enigma")
32 from enigma import iPlayableService
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)
153 def leavePlayer(self):
154 self.is_closing = True
157 list.append((_("Yes"), "quit"))
158 list.append((_("No"), "continue"))
159 if config.usage.setup_level.index >= 2: # expert+
160 list.append((_("No, but restart from begin"), "restart"))
161 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
163 def leavePlayerConfirmed(self, answer):
164 answer = answer and answer[1]
166 self.session.nav.playService(self.lastservice)
168 elif answer == "restart":
171 def showMovies(self):
172 ref = self.session.nav.getCurrentlyPlayingServiceReference()
173 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
175 def movieSelected(self, service):
176 if service is not None:
177 self.session.nav.playService(service)