+ else:
+ streams = []
+
+ conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage))
+
+ from Components.PluginComponent import plugins
+ from Plugins.Plugin import PluginDescriptor
+
+ if hasattr(self.infobar, "runPlugin"):
+ class PluginCaller:
+ def __init__(self, fnc, *args):
+ self.fnc = fnc
+ self.args = args
+ def __call__(self, *args, **kwargs):
+ 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))
+ self.plugincallfunc = Plugins[0][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()
+
+ def getSubtitleList(self):
+ s = self.infobar and self.infobar.getCurrentServiceSubtitle()
+ l = s and s.getSubtitleList() or [ ]
+ return l
+
+ def subtitlesEnabled(self):
+ 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
+ if subtitles:
+ 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:
+ config.av.downmix_ac3.value = False
+ 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:
+ self.audioTracks.selectTrack(track)
+
+ def keyLeft(self):
+ if self.focus == FOCUS_CONFIG:
+ ConfigListScreen.keyLeft(self)
+ elif self.focus == FOCUS_STREAMS:
+ self["streams"].setIndex(0)
+
+ def keyRight(self, config = False):
+ if config or self.focus == FOCUS_CONFIG:
+ if self["config"].getCurrentIndex() < 3:
+ ConfigListScreen.keyRight(self)
+ elif hasattr(self, "plugincallfunc"):
+ self.plugincallfunc()
+ if self.focus == FOCUS_STREAMS and self["streams"].count() and config == False:
+ self["streams"].setIndex(self["streams"].count()-1)
+
+ def keyRed(self):
+ if self["key_red"].getBoolean():
+ self.colorkey(0)
+
+ def keyGreen(self):
+ if self["key_green"].getBoolean():
+ self.colorkey(1)
+
+ def keyYellow(self):
+ if self["key_yellow"].getBoolean():
+ self.colorkey(2)
+
+ def keyBlue(self):
+ if self["key_blue"].getBoolean():
+ print "colorkey(3)"
+ self.colorkey(3)
+
+ def colorkey(self, idx):
+ self["config"].setCurrentIndex(idx)
+ 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:
+ if self["streams"].getIndex() == 0:
+ self["config"].instance.setSelectionEnable(True)
+ self["streams"].style = "notselected"
+ self["config"].setCurrentIndex(len(self["config"].getList())-1)
+ self.focus = FOCUS_CONFIG
+ else:
+ 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)
+ else:
+ self["config"].instance.setSelectionEnable(False)
+ self["streams"].style = "default"
+ self.focus = FOCUS_STREAMS
+ elif self.focus == FOCUS_STREAMS:
+ 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() == PAGE_AUDIO and cur[0] is not None:
+ self.changeAudio(cur[2])
+ self.__updatedInfo()
+ 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()
+ self.__updatedInfo()
+ self["streams"].setIndex(selectedidx)