diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2009-11-03 19:40:42 +0100 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2009-11-03 19:40:42 +0100 |
| commit | f488e1db5b364c4df7135008a3b073a1d0ba06ca (patch) | |
| tree | 90b7675d265143361fad8f7f880d153797b0ff5c /lib/python/Components/config.py | |
| parent | f3a30a79a5dda5f33a9241de575bbf9fa66b4170 (diff) | |
| parent | 0fd217d2eef3ae87953e6622edb977aded899a52 (diff) | |
| download | enigma2-f488e1db5b364c4df7135008a3b073a1d0ba06ca.tar.gz enigma2-f488e1db5b364c4df7135008a3b073a1d0ba06ca.zip | |
Merge branch '219_negative_ac3_pcm_delay' into experimental
Diffstat (limited to 'lib/python/Components/config.py')
| -rwxr-xr-x | lib/python/Components/config.py | 36 |
1 files changed, 36 insertions, 0 deletions
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) |
