X-Git-Url: http://code.vuplus.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2FComponents%2Fconfig.py;h=0245a4f4ead961275fe71dc518d53fa74dec1b5b;hb=7bee809a45d982abe2bb7376f1e4420103ffc907;hp=4850ca3569fe57a24d48035c411900bd2f8dae48;hpb=a759137c52904daf4d707ca82930595ad0b13f8a;p=vuplus_dvbapp diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 4850ca3..0245a4f 100644 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -55,10 +55,9 @@ class configSelection: def checkValues(self): if self.parent.value < 0: - self.parent.value = 0 - - if(self.parent.value >= (len(self.parent.vals) - 1)): - self.parent.value = len(self.parent.vals) - 1 + self.parent.value = len(self.parent.vals) - 1 + elif(self.parent.value > (len(self.parent.vals) - 1)): + self.parent.value = 0 def cancel(self): self.parent.reload() @@ -78,7 +77,7 @@ class configSelection: def __call__(self, selected): #needed by configlist self.checkValues() - return ("text", self.parent.vals[self.parent.value]) + return ("text", _(self.parent.vals[self.parent.value])) class configDateTime: def __init__(self, parent): @@ -342,6 +341,7 @@ class Config: "9": 19 } config = Config(); + configfile = configFile() class ConfigSlider: @@ -498,3 +498,9 @@ def getConfigListEntry(description, element): b = element item = b.controlType(b) return ((description, item)) + + +def configElementBoolean(name, default, texts=(_("Enable"), _("Disable"))): + return configElement(name, configSelection, default, texts) + +config.misc = ConfigSubsection()