add CMoviePlayer
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 15 Nov 2005 03:57:19 +0000 (03:57 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 15 Nov 2005 03:57:19 +0000 (03:57 +0000)
data/keymap.xml
data/skin.xml
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/MovieSelection.py

index 8eaa10e..8533859 100644 (file)
                <key id="KEY_INFO" mapto="showEPGList" flags="m" />
        </map>
        
-       <map context="InfoBarInstantRecord">
-               <key id="KEY_R" mapto="instantRecord" flags="m" />
+       <map context="InfobarInstantRecord">
+               <key id="KEY_RED" mapto="instantRecord" flags="m" />
        </map>
 
-       <map context="InfoBarChannelSelection">
+       <map context="InfobarChannelSelection">
                <key id="KEY_LEFT" mapto="zapUp" flags="mr" />
                <key id="KEY_RIGHT" mapto="zapDown" flags="mr" />
                <key id="KEY_UP" mapto="switchChannelUp" flags="mr" />
@@ -66,7 +66,7 @@
                <key id="BTN_1" mapto="zapDown" flags="mr" />
        </map>
        
-       <map context="InfoBarMenuActions">
+       <map context="InfobarMenuActions">
                <key id="KEY_MENU" mapto="mainMenu" flags="mr" />
        </map>
        
@@ -77,6 +77,9 @@
 
        <map context="InfobarActions">
                <key id="KEY_VIDEO" mapto="showMovies" flags="m" />
+       </map>
+
+       <map context="InfobarAudioSelectionActions">
                <key id="KEY_AUDIO" mapto="audioSelection" flags="m" />
        </map>
 
                <key id="KEY_GREEN" mapto="unPauseService" flags="m" />
                <key id="KEY_RED" mapto="seekBack" flags="m" />
                <key id="KEY_BLUE" mapto="seekFwd" flags="m" />
+
+               <key id="KEY_LEFT" mapto="seekBack" flags="m" />
+               <key id="KEY_RIGHT" mapto="seekFwd" flags="m" />
+       </map>
+
+       <map context="MoviePlayerActions">
+               <key id="KEY_VIDEO" mapto="leavePlayer" flags="m" />
+               <key id="KEY_TV" mapto="leavePlayer" flags="m" />
        </map>
        
        <map context="ChannelSelectActions">
index 060b885..d85d173 100644 (file)
                        <widget name="Event_Next_Duration" position="555,98" size="70,26" font="Arial;22" backgroundColor="dark" />
 <!--                   <eLabel position="70,0" size="300,30" text=".oO skin Oo." font="Arial;20" /> -->
                </screen>
+
+               <screen name="MoviePlayer" flags="wfNoBorder" position="0,380" size="720,148" title="InfoBar">
+                       <ePixmap position="0,0" size="720,148" pixmap="/usr/share/enigma2/info-bg.png" />
+                       <widget name="ServiceName" position="69,25" size="427,26" valign="center" font="Arial;22" backgroundColor="#101258" />
+                       <widget name="CurrentTime" position="575,10" size="90,30" backgroundColor="dark" font="Arial;19" />
+                       <eLabel position="70,0" size="300,30" text=".oO skin Oo." font="Arial;20" />
+               </screen>
+
+
                <screen name="NumberZap" flags="wfNoBorder" position="300,120" size="120,60">
                        <widget name="number" position="30,15" size="80,25" font="Arial;23" />
                </screen>
                <screen name="Mute" flags="wfNoBorder" position="100,100" size="59,80" title="Mute">
                        <ePixmap position="0,0" size="59,80" pixmap="/usr/share/enigma2/mute-fs8.png" />
                </screen>
-               <screen name="ChannelSelection" position="90,100" size="560,420" title="Channel Selection">
-                       <widget name="list" position="10,50" size="540,325" />
+               <screen name="ChannelSelection" position="90,100" size="560,450" title="Channel Selection">
+                       <widget name="list" position="10,50" size="540,400" />
 <!--                   <widget name="okbutton" position="340,50" size="140,30" />-->
                        <widget name="key_red" position="0,0" size="140,40" backgroundColor="red" font="Arial;21" />
                        <widget name="key_green" position="140,0" size="140,40" backgroundColor="green" font="Arial;21" />
                <screen name="MessageBox" position="0,300" size="720,10" title="Message">
                        <widget name="text" position="0,0" size="650,0" font="Arial;22" />
                        <applet type="onLayoutFinish">
-# 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()
index def45d6..2dcef59 100644 (file)
@@ -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()
index 961d914..5e28cde 100644 (file)
@@ -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)
index ad93a5e..ce3a973 100644 (file)
@@ -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)