use builtin python functions instead of use os.system
[enigma2.git] / lib / python / Screens / ScanSetup.py
index be0f87e431bc3b21fbd7322095850f5e9808866b..b14c7e7482b219e84431274d662415b512b90be5 100644 (file)
@@ -1,4 +1,5 @@
 from Screen import Screen
 from Screen import Screen
+from Screens.DefaultWizard import DefaultWizard
 from ServiceScan import ServiceScan
 from Components.config import config, ConfigSubsection, ConfigSelection, \
        ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigEnableDisable
 from ServiceScan import ServiceScan
 from Components.config import config, ConfigSubsection, ConfigSelection, \
        ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigEnableDisable
@@ -6,6 +7,7 @@ from Components.ActionMap import NumberActionMap, ActionMap
 from Components.ConfigList import ConfigListScreen
 from Components.NimManager import nimmanager, getConfigSatlist
 from Components.Label import Label
 from Components.ConfigList import ConfigListScreen
 from Components.NimManager import nimmanager, getConfigSatlist
 from Components.Label import Label
+from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITION
 from Screens.MessageBox import MessageBox
 from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, \
        eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, \
 from Screens.MessageBox import MessageBox
 from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, \
        eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, \
@@ -277,6 +279,27 @@ class CableTransponderSearchSupport:
                tmpstr += "\n\n..."
                self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO)
 
                tmpstr += "\n\n..."
                self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO)
 
+class DefaultSatLists(DefaultWizard):
+       def __init__(self, session, silent = True, showSteps = False):
+               self.xmlfile = "defaultsatlists.xml"
+               DefaultWizard.__init__(self, session, silent, showSteps, neededTag = "services")
+               print "configuredSats:", nimmanager.getConfiguredSats()
+
+       def setDirectory(self):
+               self.directory = []
+               self.directory.append(resolveFilename(SCOPE_DEFAULTDIR))
+               import os
+               os.system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)))
+               self.directory.append(resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR))
+                               
+       def statusCallback(self, status, progress):
+               print "statusCallback:", status, progress
+               from Components.DreamInfoHandler import DreamInfoHandler
+               if status == DreamInfoHandler.STATUS_DONE:
+                       self["text"].setText(_("The installation of the default services lists is finished.") + "\n\n" + _("Please press OK to continue."))
+                       self.markDone()
+                       self.disableKeys = False        
+
 class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
        def __init__(self, session):
                Screen.__init__(self, session)
 class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
        def __init__(self, session):
                Screen.__init__(self, session)
@@ -494,7 +517,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                        if frontendData.get("system", "DVB-S") == "DVB-S2":
                                                defaultSat["fec_s2"] = {"FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_4_5": "4_5", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_9_10": "9_10"} \
                                                                                        [frontendData.get("fec_inner", "FEC_AUTO")]
                                        if frontendData.get("system", "DVB-S") == "DVB-S2":
                                                defaultSat["fec_s2"] = {"FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_4_5": "4_5", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_9_10": "9_10"} \
                                                                                        [frontendData.get("fec_inner", "FEC_AUTO")]
-                                               defaultSat["rolloff"] = {"ROLLOFF_0_35" : "0_35", "ROLLOFF_0_25" : "0_25", "0_20" : "ROLLOFF_0_20"}[frontendData.get("rolloff", "ROLLOFF_0_35")]
+                                               defaultSat["rolloff"] = {"ROLLOFF_0_35" : "0_35", "ROLLOFF_0_25" : "0_25", "ROLLOFF_0_20" : "0_20"}[frontendData.get("rolloff", "ROLLOFF_0_35")]
                                                defaultSat["pilot"] = {"PILOT_ON" : "on", "PILOT_OFF" : "off", "PILOT_AUTO" : "auto"}[frontendData.get("pilot", "PILOT_AUTO")]
                                        else:
                                                defaultSat["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_NONE": "none"} \
                                                defaultSat["pilot"] = {"PILOT_ON" : "on", "PILOT_OFF" : "off", "PILOT_AUTO" : "auto"}[frontendData.get("pilot", "PILOT_AUTO")]
                                        else:
                                                defaultSat["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_NONE": "none"} \
@@ -774,18 +797,6 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport):
        def getNetworksForNim(self, nim):
                if nim.isCompatible("DVB-S"):
                        networks = nimmanager.getSatListForNim(nim.slot)
        def getNetworksForNim(self, nim):
                if nim.isCompatible("DVB-S"):
                        networks = nimmanager.getSatListForNim(nim.slot)
-# the original code took "loopthrough" etc. into account. Do we need this?
-#                      if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]:
-#                              return False
-#                      sec = eDVBSatelliteEquipmentControl.getInstance()
-#                      if sec is not None:
-#                              exclusive_satellites = sec.get_exclusive_satellites(0,1)
-#                              if len(exclusive_satellites) == 2:
-#                                      return False
-#                              idx = exclusive_satellites[0]+1
-#                              exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
-#                              if len(exclusive_nim_sats):
-#                                      return True
                elif not nim.empty:
                        networks = [ nim.type ] # "DVB-C" or "DVB-T". TODO: seperate networks for different C/T tuners, if we want to support that.
                else:
                elif not nim.empty:
                        networks = [ nim.type ] # "DVB-C" or "DVB-T". TODO: seperate networks for different C/T tuners, if we want to support that.
                else: