1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.ConfigList import ConfigList
4 from Components.config import *
5 from Components.MenuList import MenuList
6 from Components.NimManager import nimmanager
8 class NimSetup(Screen):
9 def createSimpleSetup(self, nim, list, mode):
11 b = config.Nims[nim.slotid].diseqcA
12 item = b.controlType(b)
13 if mode == 0: #single Sat
14 list.append( ("Satellite", item) )
16 list.append( ("Port A", item) )
18 if mode >= 1: # > 1 Sats
19 b = config.Nims[nim.slotid].diseqcB
20 item = b.controlType(b)
21 list.append( ("Port B", item) )
22 if mode >= 3: # > 2 Sats
23 b = config.Nims[nim.slotid].diseqcC
24 item = b.controlType(b)
25 list.append( ("Port C", item) )
27 b = config.Nims[nim.slotid].diseqcD
28 item = b.controlType(b)
29 list.append( ("Port D", item) )
31 def createSetup(self):
34 b = config.Nims[self.nim.slotid].configMode
35 item = b.controlType(b)
36 self.list.append( ("Configmode", item) )
38 if b.value == 0: #simple setup
39 b = config.Nims[self.nim.slotid].diseqcMode
40 item = b.controlType(b)
41 self.list.append( ("Diseqcmode", item) )
43 self.createSimpleSetup(self.nim, self.list, b.value)
45 print "FIXME: implement advanced mode"
47 self["config"].list = self.list
48 self["config"].l.setList(self.list)
51 if self["config"].getCurrent()[0] == "Diseqcmode":
53 if self["config"].getCurrent()[0] == "Configmode":
57 self["config"].handleKey(config.key["prevElement"])
61 self["config"].handleKey(config.key["nextElement"])
65 for x in self["config"].list:
70 for x in self["config"].list:
74 def __init__(self, session, nim):
75 Screen.__init__(self, session)
78 self["actions"] = ActionMap(["SetupActions"],
81 "cancel": self.keyCancel,
83 "right": self.keyRight
87 self["config"] = ConfigList(self.list)
91 class NimSelection(Screen):
92 def __init__(self, session):
93 Screen.__init__(self, session)
95 self["nimlist"] = MenuList(nimmanager.nimList())
97 self["actions"] = ActionMap(["OkCancelActions"],
99 "ok": self.okbuttonClick ,
103 def okbuttonClick(self):
104 selection = self["nimlist"].getCurrent()
105 if selection[1].nimType != -1: #unknown/empty
106 self.session.open(NimSetup, selection[1])