call saveAll from within def run... so now save connectedTo configEntries
[enigma2.git] / lib / python / Screens / Satconfig.py
index 49fc2b7b7ecae7bebfa8cd7b0ed975327a8c680b..7d44965824f6b6b9f59aaaa6f47e0366b5e075eb 100644 (file)
@@ -60,7 +60,7 @@ class NimSetup(Screen, ConfigListScreen):
                        choices["satposdepends"] = _("second cable of motorized LNB")
                if len(nimmanager.canConnectTo(self.slotid)) > 0:
                        choices["loopthrough"] = _("loopthrough to")
-               self.nim.config.configMode.setChoices(choices)
+               self.nimConfig.configMode.setChoices(choices)
                                                        
        def createSetup(self):
                print "Creating setup"
@@ -113,7 +113,7 @@ class NimSetup(Screen, ConfigListScreen):
                        elif self.nimConfig.configMode.value == "loopthrough":
                                choices = []
                                print "connectable to:", nimmanager.canConnectTo(self.slotid)
-                               connectable = nimmanager.canConnectTo(self.slotid) 
+                               connectable = nimmanager.canConnectTo(self.slotid)
                                for id in connectable:
                                        choices.append((str(id), nimmanager.getNimDescription(id)))
                                self.nimConfig.connectedTo.setChoices(choices)
@@ -200,6 +200,7 @@ class NimSetup(Screen, ConfigListScreen):
                                x[1].value = int(mktime(dt.timetuple()))
                        x[1].save()
                nimmanager.sec.update()
+               self.saveAll()
 
        def fillListWithAdvancedSatEntrys(self, Sat):
                currLnb = self.nimConfig.advanced.lnb[int(Sat.lnb.value)]
@@ -335,8 +336,6 @@ class NimSetup(Screen, ConfigListScreen):
                self.nimConfig = self.nim.config
                self.createConfigMode()
                self.createSetup()
-               # safeAll is needed, so that keyCancel works properly
-               self.saveAll()
 
        def keyLeft(self):
                ConfigListScreen.keyLeft(self)
@@ -345,7 +344,28 @@ class NimSetup(Screen, ConfigListScreen):
        def keyRight(self):
                ConfigListScreen.keyRight(self)
                self.newConfig()
+               
+       def saveAll(self):
+               if self.nim.isCompatible("DVB-S"):
+                       # reset connectedTo to all choices to properly store the default value
+                       choices = []
+                       nimlist = nimmanager.getNimListOfType("DVB-S", self.slotid)
+                       for id in nimlist:
+                               choices.append((str(id), nimmanager.getNimDescription(id)))
+                       self.nimConfig.connectedTo.setChoices(choices)
+               for x in self["config"].list:
+                       x[1].save()
+                       
+       def cancelConfirm(self, result):
+               if not result:
+                       return
 
+               for x in self["config"].list:
+                       x[1].cancel()
+               # we need to call saveAll to reset the connectedTo choices
+               self.saveAll()
+               self.close()
+                       
 class NimSelection(Screen):
        def __init__(self, session):
                Screen.__init__(self, session)