1 from Screen import Screen
3 from Screens.MovieSelection import MovieSelection
4 from Screens.ChannelSelection import ChannelSelectionRadio
5 from Screens.ChoiceBox import ChoiceBox
7 from Components.Sources.Source import ObsoleteSource
8 from Components.ActionMap import HelpableActionMap
9 from Components.config import config
10 from Components.ServiceEventTracker import ServiceEventTracker
12 from Screens.InfoBarGenerics import InfoBarShowHide, \
13 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
14 InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarSeek, InfoBarInstantRecord, \
15 InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
16 InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift, \
17 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
18 InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
19 InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport
21 from Screens.HelpMenu import HelpableScreen
23 from enigma import iPlayableService
25 class InfoBar(InfoBarShowHide,
26 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
27 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection,
28 HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
29 InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
30 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
31 InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport,
36 def __init__(self, session):
37 Screen.__init__(self, session)
39 self["actions"] = HelpableActionMap(self, "InfobarActions",
41 "showMovies": (self.showMovies, _("Play recorded movies...")),
42 "showRadio": (self.showRadio, _("Show the radio player...")),
43 "showTv": (self.showTv, _("Show the tv player...")),
46 for x in HelpableScreen, \
48 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
49 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
50 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
51 InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
52 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \
53 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
56 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
57 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
59 self["CurrentTime"] = ObsoleteSource(new_source = "global.CurrentTime", removal_date = "2008-01")
61 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
63 iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
66 self.current_begin_time=0
68 def __eventInfoChanged(self):
70 service = self.session.nav.getCurrentService()
71 old_begin_time = self.current_begin_time
72 info = service and service.info()
73 ptr = info and info.getEvent(0)
74 self.current_begin_time = ptr and ptr.getBeginTime() or 0
75 if config.usage.show_infobar_on_event_change.value:
76 if old_begin_time and old_begin_time != self.current_begin_time:
79 def __checkServiceStarted(self):
80 self.__serviceStarted(True)
81 self.onExecBegin.remove(self.__checkServiceStarted)
83 def serviceStarted(self): #override from InfoBarShowHide
84 new = self.servicelist.newServicePlayed()
86 InfoBarShowHide.serviceStarted(self)
87 self.current_begin_time=0
88 elif not self.__checkServiceStarted in self.onShown and new:
89 self.onShown.append(self.__checkServiceStarted)
91 def __checkServiceStarted(self):
93 self.onShown.remove(self.__checkServiceStarted)
96 self.showTvChannelList(True)
99 if config.usage.e1like_radio_mode.value:
100 self.showRadioChannelList(True)
102 self.rds_display.hide() # in InfoBarRdsDecoder
103 self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
105 def ChannelSelectionRadioClosed(self, *arg):
106 self.rds_display.show() # in InfoBarRdsDecoder
108 def showMovies(self):
109 self.session.openWithCallback(self.movieSelected, MovieSelection)
111 def movieSelected(self, service):
112 if service is not None:
113 self.session.open(MoviePlayer, service)
115 class MoviePlayer(InfoBarShowHide, \
117 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
118 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
119 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
120 InfoBarServiceErrorPopupSupport):
122 ENABLE_RESUME_SUPPORT = True
125 def __init__(self, session, service):
126 Screen.__init__(self, session)
128 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
130 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
133 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
134 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
135 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
136 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
137 InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \
138 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
141 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
142 self.session.nav.playService(service)
144 def leavePlayer(self):
145 self.is_closing = True
148 list.append((_("Yes"), "quit"))
149 list.append((_("No"), "continue"))
150 if config.usage.setup_level.index >= 2: # expert+
151 list.append((_("No, but restart from begin"), "restart"))
152 self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list = list)
154 def leavePlayerConfirmed(self, answer):
155 answer = answer and answer[1]
157 self.session.nav.playService(self.lastservice)
159 elif answer == "restart":
162 def showMovies(self):
163 ref = self.session.nav.getCurrentlyPlayingServiceReference()
164 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
166 def movieSelected(self, service):
167 if service is not None:
168 self.session.nav.playService(service)