X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/3b38fb5a9b457616263dff213a7a44436d75d216..c2bbed774d6e5c51b4af23a60a95aca74aa5d4e9:/lib/python/Components/config.py diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 4ddcabec..d79337ba 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -604,6 +604,34 @@ class ConfigClock(ConfigSequence): t = time.localtime(default) ConfigSequence.__init__(self, seperator = ":", limits = [(0,23),(0,59)], default = [t.tm_hour, t.tm_min]) + def increment(self): + # Check if Minutes maxed out + if self._value[1] == 59: + # Check if Hours not maxed out + if self._value[0] < 23: + # Increment Hour, reset Minutes to 0 + self._value[0] += 1 + self._value[1] = 0 + else: + # Increment Minutes + self._value[1] += 1 + # Trigger change + self.changed() + + def decrement(self): + # Check if Minutes is minimum + if self._value[1] == 0: + # Check if Hour is greater than 0 + if self._value[0] > 0: + # Decrement Hour, set Minutes to 59 + self._value[0] -= 1 + self._value[1] = 59 + else: + # Decrement Minutes + self._value[1] -= 1 + # Trigger change + self.changed() + class ConfigInteger(ConfigSequence): def __init__(self, default, limits = (0, 9999999999)): ConfigSequence.__init__(self, seperator = ":", limits = [limits], default = default) @@ -782,12 +810,12 @@ class ConfigText(ConfigElement, NumericalTextInput): def getValue(self): return self.text.encode("utf-8") - + def setValue(self, val): try: self.text = val.decode("utf-8") except UnicodeDecodeError: - self.text = val + self.text = val.decode("utf-8", "ignore") print "Broken UTF8!" value = property(getValue, setValue)