Merge remote branch 'origin/bug_380_stop_service_entering_tuner_setup'
[enigma2.git] / lib / python / Screens / Satconfig.py
index e24e4636e0cf9285d2f252d64f9d886b16b8677e..62480b5f5249261da6d069cb2a604cbb5e51166f 100644 (file)
@@ -5,15 +5,17 @@ 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, ConfigSelection, updateConfigElement
+from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement,\
+       ConfigSatlist
 from Components.Sources.List import List
 from Screens.MessageBox import MessageBox
 from Screens.ChoiceBox import ChoiceBox
+from Screens.ServiceStopScreen import ServiceStopScreen
 
 from time import mktime, localtime
 from datetime import datetime
 
-class NimSetup(Screen, ConfigListScreen):
+class NimSetup(Screen, ConfigListScreen, ServiceStopScreen):
        def createSimpleSetup(self, list, mode):
                nim = self.nimConfig
                if mode == "single":
@@ -145,6 +147,8 @@ class NimSetup(Screen, ConfigListScreen):
                                        currSat = self.nimConfig.advanced.sat[cur_orb_pos]
                                        self.fillListWithAdvancedSatEntrys(currSat)
                                self.have_advanced = True
+                       if self.nim.description == "Alps BSBE2" and config.usage.setup_level.index >= 2: # expert
+                               self.list.append(getConfigListEntry(_("Tone Amplitude"), self.nimConfig.toneAmplitude))
                elif self.nim.isCompatible("DVB-C"):
                        self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
                        self.list.append(self.configMode)
@@ -373,18 +377,22 @@ class NimSetup(Screen, ConfigListScreen):
                                self.deleteConfirmed(confirmed)
                        break
                if not self.satpos_to_remove:
-                       self.close()
+                       self.restoreService(_("Zap back to service before tuner setup?"))
                
        def __init__(self, session, slotid):
                Screen.__init__(self, session)
                self.list = [ ]
+               
+               ServiceStopScreen.__init__(self)
+               self.stopService()
 
                ConfigListScreen.__init__(self, self.list)
 
-               self["actions"] = ActionMap(["SetupActions"],
+               self["actions"] = ActionMap(["SetupActions", "SatlistShortcutAction"],
                {
                        "ok": self.keySave,
                        "cancel": self.keyCancel,
+                       "nothingconnected": self.nothingConnectedShortcut
                }, -2)
 
                self.slotid = slotid
@@ -401,6 +409,12 @@ class NimSetup(Screen, ConfigListScreen):
                ConfigListScreen.keyRight(self)
                self.newConfig()
                
+       def keyCancel(self):
+               if self["config"].isChanged():
+                       self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
+               else:
+                       self.restoreService(_("Zap back to service before tuner setup?"))
+               
        def saveAll(self):
                if self.nim.isCompatible("DVB-S"):
                        # reset connectedTo to all choices to properly store the default value
@@ -420,7 +434,12 @@ class NimSetup(Screen, ConfigListScreen):
                        x[1].cancel()
                # we need to call saveAll to reset the connectedTo choices
                self.saveAll()
-               self.close()
+               self.restoreService(_("Zap back to service before tuner setup?"))
+               
+       def nothingConnectedShortcut(self):
+               if type(self["config"].getCurrent()[1]) is ConfigSatlist:
+                       self["config"].getCurrent()[1].setValue("3601")
+                       self["config"].invalidateCurrent()
                        
 class NimSelection(Screen):
        def __init__(self, session):