aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-05-02 23:07:07 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-05-02 23:07:07 +0000
commit3f8e26212c4bcca56462f09b50a681f1526e1a7c (patch)
treed5aeb343d9b055aaf42a1e8ccb208ca85cc6bcac /lib/python/Screens
parent84e19567791d6117f4d5103b001d0b05cd231d38 (diff)
downloadenigma2-3f8e26212c4bcca56462f09b50a681f1526e1a7c.tar.gz
enigma2-3f8e26212c4bcca56462f09b50a681f1526e1a7c.zip
use ChoiceBox for audio selection (audio tracks are now sorted by description)
Diffstat (limited to 'lib/python/Screens')
-rw-r--r--lib/python/Screens/AudioSelection.py0
-rw-r--r--lib/python/Screens/InfoBarGenerics.py35
-rw-r--r--lib/python/Screens/Makefile.am2
-rw-r--r--lib/python/Screens/__init__.py2
4 files changed, 35 insertions, 4 deletions
diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py
deleted file mode 100644
index e69de29b..00000000
--- a/lib/python/Screens/AudioSelection.py
+++ /dev/null
diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py
index 788a67b1..1b56e430 100644
--- a/lib/python/Screens/InfoBarGenerics.py
+++ b/lib/python/Screens/InfoBarGenerics.py
@@ -1148,7 +1148,7 @@ class InfoBarInstantRecord:
else:
self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"),(_("don't record"), "no")])
-from Screens.AudioSelection import AudioSelection
+from Tools.ISO639 import LanguageCodes
class InfoBarAudioSelection:
def __init__(self):
@@ -1160,9 +1160,40 @@ class InfoBarAudioSelection:
def audioSelection(self):
service = self.session.nav.getCurrentService()
audio = service.audioTracks()
+ self.audio = audio
n = audio.getNumberOfTracks()
if n > 0:
- self.session.open(AudioSelection, audio)
+ tlist = []
+ for x in range(n):
+ i = audio.getTrackInfo(x)
+ language = i.getLanguage()
+ description = i.getDescription();
+
+ if len(language) == 3:
+ if language in LanguageCodes:
+ language = LanguageCodes[language][0]
+
+ if len(description):
+ description += " (" + language + ")"
+ else:
+ description = language
+
+ tlist.append((description, x))
+
+ selectedAudio = tlist[0][1]
+ tlist.sort(lambda x,y : cmp(x[0], y[0]))
+ selection = 0
+ 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)
+
+ def audioSelected(self, audio):
+ if audio is not None:
+ self.audio.selectTrack(audio[1])
class InfoBarSubserviceSelection:
def __init__(self):
diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am
index a0ec450f..06571d81 100644
--- a/lib/python/Screens/Makefile.am
+++ b/lib/python/Screens/Makefile.am
@@ -6,7 +6,7 @@ install_PYTHON = \
MovieSelection.py Setup.py About.py HarddiskSetup.py FixedMenu.py \
Satconfig.py ScanSetup.py NetworkSetup.py Ci.py TimerEntry.py Volume.py \
EpgSelection.py EventView.py Mute.py Standby.py ServiceInfo.py \
- AudioSelection.py InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \
+ InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \
Dish.py LanguageSelection.py StartWizard.py \
TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \
Console.py InputBox.py ChoiceBox.py SimpleSummary.py ImageWizard.py \
diff --git a/lib/python/Screens/__init__.py b/lib/python/Screens/__init__.py
index f2681e34..30f39b1c 100644
--- a/lib/python/Screens/__init__.py
+++ b/lib/python/Screens/__init__.py
@@ -4,6 +4,6 @@ __all__ = ["ChannelSelection", "ClockDisplay", "ConfigMenu",
"TimerEdit", "Setup", "HarddiskSetup", "FixedMenu",
"Satconfig", "Scanconfig", "Ci.py", "Volume.py", "Mute.py",
"EpgSelection", "EventView", "Standby", "ServiceInfo",
- "AudioSelection", "InfoBarGenerics", "HelpMenu", "Wizard",
+ "InfoBarGenerics", "HelpMenu", "Wizard",
"PVRState", "Console", "InputBox", "ChoiceBox", "SimpleSummary",
"TimerSelection" ]