From: Felix Domke Date: Tue, 15 Nov 2005 03:57:19 +0000 (+0000) Subject: add CMoviePlayer X-Git-Tag: 2.6.0~5200 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/364dcf5cdfa9f39414074a48501f25d714117729 add CMoviePlayer --- diff --git a/data/keymap.xml b/data/keymap.xml index 8eaa10ee..8533859a 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -52,11 +52,11 @@ - - + + - + @@ -66,7 +66,7 @@ - + @@ -77,6 +77,9 @@ + + + @@ -110,6 +113,14 @@ + + + + + + + + diff --git a/data/skin.xml b/data/skin.xml index 060b8854..d85d1735 100644 --- a/data/skin.xml +++ b/data/skin.xml @@ -150,6 +150,15 @@ + + + + + + + + + @@ -161,8 +170,8 @@ - - + + @@ -197,7 +206,7 @@ -# this should be factored out into some helper code, but currently demonstrated applets. +# this should be factored out into some helper code, but currently demonstrates applets. from enigma import eSize, ePoint orgwidth = self.instance.size().width() diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index def45d69..2dcef59f 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -1,13 +1,16 @@ 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 Screens.MovieSelection import MovieSelection +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 enigma import * @@ -15,32 +18,55 @@ import time class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ - InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord): + InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection): + def __init__(self, session): Screen.__init__(self, session) + + self["actions"] = ActionMap( [ "InfobarActions" ], + { + "showMovies": self.showMovies, + }) for x in InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ - InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord: + InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection: x.__init__(self) - self["actions"] = ActionMap( [ "InfobarActions" ], + self["CurrentTime"] = Clock() + + def showMovies(self): + 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): + + def __init__(self, session, service): + Screen.__init__(self, session) + + self["actions"] = ActionMap( [ "MoviePlayerActions" ], { - "showMovies": self.showMovies, - #"quit": self.quit, - "audioSelection": self.audioSelection, + "leavePlayer": self.leavePlayer }) + + for x in InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection: + x.__init__(self) self["CurrentTime"] = Clock() # ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING) - # Clock() + + self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference() + self.session.nav.playService(service) - 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) + 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() diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 961d914f..5e28cdee 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -5,15 +5,12 @@ from Components.Label import Label from Components.config import configfile from ChannelSelection import ChannelSelection - from Components.ServiceName import ServiceName from Components.EventInfo import EventInfo -from Components.ServicePosition import ServicePosition from EpgSelection import EPGSelection from Screens.MessageBox import MessageBox -from Screens.MovieSelection import MovieSelection from Screens.Volume import Volume from Screens.Mute import Mute from Screens.Standby import Standby @@ -219,7 +216,7 @@ class InfoBarChannelSelection: #instantiate forever self.servicelist = self.session.instantiateDialog(ChannelSelection) - self["ChannelSelectActions"] = ActionMap( ["InfoBarChannelSelection"], + self["ChannelSelectActions"] = ActionMap( ["InfobarChannelSelection"], { "switchChannelUp": self.switchChannelUp, "switchChannelDown": self.switchChannelDown, @@ -246,7 +243,7 @@ class InfoBarChannelSelection: class InfoBarMenu: """ Handles a menu action, to open the (main) menu """ def __init__(self): - self["MenuActions"] = ActionMap( [ "InfoBarMenuActions" ], + self["MenuActions"] = ActionMap( [ "InfobarMenuActions" ], { "mainMenu": self.mainMenu, }) @@ -327,7 +324,7 @@ class InfoBarInstantRecord: """Instant Record - handles the instantRecord action in order to start/stop instant records""" def __init__(self): - self["InstnantRecordActions"] = ActionMap( [ "InfoBarInstantRecord" ], + self["InstnantRecordActions"] = ActionMap( [ "InfobarInstantRecord" ], { "instantRecord": self.instantRecord, }) @@ -367,3 +364,19 @@ class InfoBarInstantRecord: self.session.openWithCallback(self.recordQuestionCallback, MessageBox, "Do you want to stop the current\n(instant) recording?") else: self.session.openWithCallback(self.recordQuestionCallback, MessageBox, "Start recording?") + +from Screens.AudioSelection import AudioSelection + +class InfoBarAudioSelection: + def __init__(self): + self["AudioSelectionAction"] = ActionMap( [ "InfobarAudioSelectionActions" ], + { + "audioSelection": self.audioSelection, + }) + + def audioSelection(self): + service = self.session.nav.getCurrentService() + audio = service.audioTracks() + n = audio.getNumberOfTracks() + if n > 0: + self.session.open(AudioSelection, audio) diff --git a/lib/python/Screens/MovieSelection.py b/lib/python/Screens/MovieSelection.py index ad93a5eb..ce3a9732 100644 --- a/lib/python/Screens/MovieSelection.py +++ b/lib/python/Screens/MovieSelection.py @@ -67,7 +67,7 @@ class MovieSelection(Screen): self["actions"] = ActionMap(["OkCancelActions", "ContextMenuActions"], { - "cancel": self.close, + "cancel": self.abort, "ok": self.movieSelected, "contextMenu": self.doContext, }) @@ -77,8 +77,10 @@ class MovieSelection(Screen): return self["list"].getCurrent()[0] def movieSelected(self): - self.session.nav.playService(self.getCurrent()) - self.close() + self.close(self.getCurrent()) def doContext(self): self.session.open(ChannelContextMenu, self, self.getCurrent()) + + def abort(self): + self.close(None)