X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4de3bf1f4ed536706798a2e39b051a2357ff80d9..90d9f3e7624282749eb59b57d4996f5d1d06c6b1:/lib/python/Screens/InfoBar.py diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 38bb0329..a48cb75c 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -1,45 +1,82 @@ from Screen import Screen +from Screens.MovieSelection import MovieSelection +from Screens.MessageBox import MessageBox + from Components.Clock import Clock from Components.ActionMap import ActionMap -from Screens.AudioSelection import AudioSelection +from Components.ServicePosition import ServicePosition + +from Tools.Notifications import AddNotificationWithCallback from Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \ InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \ - InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord + InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \ + InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, \ + InfoBarSubserviceSelection, InfoBarTuner + +from Screens.HelpMenu import HelpableScreen, HelpMenu from enigma import * import time -class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ - InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ - InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord): +class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, + InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, + InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, + HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, + InfoBarSubserviceSelection, InfoBarTuner): + def __init__(self, session): Screen.__init__(self, session) - - for x in InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ - InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ - InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord: - x.__init__(self) - self["actions"] = ActionMap( [ "InfobarActions" ], + self["actions"] = ActionMap( [ "InfobarActions" ], { "showMovies": self.showMovies, - #"quit": self.quit, - "audioSelection": self.audioSelection, }) + + for x in HelpableScreen, \ + InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ + InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ + InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \ + InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, InfoBarTuner: + x.__init__(self) + + self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")])) self["CurrentTime"] = Clock() - # ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING) - # Clock() def showMovies(self): - self.session.open(MovieSelection) - - def audioSelection(self): - service = self.session.nav.getCurrentService() - audio = service.audioTracks() - n = audio.getNumberOfTracks() - if n > 0: - self.session.open(AudioSelection, audio) + self.session.openWithCallback(self.movieSelected, MovieSelection) + + def movieSelected(self, service): + if service is not None: + self.session.open(MoviePlayer, service) + +class MoviePlayer(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ + InfoBarMenu, \ + InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications): + + def __init__(self, session, service): + Screen.__init__(self, session) + + self["actions"] = ActionMap( [ "MoviePlayerActions" ], + { + "leavePlayer": self.leavePlayer + }) + + for x in HelpableScreen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, InfoBarNotifications: + x.__init__(self) + + self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING) + + self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference() + self.session.nav.playService(service) + + def leavePlayer(self): + self.session.openWithCallback(self.leavePlayerConfirmed, MessageBox, _("Stop playing this movie?")) + + def leavePlayerConfirmed(self, answer): + if answer == True: + self.session.nav.playService(self.lastservice) + self.close()