1 from Screen import Screen
3 from Screens.MovieSelection import MovieSelection
4 from Screens.ChannelSelection import ChannelSelectionRadio
5 from Screens.MessageBox import MessageBox
6 from Screens.Ci import CiHandler
8 from Components.Sources.Clock import Clock
9 from Components.ActionMap import HelpableActionMap
10 from Components.config import config
11 from Components.ServiceEventTracker import ServiceEventTracker
13 from Screens.InfoBarGenerics import InfoBarShowHide, \
14 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
15 InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarSeek, InfoBarInstantRecord, \
16 InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \
17 InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift, \
18 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
19 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
20 InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport
22 from Screens.HelpMenu import HelpableScreen
24 from enigma import iPlayableService
26 class InfoBar(InfoBarShowHide,
27 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
28 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection,
29 HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
30 InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
31 InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
32 InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport,
37 def __init__(self, session):
38 Screen.__init__(self, session)
40 CiHandler.setSession(session)
42 self["actions"] = HelpableActionMap(self, "InfobarActions",
44 "showMovies": (self.showMovies, _("Play recorded movies...")),
45 "showRadio": (self.showRadio, _("Show the radio player...")),
46 "showTv": (self.showTv, _("Show the tv player...")),
49 for x in HelpableScreen, \
51 InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \
52 InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
53 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
54 InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
55 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \
56 InfoBarPlugins, InfoBarServiceErrorPopupSupport:
59 self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))]))
60 self.helpList.append((self["actions"], "InfobarActions", [("showRadio", _("hear radio..."))]))
62 self["CurrentTime"] = Clock()
64 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
66 iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
69 self.current_begin_time=0
71 def __eventInfoChanged(self):
73 service = self.session.nav.getCurrentService()
74 old_begin_time = self.current_begin_time
75 info = service and service.info()
76 ptr = info and info.getEvent(0)
77 self.current_begin_time = ptr and ptr.getBeginTime() or 0
78 if config.usage.show_infobar_on_event_change.value:
79 if old_begin_time and old_begin_time != self.current_begin_time:
82 def __checkServiceStarted(self):
83 self.__serviceStarted(True)
84 self.onExecBegin.remove(self.__checkServiceStarted)
86 def serviceStarted(self): #override from InfoBarShowHide
87 new = self.servicelist.newServicePlayed()
89 InfoBarShowHide.serviceStarted(self)
90 self.current_begin_time=0
91 elif not self.__checkServiceStarted in self.onShown and new:
92 self.onShown.append(self.__checkServiceStarted)
94 def __checkServiceStarted(self):
96 self.onShown.remove(self.__checkServiceStarted)
99 self.showTvChannelList(True)
102 if config.usage.e1like_radio_mode.value:
103 self.showRadioChannelList(True)
105 self.rds_display.hide() # in InfoBarRdsDecoder
106 self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
108 def ChannelSelectionRadioClosed(self, *arg):
109 self.rds_display.show() # in InfoBarRdsDecoder
111 def showMovies(self):
112 self.session.openWithCallback(self.movieSelected, MovieSelection)
114 def movieSelected(self, service):
115 if service is not None:
116 self.session.open(MoviePlayer, service)
118 class MoviePlayer(InfoBarShowHide, \
120 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
121 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
122 InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
123 InfoBarServiceErrorPopupSupport):
125 ENABLE_RESUME_SUPPORT = True
128 def __init__(self, session, service):
129 Screen.__init__(self, session)
131 self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
133 "leavePlayer": (self.leavePlayer, _("leave movie player..."))
136 for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \
137 InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
138 InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
139 InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
140 InfoBarSummarySupport, InfoBarSubtitleSupport, \
141 InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
144 self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
145 self.session.nav.playService(service)
147 def leavePlayer(self):
148 self.is_closing = True
149 self.session.openWithCallback(self.leavePlayerConfirmed, MessageBox, _("Stop playing this movie?"))
151 def leavePlayerConfirmed(self, answer):
153 self.session.nav.playService(self.lastservice)
156 def showMovies(self):
157 ref = self.session.nav.getCurrentlyPlayingServiceReference()
158 self.session.openWithCallback(self.movieSelected, MovieSelection, ref)
160 def movieSelected(self, service):
161 if service is not None:
162 self.session.nav.playService(service)