diff options
| -rw-r--r-- | data/setup.xml | 4 | ||||
| -rw-r--r-- | lib/python/Components/AVSwitch.py | 6 | ||||
| -rwxr-xr-x | lib/python/Components/config.py | 36 |
3 files changed, 41 insertions, 5 deletions
diff --git a/data/setup.xml b/data/setup.xml index fe91ba25..0d59d8b7 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -13,8 +13,8 @@ <item level="0" text="TV System">config.av.tvsystem</item> <item level="1" text="WSS on 4:3">config.av.wss</item> <item level="1" text="AC3 default">config.av.defaultac3</item> - <item level="1" text="General AC3 delay">config.av.generalAC3delay</item> - <item level="1" text="General PCM delay">config.av.generalPCMdelay</item> + <item level="1" text="General AC3 delay (ms)">config.av.generalAC3delay</item> + <item level="1" text="General PCM delay (ms)">config.av.generalPCMdelay</item> <item level="1" text="AC3 downmix" requires="CanDownmixAC3">config.av.downmix_ac3</item> <item level="1" text="Auto scart switching" requires="ScartSwitch">config.av.vcrswitch</item> </setup> diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index bc2a66a4..2658f9ba 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -1,5 +1,5 @@ from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, \ - ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigNumber, ConfigNothing, NoSave + ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigSelectionNumber, ConfigNothing, NoSave from enigma import eAVSwitch, getDesktop from SystemInfo import SystemInfo from os import path as os_path @@ -112,8 +112,8 @@ def InitAVSwitch(): config.av.tvsystem = ConfigSelection(choices = {"pal": _("PAL"), "ntsc": _("NTSC"), "multinorm": _("multinorm")}, default="pal") config.av.wss = ConfigEnableDisable(default = True) config.av.defaultac3 = ConfigYesNo(default = False) - config.av.generalAC3delay = ConfigNumber(default = 0) - config.av.generalPCMdelay = ConfigNumber(default = 0) + config.av.generalAC3delay = ConfigSelectionNumber(-1000, 1000, 25, default = 0) + config.av.generalPCMdelay = ConfigSelectionNumber(-1000, 1000, 25, default = 0) config.av.vcrswitch = ConfigEnableDisable(default = False) iAVSwitch = AVSwitch() diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index e249caf4..789ec32f 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1017,6 +1017,42 @@ class ConfigPassword(ConfigText): ConfigText.onDeselect(self, session) self.hidden = True +# lets the user select between [min, min+stepwidth, min+(stepwidth*2)..., maxval] with maxval <= max depending +# on the stepwidth +# min, max, stepwidth, default are int values +# wraparound: pressing RIGHT key at max value brings you to min value and vice versa if set to True +class ConfigSelectionNumber(ConfigSelection): + def __init__(self, min, max, stepwidth, default = None, wraparound = False): + self.wraparound = wraparound + if default is None: + default = min + default = str(default) + choices = [] + step = min + while step <= max: + choices.append(str(step)) + step += stepwidth + + ConfigSelection.__init__(self, choices, default) + + def getValue(self): + return int(self.text) + + def setValue(self, val): + self.text = str(val) + + def handleKey(self, key): + if not self.wraparound: + if key == KEY_RIGHT: + if len(self.choices) == (self.choices.index(self.value) + 1): + return + if key == KEY_LEFT: + if self.choices.index(self.value) == 0: + return + ConfigSelection.handleKey(self, key) + + + class ConfigNumber(ConfigText): def __init__(self, default = 0): ConfigText.__init__(self, str(default), fixed_size = False) |
