Merge branch 'experimental' of git.opendreambox.org:/git/enigma2 into experimental
authorFraxinas <andreas.frisch@multimedia-labs.de>
Fri, 4 Jun 2010 13:20:29 +0000 (15:20 +0200)
committerFraxinas <andreas.frisch@multimedia-labs.de>
Fri, 4 Jun 2010 13:20:29 +0000 (15:20 +0200)
data/skin_default.xml
lib/python/Plugins/Extensions/MediaPlayer/plugin.py
lib/python/Screens/AudioSelection.py

index 9fb2fc2703a84dc1dff0585638408b1e21dd2f69..ea0e29f2fb0d4baa30527358806f8de3b824e4ec 100755 (executable)
@@ -62,8 +62,8 @@
                <widget name="statuspic" pixmaps="skin_default/buttons/button_green.png,skin_default/buttons/button_green_off.png" position="130,380" zPosition="10" size="15,16" transparent="1" alphatest="on"/>
        </screen>
        <!-- Audio selection -->
-       <screen name="AudioSelection" position="center,center" size="420,330" title="Audio">
-               <widget name="config" position="50,10" size="360,110" scrollbarMode="showOnDemand" />
+       <screen name="AudioSelection" position="center,center" size="560,330" title="Audio">
+               <widget name="config" position="50,10" size="500,110" scrollbarMode="showOnDemand" />
                
                <widget source="key_red" render="Pixmap" pixmap="skin_default/buttons/key_red.png" position="10,10" size="35,25" alphatest="on">
                        <convert type="ConditionalShowHide" />
                        <convert type="ConditionalShowHide" />
                </widget>
                
-               <ePixmap pixmap="skin_default/div-h.png" position="10,112" zPosition="10" size="360,2" />
+               <ePixmap pixmap="skin_default/div-h.png" position="10,112" zPosition="10" size="540,2" />
 
-               <widget source="streams" render="Listbox" scrollbarMode="showOnDemand" position="10,120" size="400,200" zPosition="3" transparent="1" >
+               <widget source="streams" render="Listbox" scrollbarMode="showOnDemand" position="10,120" size="540,200" zPosition="3" transparent="1" >
                        <convert type="TemplatedMultiContent">
                                {"templates":
                                        {"default": (25, [ 
                                                MultiContentEntryText(pos = (0, 0),   size = (35, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 1), # key,
-                                               MultiContentEntryText(pos = (40, 0),  size = (55, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 2), # number,
-                                               MultiContentEntryText(pos = (100, 0), size = (80, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 3), # description,
-                                               MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT,  text = 4), # language,
-                                               MultiContentEntryText(pos = (340, 4), size = (60, 25),  font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection,
+                                               MultiContentEntryText(pos = (40, 0),  size = (60, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 2), # number,
+                                               MultiContentEntryText(pos = (110, 0), size = (120, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 3), # description,
+                                               MultiContentEntryText(pos = (240, 0), size = (210, 25), font = 0, flags = RT_HALIGN_LEFT,  text = 4), # language,
+                                               MultiContentEntryText(pos = (460, 4), size = (80, 25),  font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection,
                                        ], True, "showNever"),
                                        "notselected": (25, [ 
                                                MultiContentEntryText(pos = (0, 0),   size = (35, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 1), # key,
-                                               MultiContentEntryText(pos = (40, 0),  size = (55, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 2), # number,
-                                               MultiContentEntryText(pos = (100, 0), size = (80, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 3), # description,
-                                               MultiContentEntryText(pos = (190, 0), size = (140, 25), font = 0, flags = RT_HALIGN_LEFT,  text = 4), # language,
-                                               MultiContentEntryText(pos = (340, 4), size = (60, 25),  font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection,
+                                               MultiContentEntryText(pos = (40, 0),  size = (60, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 2), # number,
+                                               MultiContentEntryText(pos = (110, 0), size = (120, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 3), # description,
+                                               MultiContentEntryText(pos = (240, 0), size = (210, 25), font = 0, flags = RT_HALIGN_LEFT,  text = 4), # language,
+                                               MultiContentEntryText(pos = (460, 4), size = (80, 25),  font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection,
                                        ], False, "showNever")
                                        },
                                "fonts": [gFont("Regular", 20), gFont("Regular", 16)],
index 0fc78fb10923ec7b0150054505df812403538f3c..15806e8cafc825d4195228ae6f52bbf65f5a8c8a 100755 (executable)
@@ -901,11 +901,11 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
 
        def unPauseService(self):
                self.setSeekState(self.SEEK_STATE_PLAY)
-               
+
        def subtitleSelection(self):
-               from Screens.Subtitles import Subtitles
-               self.session.open(Subtitles, self)
-       
+               from Screens.AudioSelection import SubtitleSelection
+               self.session.open(SubtitleSelection, self)
+
        def hotplugCB(self, dev, media_state):
                if dev == harddiskmanager.getCD():
                        if media_state == "1":
index 2cae1de929cc3442f10ec206b6a006929379743f..bacc00c1268570227a5db970a7bbadb33dfb8f71 100644 (file)
@@ -14,9 +14,10 @@ from enigma import iPlayableService
 from Tools.ISO639 import LanguageCodes
 from Tools.BoundFunction import boundFunction
 FOCUS_CONFIG, FOCUS_STREAMS = range(2)
+[PAGE_AUDIO, PAGE_SUBTITLES] = ["audio", "subtitles"]
 
 class AudioSelection(Screen, ConfigListScreen):
-       def __init__(self, session, infobar=None):
+       def __init__(self, session, infobar=None, page=PAGE_AUDIO):
                Screen.__init__(self, session)
 
                self["streams"] = List([])
@@ -48,8 +49,8 @@ class AudioSelection(Screen, ConfigListScreen):
                }, -3)
 
                self.settings = ConfigSubsection()
-               choicelist = [("audio",_("audio tracks")), ("subtitles",_("Subtitles"))]
-               self.settings.menupage = ConfigSelection(choices = choicelist)
+               choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))]
+               self.settings.menupage = ConfigSelection(choices = choicelist, default=page)
                self.settings.menupage.addNotifier(self.fillList)
                self.onLayoutFinish.append(self.__layoutFinished)
 
@@ -66,10 +67,9 @@ class AudioSelection(Screen, ConfigListScreen):
                self.audioTracks = audio = service and service.audioTracks()
                n = audio and audio.getNumberOfTracks() or 0
                
-               if self.settings.menupage.getValue() == "audio":
+               if self.settings.menupage.getValue() == PAGE_AUDIO:
                        self.setTitle(_("Select audio track"))
                        if SystemInfo["CanDownmixAC3"]:
-                               print "config.av.downmix_ac3.value=", config.av.downmix_ac3.value
                                self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value)
                                self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False)
                                conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix))
@@ -77,16 +77,12 @@ class AudioSelection(Screen, ConfigListScreen):
 
                        if n > 0:
                                self.audioChannel = service.audioChannel()
-                               print "self.audioChannel.getCurrentChannel()", self.audioChannel.getCurrentChannel()
                                choicelist = [("0",_("left")), ("1",_("stereo")), ("2", _("right"))]
                                self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel()))
                                self.settings.channelmode.addNotifier(self.changeMode, initial_call = False)
                                conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode))
                                self["key_green"].setBoolean(True)
-                               
                                selectedAudio = self.audioTracks.getCurrentTrack()
-                               print "selectedAudio:", selectedAudio
-
                                for x in range(n):
                                        number = str(x)
                                        i = audio.getTrackInfo(x)
@@ -115,14 +111,14 @@ class AudioSelection(Screen, ConfigListScreen):
 
                        else:
                                streams = []
+                               conflist.append(('',))
+                               self["key_green"].setBoolean(False)
 
-               elif self.settings.menupage.getValue() == "subtitles":
+               elif self.settings.menupage.getValue() == PAGE_SUBTITLES:
                        self.setTitle(_("Subtitle selection"))
-                       
-                       self.settings.dummy = ConfigNothing()
-                       conflist.append(getConfigListEntry("", self.settings.dummy))
+                       conflist.append(('',))
+                       conflist.append(('',))
                        self["key_red"].setBoolean(False)
-                       conflist.append(getConfigListEntry("", self.settings.dummy))
                        self["key_green"].setBoolean(False)
 
                        if self.subtitlesEnabled():
@@ -158,9 +154,9 @@ class AudioSelection(Screen, ConfigListScreen):
                                        elif x[0] == 1:
                                                description = "TTX"
                                                number = "%x%02x" % (x[3],x[2])
-                                       
+
                                        elif x[0] == 2:
-                                               types = (" UTF-8 text "," SSA / AAS "," .SRT file ")
+                                               types = ("UTF-8 text","SSA / AAS",".SRT file")
                                                description = types[x[2]]
 
                                        streams.append((x, "", number, description, language, selected))
@@ -183,23 +179,19 @@ class AudioSelection(Screen, ConfigListScreen):
                                        self.fnc(*self.args)
 
                        Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ]
-                       
-                       print "Plugins", Plugins
 
-                       self.settings.dummy = ConfigNothing()
                        if len(Plugins):
                                self["key_blue"].setBoolean(True)
-                               conflist.append(getConfigListEntry(Plugins[0][0], self.settings.dummy))
+                               conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing()))
                                self.plugincallfunc = Plugins[0][1]
+                       if len(Plugins) > 1:
+                               print "these plugins are installed but not displayed in the dialog box:", Plugins[1:]
 
                self["config"].list = conflist
                self["config"].l.setList(conflist)
 
-               print "setting self[streams].list:", streams
                self["streams"].list = streams
-               print "setting self[streams].setIndex:", selectedidx
                self["streams"].setIndex(selectedidx)
-               print "debug1"
 
        def __updatedInfo(self):
                self.fillList()
@@ -213,7 +205,6 @@ class AudioSelection(Screen, ConfigListScreen):
                return self.infobar.subtitles_enabled
 
        def enableSubtitle(self, subtitles):
-               print "[enableSubtitle]", subtitles
                if self.infobar.selected_subtitle != subtitles:
                        self.infobar.subtitles_enabled = False
                        self.infobar.selected_subtitle = subtitles
@@ -221,7 +212,6 @@ class AudioSelection(Screen, ConfigListScreen):
                                self.infobar.subtitles_enabled = True
 
        def changeAC3Downmix(self, downmix):
-               print "changeAC3Downmix config.av.downmix_ac3.value=", config.av.downmix_ac3.value, downmix.getValue()
                if downmix.getValue() == True:
                        config.av.downmix_ac3.value = True
                else:
@@ -229,12 +219,10 @@ class AudioSelection(Screen, ConfigListScreen):
                config.av.downmix_ac3.save()
 
        def changeMode(self, mode):
-               print "changeMode", mode, mode.getValue()
                if mode is not None:
                        self.audioChannel.selectChannel(int(mode.getValue()))
 
        def changeAudio(self, audio):
-               print "changeAudio", audio, "self.session.nav.getCurrentService().audioTracks().getNumberOfTracks():", self.session.nav.getCurrentService().audioTracks().getNumberOfTracks()
                track = int(audio)
                if isinstance(track, int):
                        if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > track:
@@ -252,7 +240,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                ConfigListScreen.keyRight(self)
                        elif hasattr(self, "plugincallfunc"):
                                self.plugincallfunc()
-               if self.focus == FOCUS_STREAMS and self["streams"].count():
+               if self.focus == FOCUS_STREAMS and self["streams"].count() and config == False:
                        self["streams"].setIndex(self["streams"].count()-1)
 
        def keyRed(self):
@@ -269,7 +257,6 @@ class AudioSelection(Screen, ConfigListScreen):
 
        def keyBlue(self):
                if self["key_blue"].getBoolean():
-                       print "colorkey(3)"
                        self.colorkey(3)
 
        def colorkey(self, idx):
@@ -277,7 +264,6 @@ class AudioSelection(Screen, ConfigListScreen):
                self.keyRight(True)
 
        def keyUp(self):
-               print "[keyUp]", self["streams"].getIndex()
                if self.focus == FOCUS_CONFIG:
                        self["config"].instance.moveSelection(self["config"].instance.moveUp)
                elif self.focus == FOCUS_STREAMS:
@@ -290,7 +276,6 @@ class AudioSelection(Screen, ConfigListScreen):
                                self["streams"].selectPrevious()
 
        def keyDown(self):
-               print "[keyDown]", self["config"].getCurrentIndex(), len(self["config"].getList())-1
                if self.focus == FOCUS_CONFIG:
                        if self["config"].getCurrentIndex() < len(self["config"].getList())-1:
                                self["config"].instance.moveSelection(self["config"].instance.moveDown)
@@ -302,13 +287,12 @@ class AudioSelection(Screen, ConfigListScreen):
                        self["streams"].selectNext()
 
        def keyOk(self):
-               print "[keyok]", self["streams"].list, self["streams"].getCurrent()
                if self.focus == FOCUS_STREAMS and self["streams"].list:
                        cur = self["streams"].getCurrent()
-                       if self.settings.menupage.getValue() == "audio" and cur[0] is not None:
+                       if self.settings.menupage.getValue() == PAGE_AUDIO and cur[0] is not None:
                                self.changeAudio(cur[2])
                                self.__updatedInfo()
-                       if self.settings.menupage.getValue() == "subtitles" and cur[0] is not None:
+                       if self.settings.menupage.getValue() == PAGE_SUBTITLES and cur[0] is not None:
                                if self.infobar.selected_subtitle == cur[0]:
                                        self.enableSubtitle(None)
                                        selectedidx = self["streams"].getIndex()
@@ -323,3 +307,8 @@ class AudioSelection(Screen, ConfigListScreen):
 
        def cancel(self):
                self.close(0)
+
+class SubtitleSelection(AudioSelection):
+       def __init__(self, session, infobar=None):
+               AudioSelection.__init__(self, session, infobar, page=PAGE_SUBTITLES)
+               self.skinName = ["AudioSelection"]