1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.ConfigList import ConfigList, ConfigListScreen
4 from Components.MenuList import MenuList
5 from Components.NimManager import nimmanager
6 from Components.config import getConfigListEntry, config, ConfigDummy
8 class NimSetup(Screen, ConfigListScreen):
9 def createSimpleSetup(self, list, mode):
11 list.append(getConfigListEntry(_("Satellite"), self.nimConfig.diseqcA))
13 list.append(getConfigListEntry(_("Port A"), self.nimConfig.diseqcA))
15 if mode in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
16 list.append(getConfigListEntry(_("Port B"), self.nimConfig.diseqcB))
17 if mode == "diseqc_a_b_c_d":
18 list.append(getConfigListEntry(_("Port C"), self.nimConfig.diseqcC))
19 list.append(getConfigListEntry(_("Port D"), self.nimConfig.diseqcD))
21 def createPositionerSetup(self, list):
22 # list.append(getConfigListEntry(_("Positioner mode"), self.nimConfig.positionerMode))
23 # if self.nimConfig.positionerMode.value == "usals": # USALS
24 list.append(getConfigListEntry(_("Longitude"), self.nimConfig.longitude))
25 list.append(getConfigListEntry(" ", self.nimConfig.longitudeOrientation))
26 list.append(getConfigListEntry(_("Latitude"), self.nimConfig.latitude))
27 list.append(getConfigListEntry(" ", self.nimConfig.latitudeOrientation))
28 # elif self.nimConfig.positionerMode.value == "manual": # manual
31 def createSetup(self):
32 print "Creating setup"
35 self.configMode = None
36 self.diseqcModeEntry = None
37 self.advancedSatsEntry = None
38 self.advancedLnbsEntry = None
39 self.advancedDiseqcMode = None
40 self.advancedUsalsEntry = None
41 self.advancedLof = None
42 self.advancedPowerMeasurement = None
44 self.nim_type = nimmanager.getNimType(self.nim.slotid)
46 if self.nim_type == nimmanager.nimType["DVB-S"]:
47 self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
48 self.list.append(self.configMode)
50 if self.nimConfig.configMode.value == "simple": #simple setup
51 self.diseqcModeEntry = getConfigListEntry(_("DiSEqC Mode"), self.nimConfig.diseqcMode)
52 self.list.append(self.diseqcModeEntry)
53 if self.nimConfig.diseqcMode.value in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]:
54 self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
55 if self.nimConfig.diseqcMode.value == "positioner":
56 self.createPositionerSetup(self.list)
57 elif self.nimConfig.configMode.value in ["loopthrough", "satposdepends", "nothing", "equal"]:
59 elif self.nimConfig.configMode.value == "advanced": # advanced
61 self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
62 self.list.append(self.advancedSatsEntry)
63 print "blub", self.nimConfig.advanced.sat
64 currSat = self.nimConfig.advanced.sat[self.nimConfig.advanced.sats.orbital_position]
65 self.fillListWithAdvancedSatEntrys(currSat)
66 self.have_advanced = True
67 elif self.nim_type == nimmanager.nimType["DVB-C"]:
68 self.list.append(getConfigListEntry(_("Cable provider"), self.nimConfig.cable))
69 self.have_advanced = False
70 elif self.nim_type == nimmanager.nimType["DVB-T"]:
71 self.have_advanced = False
72 self.list.append(getConfigListEntry(_("Terrestrial provider"), self.nimConfig.terrestrial))
73 self.list.append(getConfigListEntry(_("Enable 5V for active antenna"), self.nimConfig.terrestrial_5V))
75 self.have_advanced = False
77 self["config"].list = self.list
78 self["config"].l.setList(self.list)
81 checkList = (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, self.advancedLof, self.advancedPowerMeasurement)
83 if self["config"].getCurrent() == x:
87 if self.have_advanced and config.Nims[self.nim.slotid].configMode.value == "advanced":
88 self.fillAdvancedList()
89 for x in self["config"].list:
91 nimmanager.sec.update()
93 def fillListWithAdvancedSatEntrys(self, Sat):
94 currLnb = self.nimConfig.advanced.lnb[int(Sat.lnb.value)]
96 if isinstance(currLnb, ConfigDummy):
99 self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage))
100 self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode))
101 if currLnb and currLnb.diseqcMode.value == "1_2":
102 self.advancedUsalsEntry = getConfigListEntry(_("Use usals for this sat"), Sat.usals)
103 self.list.append(self.advancedUsalsEntry)
104 if not Sat.usals.value:
105 self.list.append(getConfigListEntry(_("Stored position"), Sat.rotorposition))
108 self.advancedLnbsEntry = getConfigListEntry(_("LNB"), Sat.lnb)
109 self.list.append(self.advancedLnbsEntry)
111 self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode)
112 self.list.append(self.advancedDiseqcMode)
113 if currLnb.diseqcMode.value != "none":
114 self.list.append(getConfigListEntry(_("Toneburst"), currLnb.toneburst))
115 self.list.append(getConfigListEntry(_("Committed DiSEqC command"), currLnb.commitedDiseqcCommand))
116 self.list.append(getConfigListEntry(_("Fast DiSEqC"), currLnb.fastDiseqc))
117 self.list.append(getConfigListEntry(_("Sequence repeat"), currLnb.sequenceRepeat))
118 if currLnb.diseqcMode.value == "1_0":
119 self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder1_0))
121 self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder))
122 self.list.append(getConfigListEntry(_("Uncommitted DiSEqC command"), currLnb.uncommittedDiseqcCommand))
123 self.list.append(getConfigListEntry(_("DiSEqC repeats"), currLnb.diseqcRepeats))
124 if currLnb.diseqcMode.value == "1_2":
125 self.list.append(getConfigListEntry(_("Longitude"), currLnb.longitude))
126 self.list.append(getConfigListEntry(" ", currLnb.longitudeOrientation))
127 self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude))
128 self.list.append(getConfigListEntry(" ", currLnb.latitudeOrientation))
129 self.advancedPowerMeasurement = getConfigListEntry("Use Power Measurement", currLnb.powerMeasurement)
130 self.list.append(self.advancedPowerMeasurement)
131 if currLnb.powerMeasurement.value == "yes":
132 self.list.append(getConfigListEntry("Power Threshold in mA", currLnb.powerThreshold))
133 self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof)
134 self.list.append(self.advancedLof)
135 if currLnb.lof.value == "user_defined":
136 self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl))
137 self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh))
138 self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold))
139 self.list.append(getConfigListEntry(_("12V Output"), currLnb.output_12v))
140 self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage))
142 def fillAdvancedList(self):
144 self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
145 self.list.append(self.configMode)
146 self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
147 self.list.append(self.advancedSatsEntry)
148 for x in nimmanager.satList:
149 Sat = self.nimConfig.advanced.sat[x[0]]
150 self.fillListWithAdvancedSatEntrys(Sat)
151 self["config"].list = self.list
158 for x in self["config"].list:
162 def __init__(self, session, slotid):
163 Screen.__init__(self, session)
166 ConfigListScreen.__init__(self, self.list)
168 self["actions"] = ActionMap(["SetupActions"],
171 "cancel": self.keyCancel,
174 self.nim = nimmanager.nimList()[slotid][1]
175 self.nimConfig = config.Nims[self.nim.slotid]
179 ConfigListScreen.keyLeft(self)
183 ConfigListScreen.keyRight(self)
186 class NimSelection(Screen):
187 def __init__(self, session):
188 Screen.__init__(self, session)
190 self["nimlist"] = MenuList(nimmanager.nimList())
192 self["actions"] = ActionMap(["OkCancelActions"],
194 "ok": self.okbuttonClick ,
198 def okbuttonClick(self):
199 selection = self["nimlist"].getCurrent()
200 if selection[1].nimType != -1: #unknown/empty
201 self.session.open(NimSetup, selection[1].slotid)