From 0a7e2ed8d31048eee98bf2ffd794743d30d9b953 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Sat, 10 Jun 2006 21:30:38 +0000 Subject: [PATCH] - add separation lines to the ChoiceList component - selection of left/right/stereo added to the audio channel menu --- lib/python/Components/ChoiceList.py | 13 ++++++----- lib/python/Screens/ChoiceBox.py | 2 +- lib/python/Screens/InfoBarGenerics.py | 31 ++++++++++++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/lib/python/Components/ChoiceList.py b/lib/python/Components/ChoiceList.py index fe3e6008..a0fbde54 100644 --- a/lib/python/Components/ChoiceList.py +++ b/lib/python/Components/ChoiceList.py @@ -18,11 +18,14 @@ RT_VALIGN_BOTTOM = 16 def ChoiceEntryComponent(key, text): res = [ text ] - res.append((eListboxPythonMultiContent.TYPE_TEXT, 32, 00, 800, 25, 0, RT_HALIGN_LEFT, text[0])) - - png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "key_" + key + "-fs8.png")) - if png is not None: - res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 30, 20, png)) + if text[0] == "--": + res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 00, 800, 25, 0, RT_HALIGN_LEFT, "-"*200)) + else: + res.append((eListboxPythonMultiContent.TYPE_TEXT, 32, 00, 800, 25, 0, RT_HALIGN_LEFT, text[0])) + + png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "key_" + key + "-fs8.png")) + if png is not None: + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 30, 20, png)) return res diff --git a/lib/python/Screens/ChoiceBox.py b/lib/python/Screens/ChoiceBox.py index 50fd6c51..60aa5e10 100644 --- a/lib/python/Screens/ChoiceBox.py +++ b/lib/python/Screens/ChoiceBox.py @@ -24,7 +24,7 @@ class ChoiceBox(Screen): pos = 0 for x in list: strpos = str(self.keys[pos]) - self.list.append(ChoiceEntryComponent(strpos, x)) + self.list.append(ChoiceEntryComponent(key = strpos, text = x)) if self.keys[pos] != "": self.keymap[self.keys[pos]] = list[pos] pos += 1 diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index be770210..b7325c36 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1214,14 +1214,17 @@ class InfoBarAudioSelection: audio = service.audioTracks() self.audioTracks = audio n = audio.getNumberOfTracks() + keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n + tlist = [] + print "tlist:", tlist if n > 0: -# self.audioChannel = service.audioChannel() + self.audioChannel = service.audioChannel() # config.audio.audiochannel = configElement_nonSave("config.audio.audiochannel", configSelection, self.audioChannel.getCurrentChannel(), (("left", _("Left >")), ("stereo", _("< Stereo >")), ("right", _("< Right")))) - tlist = [] + for x in range(n): i = audio.getTrackInfo(x) language = i.getLanguage() - description = i.getDescription(); + description = i.getDescription() if len(language) == 3: if language in LanguageCodes: @@ -1239,24 +1242,36 @@ class InfoBarAudioSelection: # tlist.insert(0, getConfigListEntry(_("Audio Channel"), config.audio.audiochannel)) - selection = 0 + selection = 2 for x in tlist: if x[1] != selectedAudio: selection += 1 else: break - - self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection) + + tlist = [([_("Left"), _("Stereo"), _("Right")][self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist + self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys) else: del self.audioTracks def audioSelected(self, audio): if audio is not None: - self.audioTracks.selectTrack(audio[1]) + if isinstance(audio[1], str): + if audio[1] == "mode": + keys = ["red", "green", "yellow"] + selection = self.audioChannel.getCurrentChannel() + tlist = [(_("left"), 0), (_("stereo"), 1), (_("right"), 2)] + self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys) + else: + if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > audio[1]: + self.audioTracks.selectTrack(audio[1]) del self.audioTracks -# del self.audioChannel # del config.audio.audiochannel + def modeSelected(self, mode): + if mode is not None: + self.audioChannel.selectChannel(mode[1]) + del self.audioChannel class InfoBarSubserviceSelection: def __init__(self): self["SubserviceSelectionAction"] = HelpableActionMap(self, "InfobarSubserviceSelectionActions", -- 2.30.2