From: ghost Date: Sat, 7 Nov 2009 13:28:36 +0000 (+0100) Subject: Merge branch 'bug_258_sorting_of_configsatlist' into experimental X-Git-Tag: 3.0.0~28^2~66^2~207 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/f3d145e1d246e25b3fda5796216552ccbbdde1f0?hp=-c Merge branch 'bug_258_sorting_of_configsatlist' into experimental --- f3d145e1d246e25b3fda5796216552ccbbdde1f0 diff --combined lib/python/Components/NimManager.py index 3c3aa26c,8d6cff16..5ca80ce7 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@@ -800,15 -800,15 +800,15 @@@ class NimManager dm = nim.diseqcMode.value if dm in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): if nim.diseqcA.orbital_position != 3601: - list.append(nim.diseqcA.getSat()) + list.append(self.satList[nim.diseqcA.index-1]) if dm in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): if nim.diseqcB.orbital_position != 3601: - list.append(nim.diseqcB.getSat()) + list.append(self.satList[nim.diseqcB.index-1]) if dm == "diseqc_a_b_c_d": if nim.diseqcC.orbital_position != 3601: - list.append(nim.diseqcC.getSat()) + list.append(self.satList[nim.diseqcC.index-1]) if nim.diseqcD.orbital_position != 3601: - list.append(nim.diseqcD.getSat()) + list.append(self.satList[nim.diseqcD.index-1]) if dm == "positioner": for x in self.satList: list.append(x) @@@ -940,7 -940,7 +940,7 @@@ def InitNimManager(nimmgr) lnb_choices = { "universal_lnb": _("Universal LNB"), -# "unicable": _("Unicable"), + "unicable": _("Unicable"), "c_band": _("C-Band"), "user_defined": _("User defined")} diff --combined lib/python/Components/config.py index a596b96d,e249caf4..876e3a34 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@@ -1,6 -1,6 +1,6 @@@ from enigma import getPrevAsciiCode from Tools.NumericalTextInput import NumericalTextInput -from Tools.Directories import resolveFilename, SCOPE_CONFIG +from Tools.Directories import resolveFilename, SCOPE_CONFIG, fileExists from Components.Harddisk import harddiskmanager from copy import copy as copy_copy from os import path as os_path @@@ -1017,42 -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) @@@ -1184,24 -1148,12 +1184,12 @@@ class ConfigSatlist(ConfigSelection) def __init__(self, list, default = None): if default is not None: default = str(default) - self._satList = list - choices = [(str(orbpos), desc) for (orbpos, desc, flags) in list] - - ConfigSelection.__init__(self, choices = choices, default = default) + ConfigSelection.__init__(self, choices = [(str(orbpos), desc) for (orbpos, desc, flags) in list], default = default) - # use this function to get the orbital position, don't rely on .index def getOrbitalPosition(self): if self.value == "": return None return int(self.value) - - def getSatList(self): - return self._satList - - def getSat(self): - return self.satList[self.index] - - satList = property(getSatList) orbital_position = property(getOrbitalPosition) @@@ -1297,6 -1249,7 +1285,6 @@@ class ConfigLocations(ConfigElement) self.default = default self.locations = [] self.mountpoints = [] - harddiskmanager.on_partition_list_change.append(self.mountpointsChanged) self.value = default[:] def setValue(self, value): @@@ -1333,7 -1286,7 +1321,7 @@@ locations = [[x, None, False, False] for x in tmp] self.refreshMountpoints() for x in locations: - if os_path.exists(x[0]): + if fileExists(x[0]): x[1] = self.getMountpoint(x[0]) x[2] = True self.locations = locations @@@ -1352,11 -1305,20 +1340,11 @@@ return False return self.tostring([x[0] for x in locations]) != sv - def mountpointsChanged(self, action, dev): - print "Mounts changed: ", action, dev - mp = dev.mountpoint+"/" - if action == "add": - self.addedMount(mp) - elif action == "remove": - self.removedMount(mp) - self.refreshMountpoints() - def addedMount(self, mp): for x in self.locations: if x[1] == mp: x[2] = True - elif x[1] == None and os_path.exists(x[0]): + elif x[1] == None and fileExists(x[0]): x[1] = self.getMountpoint(x[0]) x[2] = True @@@ -1366,7 -1328,7 +1354,7 @@@ x[2] = False def refreshMountpoints(self): - self.mountpoints = [p.mountpoint + "/" for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] + self.mountpoints = [p.mountpoint for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] self.mountpoints.sort(key = lambda x: -len(x)) def checkChangedMountpoints(self):