X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4de3bf1f4ed536706798a2e39b051a2357ff80d9..beee08d9e6f0a55b46a9668dbcdd5ae8e0acf253:/lib/python/Screens/InfoBar.py diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 38bb0329..b0dfc0ab 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -1,12 +1,18 @@ 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 Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \ InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \ - InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord + InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \ + InfoBarAudioSelection + +from Screens.HelpMenu import HelpableScreen, HelpMenu from enigma import * @@ -14,32 +20,58 @@ import time class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ - InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord): + InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, + HelpableScreen): + 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: + 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): + + 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: + 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()