NetworkSetup: fix help onleft/right, fix reload
[enigma2.git] / lib / python / Screens / Satconfig.py
index e95a5b4620bbdc86418359447a6b8b1a08bb4a96..f3ab6be31cf1cf6e199d6616226efa2186a8f299 100644 (file)
@@ -1,9 +1,11 @@
+from enigma import eDVBDB
 from Screen import Screen
 from Components.ActionMap import ActionMap
 from Components.ConfigList import ConfigListScreen
 from Components.MenuList import MenuList
 from Components.NimManager import nimmanager
 from Components.config import getConfigListEntry, config, ConfigNothing
 from Screen import Screen
 from Components.ActionMap import ActionMap
 from Components.ConfigList import ConfigListScreen
 from Components.MenuList import MenuList
 from Components.NimManager import nimmanager
 from Components.config import getConfigListEntry, config, ConfigNothing
+from Screens.MessageBox import MessageBox
 
 from time import mktime, localtime
 from datetime import datetime
 
 from time import mktime, localtime
 from datetime import datetime
@@ -118,6 +120,7 @@ class NimSetup(Screen, ConfigListScreen):
                        self.have_advanced = False
                elif self.nim.isCompatible("DVB-T"):
                        self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
                        self.have_advanced = False
                elif self.nim.isCompatible("DVB-T"):
                        self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
+                       self.list.append(self.configMode)
                        self.have_advanced = False
                        if self.nimConfig.configMode.value == "enabled":
                                self.list.append(getConfigListEntry(_("Terrestrial provider"), self.nimConfig.terrestrial))
                        self.have_advanced = False
                        if self.nimConfig.configMode.value == "enabled":
                                self.list.append(getConfigListEntry(_("Terrestrial provider"), self.nimConfig.terrestrial))
@@ -138,7 +141,7 @@ class NimSetup(Screen, ConfigListScreen):
        def run(self):
                if self.have_advanced and self.nim.config_mode == "advanced":
                        self.fillAdvancedList()
        def run(self):
                if self.have_advanced and self.nim.config_mode == "advanced":
                        self.fillAdvancedList()
-               for x in self["config"].list:
+               for x in self.list:
                        if x in [self.turnFastEpochBegin, self.turnFastEpochEnd]:
                                # workaround for storing only hour*3600+min*60 value in configfile
                                # not really needed.. just for cosmetics..
                        if x in [self.turnFastEpochBegin, self.turnFastEpochEnd]:
                                # workaround for storing only hour*3600+min*60 value in configfile
                                # not really needed.. just for cosmetics..
@@ -216,8 +219,38 @@ class NimSetup(Screen, ConfigListScreen):
                self["config"].list = self.list
 
        def keySave(self):
                self["config"].list = self.list
 
        def keySave(self):
+               old_configured_sats = nimmanager.getConfiguredSats()
                self.run()
                self.run()
-               self.close()
+               new_configured_sats = nimmanager.getConfiguredSats()
+               self.unconfed_sats = old_configured_sats - new_configured_sats
+               self.satpos_to_remove = None
+               self.deleteConfirmed(False)
+
+       def deleteConfirmed(self, confirmed):
+               if confirmed:
+                       eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)
+
+               if self.satpos_to_remove is not None:
+                       self.unconfed_sats.remove(self.satpos_to_remove)
+
+               self.satpos_to_remove = None
+               for orbpos in self.unconfed_sats:
+                       self.satpos_to_remove = orbpos
+                       orbpos = self.satpos_to_remove
+                       try:
+                               # why we need this cast?
+                               sat_name = str(nimmanager.getSatDescription(orbpos))
+                       except:
+                               if orbpos > 1800: # west
+                                       orbpos = 3600 - orbpos
+                                       h = _("W")
+                               else:
+                                       h = _("E")
+                               sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
+                       self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Delete no more configured satellite\n%s?") %(sat_name))
+                       break
+               if not self.satpos_to_remove:
+                       self.close()
 
        def __init__(self, session, slotid):
                Screen.__init__(self, session)
 
        def __init__(self, session, slotid):
                Screen.__init__(self, session)