NimManager.py: another fix of satellite sort order .. now we sort from the westernmos...
[enigma2.git] / lib / python / Components / NimManager.py
index c278213c6726029eb4e9869305a82c46cc97db25..05204a74c3b51795db5e125cba992375e891c126 100644 (file)
@@ -554,6 +554,13 @@ class NimManager:
        def getSatDescription(self, pos):
                return self.satellites[pos]
 
        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.
        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,9 +572,10 @@ class NimManager:
                if self.hasNimType("DVB-S"):
                        print "Reading satellites.xml"
                        db.readSatellites(self.satList, self.satellites, self.transponders)
                if self.hasNimType("DVB-S"):
                        print "Reading satellites.xml"
                        db.readSatellites(self.satList, self.satellites, self.transponders)
-#                      print "SATLIST", self.satList
-#                      print "SATS", self.satellites
-#                      print "TRANSPONDERS", self.transponders
+                       self.satList.sort(key = self.sortFunc) # sort by orbpos
+                       #print "SATLIST", self.satList
+                       #print "SATS", self.satellites
+                       #print "TRANSPONDERS", self.transponders
 
                if self.hasNimType("DVB-C"):
                        print "Reading cables.xml"
 
                if self.hasNimType("DVB-C"):
                        print "Reading cables.xml"
@@ -759,6 +767,22 @@ class NimManager:
 
        def getSatList(self):
                return self.satList
 
        def getSatList(self):
                return self.satList
+       
+       # returns True if something is configured to be connected to this nim
+       # if slotid == -1, returns if something is connected to ANY nim
+       def somethingConnected(self, slotid = -1):
+               if (slotid == -1):
+                       connected = False
+                       for id in range(self.getSlotCount()):
+                               if self.somethingConnected(id):
+                                       connected = True
+                       return connected
+               else:
+                       nim = config.Nims[slotid]
+                       configMode = nim.configMode.value
+               
+                       if self.nim_slots[slotid].isCompatible("DVB-S") or self.nim_slots[slotid].isCompatible("DVB-T") or self.nim_slots[slotid].isCompatible("DVB-C"):
+                               return not (configMode == "nothing")            
 
        def getSatListForNim(self, slotid):
                list = []
 
        def getSatListForNim(self, slotid):
                list = []
@@ -923,7 +947,7 @@ def InitNimManager(nimmgr):
 
        lnb_choices = {
                "universal_lnb": _("Universal LNB"),
 
        lnb_choices = {
                "universal_lnb": _("Universal LNB"),
-               "unicable": _("Unicable"),
+#              "unicable": _("Unicable"),
                "c_band": _("C-Band"),
                "user_defined": _("User defined")}
 
                "c_band": _("C-Band"),
                "user_defined": _("User defined")}