1 from config import config #global config instance
3 from config import configElement
4 from config import ConfigSubsection
5 from config import ConfigSlider
6 from config import configSelection
7 from config import configSatlist
10 from xml.dom import EMPTY_NAMESPACE
11 from skin import elementsWithTag
12 from Tools import XMLTools
15 def __init__(self, slotid, nimtype, name):
17 self.nimType = nimtype
21 def readSatsfromFile(self):
24 satfile = file('/etc/tuxbox/satellites.xml', 'r')
25 satdom = xml.dom.minidom.parseString(satfile.read())
28 for entries in elementsWithTag(satdom.childNodes, "satellites"):
29 for x in elementsWithTag(entries.childNodes, "sat"):
30 #print "found sat " + x.getAttribute('name') + " " + str(x.getAttribute('position'))
31 tpos = x.getAttribute('position')
32 tname = x.getAttribute('name')
34 self.satellites[tpos] = tname
35 self.satList.append( (tname, tpos) )
37 def getNimType(self, slotID):
38 #FIXME get it from /proc
40 return self.nimType["DVB-S"]
42 return self.nimType["empty/unknown"]
44 def getNimName(self, slotID):
45 #FIXME get it from /proc
48 def getNimSocketCount(self):
49 #FIXME get it from /proc
52 def getConfigPrefix(self, slotid):
53 return "config.Nim" + ("A","B","C","D")[slotid] + "."
57 self.nimType = { "empty/unknown": -1,
63 self.readSatsfromFile()
65 self.nimCount = self.getNimSocketCount()
69 while x < self.nimCount:
70 tType = self.getNimType(x)
71 tName = self.getNimName(x)
72 tNim = nimSlot(x, tType, tName)
73 self.nimslots.append(tNim)
76 InitNimManager(self) #init config stuff
80 for slot in self.nimslots:
81 nimText = "Socket " + ("A", "B", "C", "D")[slot.slotid] + ": "
82 if slot.nimType == -1:
83 nimText += "empty/unknown"
85 nimText += slot.name + " ("
86 nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")"
87 list.append((nimText, slot))
90 def InitNimManager(nimmgr):
91 config.Nims = [ConfigSubsection()] * nimmgr.nimCount
93 for slot in nimmgr.nimslots:
95 cname = nimmgr.getConfigPrefix(x)
97 if slot.nimType == nimmgr.nimType["DVB-S"]:
98 #use custom configElement which can handle a dict (for sats)
99 config.Nims[x].configMode = configElement(cname + "configMode",configSelection, 0, ("Simple", "Advanced"));
100 config.Nims[x].diseqcMode = configElement(cname + "diseqcMode",configSelection, 0, ("Single", "Toneburst A/B", "DiSEqC A/B", "DiSEqC A/B/C/D"));
101 config.Nims[x].diseqcA = configElement(cname + "diseqcA",configSatlist, 0, nimmgr.satList);
102 config.Nims[x].diseqcB = configElement(cname + "diseqcB",configSatlist, 0, nimmgr.satList);
103 config.Nims[x].diseqcC = configElement(cname + "diseqcC",configSatlist, 0, nimmgr.satList);
104 config.Nims[x].diseqcD = configElement(cname + "diseqcD",configSatlist, 0, nimmgr.satList);
106 print "pls add support for this frontend type!"
110 #def inputDevicesRepeatChanged(configElement):
111 # iDevices.setRepeat(configElement.value);
113 #def inputDevicesDelayChanged(configElement):
114 # iDevices.setDelay(configElement.value);
116 # this will call the "setup-val" initial
117 #config.inputDevices.repeat.addNotifier(inputDevicesRepeatChanged);
118 #config.inputDevices.delay.addNotifier(inputDevicesDelayChanged);
120 nimmanager = NimManager()