don't offer scanning on nims where nothing is connected
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 8 Sep 2009 09:19:12 +0000 (11:19 +0200)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 8 Sep 2009 09:19:12 +0000 (11:19 +0200)
data/startwizard.xml
lib/python/Components/NimManager.py
lib/python/Screens/ScanSetup.py

index c004a5e..70a6e0d 100644 (file)
@@ -73,7 +73,8 @@ self.selectKey("RIGHT")
                <step id="satlistsquestion">
                        <text value="Do you want to install default sat lists?" />
                        <condition>
-self.condition = config.misc.startwizard.doservicescan.value
+from Components.NimManager import nimmanager
+self.condition = config.misc.startwizard.doservicescan.value and nimmanager.somethingConnected()
                        </condition>
                        <code>
 self.hideRc()
@@ -87,7 +88,8 @@ self.hideRc()
                <step id="scanquestion">
                        <text value="Do you want to do a service scan?" />
                        <condition>
-self.condition = config.misc.startwizard.doservicescan.value
+from Components.NimManager import nimmanager
+self.condition = config.misc.startwizard.doservicescan.value and nimmanager.somethingConnected()
                        </condition>
                        <code>
 self.hideRc()
@@ -100,21 +102,24 @@ self.hideRc()
                </step>
                <step id="scan" nextstep="finisheddefaultsatlists">
                        <condition>
-self.condition = config.misc.startwizard.doservicescan.value
+from Components.NimManager import nimmanager
+self.condition = config.misc.startwizard.doservicescan.value and nimmanager.somethingConnected()
                        </condition>                    
                        <text value="What do you want to scan?" />
                        <config screen="ScanSimple" module="ScanSetup" type="ConfigList" />
                </step>
                <step id="manualscan">
                        <condition>
-self.condition = config.misc.startwizard.doservicescan.value
+from Components.NimManager import nimmanager
+self.condition = config.misc.startwizard.doservicescan.value and nimmanager.somethingConnected()
                        </condition>
                        <text value="What do you want to scan?" />
                        <config screen="ScanSetup" module="ScanSetup" type="ConfigList" />
                </step>
                <step id="nextscan">
                        <condition>
-self.condition = config.misc.startwizard.doservicescan.value
+from Components.NimManager import nimmanager
+self.condition = config.misc.startwizard.doservicescan.value and nimmanager.somethingConnected()
                        </condition>
                        <text value="Do you want to do another manual service scan?" />
                        <list>
index c278213..70cde47 100644 (file)
@@ -759,6 +759,22 @@ class NimManager:
 
        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 = []
index 2e48a96..d0af8f7 100644 (file)
@@ -883,6 +883,10 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                        need_scan = True
                                        print x, "not in ", known_networks
                                        known_networks.append(x)
+                                       
+                       # don't offer to scan nims if nothing is connected
+                       if not nimmanager.somethingConnected(nim.slot):
+                               need_scan = False                               
 
                        if need_scan:
                                nims_to_scan.append(nim)