Merge remote branch 'origin/bug_306_sort_by_date'
[enigma2.git] / lib / python / Components / NimManager.py
index 1dff777af3189fa1f4f404cfa1ecbbecbdda2702..00d0609544488a78928521519d0647009b87e9c8 100644 (file)
@@ -554,6 +554,13 @@ class NimManager:
        def getSatDescription(self, pos):
                return self.satellites[pos]
 
+       def sortFunc(self, x):
+               orbpos = x[0]
+               if orbpos > 1800:
+                       return orbpos - 3600
+               else:
+                       return orbpos + 1800
+
        def readTransponders(self):
                # read initial networks from file. we only read files which we are interested in,
                # which means only these where a compatible tuner exists.
@@ -565,7 +572,7 @@ class NimManager:
                if self.hasNimType("DVB-S"):
                        print "Reading satellites.xml"
                        db.readSatellites(self.satList, self.satellites, self.transponders)
-                       self.satList.sort(key = lambda x: x[0]) # sort by orbpos
+                       self.satList.sort(key = self.sortFunc) # sort by orbpos
                        #print "SATLIST", self.satList
                        #print "SATS", self.satellites
                        #print "TRANSPONDERS", self.transponders
@@ -800,15 +807,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)
@@ -892,7 +899,7 @@ def InitSecParams():
        x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER, configElement.value))
        config.sec.delay_after_voltage_change_before_measure_idle_inputpower = x
 
-       x = ConfigInteger(default=750, limits = (0, 9999))
+       x = ConfigInteger(default=900, limits = (0, 9999))
        x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD, configElement.value))
        config.sec.delay_after_enable_voltage_before_motor_command = x
 
@@ -1206,10 +1213,21 @@ def InitNimManager(nimmgr):
                                tmp.lnb = lnb
                                nim.advanced.sat[x] = tmp
 
+       def toneAmplitudeChanged(configElement):
+               fe_id = configElement.fe_id
+               slot_id = configElement.slot_id
+               if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2':
+                       open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value)
+
+       empty_slots = 0
        for slot in nimmgr.nim_slots:
                x = slot.slot
                nim = config.Nims[x]
                if slot.isCompatible("DVB-S"):
+                       nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7")
+                       nim.toneAmplitude.fe_id = x - empty_slots
+                       nim.toneAmplitude.slot_id = x
+                       nim.toneAmplitude.addNotifier(toneAmplitudeChanged)
                        nim.diseqc13V = ConfigYesNo(False)
                        nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b")
                        nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x])
@@ -1299,6 +1317,7 @@ def InitNimManager(nimmgr):
                        nim.terrestrial = ConfigSelection(choices = list)
                        nim.terrestrial_5V = ConfigOnOff()
                else:
+                       empty_slots += 1
                        nim.configMode = ConfigSelection(choices = { "nothing": _("disabled") }, default="nothing");
                        if slot.type is not None:
                                print "pls add support for this frontend type!", slot.type