add multisat scan setup for the case of using a dish positioner
[enigma2.git] / lib / python / Screens / ScanSetup.py
1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.ConfigList import ConfigList
4 from Components.config import config
5 from Components.config import getConfigListEntry
6 from Components.NimManager import nimmanager
7
8 class ScanSetup(Screen):
9     def __init__(self, session):
10         Screen.__init__(self, session)
11         
12         self["actions"] = ActionMap(["SetupActions"],
13         {
14             "ok": self.keySave,
15             "cancel": self.keyCancel,
16             "left": self.keyLeft,
17             "right": self.keyRight
18         }, -1)
19
20         self.list = []
21         self["config"] = ConfigList(self.list)
22         self.createSetup()
23         
24     def createSetup(self):
25         self.list = []
26         
27         self.list.append(getConfigListEntry("Type of scan", config.scan.type))
28         self.list.append(getConfigListEntry("Tuner", config.scan.nims))
29         
30         # single transponder scan
31         if (config.scan.type.value == 0):
32             if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
33                 self.list.append(getConfigListEntry("Frequency", config.scan.sat.frequency))
34                 self.list.append(getConfigListEntry("Inversion", config.scan.sat.inversion))
35                 self.list.append(getConfigListEntry("Symbolrate", config.scan.sat.symbolrate))
36                 self.list.append(getConfigListEntry("Polarity", config.scan.sat.polarzation))
37                 self.list.append(getConfigListEntry("FEC", config.scan.sat.fec))
38             if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
39                 self.list.append(getConfigListEntry("Frequency", config.scan.cab.frequency))
40                 self.list.append(getConfigListEntry("Inversion", config.scan.cab.inversion))
41                 self.list.append(getConfigListEntry("Symbolrate", config.scan.cab.symbolrate))
42                 self.list.append(getConfigListEntry("Modulation", config.scan.cab.modulation))
43                 self.list.append(getConfigListEntry("FEC", config.scan.cab.fec))
44             if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
45                 self.list.append(getConfigListEntry("Frequency", config.scan.ter.frequency))
46                 self.list.append(getConfigListEntry("Inversion", config.scan.ter.inversion))
47                 self.list.append(getConfigListEntry("Bandwidth", config.scan.ter.bandwidth))
48                 self.list.append(getConfigListEntry("Code rate high", config.scan.ter.fechigh))
49                 self.list.append(getConfigListEntry("Code rate low", config.scan.ter.feclow))
50                 self.list.append(getConfigListEntry("Modulation", config.scan.ter.modulation))
51                 self.list.append(getConfigListEntry("Transmission mode", config.scan.ter.transmission))
52                 self.list.append(getConfigListEntry("Guard interval mode", config.scan.ter.guard))
53                 self.list.append(getConfigListEntry("Hierarchy mode", config.scan.ter.hierarchy))
54
55         # single satellite scan
56         if (config.scan.type.value == 1):
57             pass
58         
59         # multi sat scan
60         if (config.scan.type.value == 2):
61             for sat in nimmanager.satList:
62                 self.list.append(getConfigListEntry(sat[0], config.scan.scansat[sat[1]]))                
63                 
64         self["config"].list = self.list
65         self["config"].l.setList(self.list)
66         
67     def newConfig(self):
68         print self["config"].getCurrent()
69         if self["config"].getCurrent()[0] == "Type of scan":
70             self.createSetup()
71         if self["config"].getCurrent()[0] == "Tuner":
72             self.createSetup()
73         
74     def keyLeft(self):
75         self["config"].handleKey(config.key["prevElement"])
76         self.newConfig()
77
78     def keyRight(self):
79         self["config"].handleKey(config.key["nextElement"])
80         self.newConfig()
81
82     def keySave(self):
83         for x in self["config"].list:
84             x[1].save()
85         self.close()
86
87     def keyCancel(self):
88         for x in self["config"].list:
89             x[1].cancel()
90         self.close()