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
9 from xml.dom import EMPTY_NAMESPACE
10 from skin import elementsWithTag
11 from Tools import XMLTools
14 def __init__(self, slotid, nimtype, name):
16 self.nimType = nimtype
20 def readSatsfromFile(self):
23 satfile = file('/etc/tuxbox/satellites.xml', 'r')
24 satdom = xml.dom.minidom.parseString(satfile.read())
27 for entries in elementsWithTag(satdom.childNodes, "satellites"):
28 for x in elementsWithTag(entries.childNodes, "sat"):
29 #print "found sat " + x.getAttribute('name') + " " + str(x.getAttribute('position'))
30 self.satellites[x.getAttribute('position')] = x.getAttribute('name')
32 def getNimType(self, slotID):
33 #FIXME get it from /proc
35 return self.nimType["DVB-S"]
37 return self.nimType["empty/unknown"]
39 def getNimName(self, slotID):
40 #FIXME get it from /proc
43 def getNimSocketCount(self):
44 #FIXME get it from /proc
47 def getConfigPrefix(self, slotid):
48 return "config.Nim" + ("A","B","C","D")[slotid] + "."
52 self.nimType = { "empty/unknown": -1,
57 self.readSatsfromFile()
59 self.nimCount = self.getNimSocketCount()
63 while x < self.nimCount:
64 tType = self.getNimType(x)
65 tName = self.getNimName(x)
66 tNim = nimSlot(x, tType, tName)
67 self.nimslots.append(tNim)
70 InitNimManager(self) #init config stuff
74 for slot in self.nimslots:
75 nimText = "Socket " + ("A", "B", "C", "D")[slot.slotid] + ": "
76 if slot.nimType == -1:
77 nimText += "empty/unknown"
79 nimText += slot.name + " ("
80 nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")"
81 list.append((nimText, slot))
84 def InitNimManager(nimmgr):
85 config.Nims = [ConfigSubsection()] * nimmgr.nimCount
87 for slot in nimmgr.nimslots:
89 cname = nimmgr.getConfigPrefix(x)
91 if slot.nimType == nimmgr.nimType["DVB-S"]:
92 #use custom configElement which can handle a dict (for sats)
93 config.Nims[x].configMode = configElement(cname + "configMode",configSelection, 0, ("Simple", "Advanced"));
94 config.Nims[x].diseqcMode = configElement(cname + "diseqcMode",configSelection, 0, ("Single", "Toneburst A/B", "DiSEqC A/B"));
95 config.Nims[x].diseqcMode = configElement(cname + "diseqcA",configSelection, 0, ("Astra", "Hotbird"));
96 config.Nims[x].diseqcMode = configElement(cname + "diseqcB",configSelection, 0, ("Astra", "Hotbird"));
97 config.Nims[x].diseqcMode = configElement(cname + "diseqcC",configSelection, 0, ("Astra", "Hotbird"));
98 config.Nims[x].diseqcMode = configElement(cname + "diseqcD",configSelection, 0, ("Astra", "Hotbird"));
100 print "pls add support for this frontend type!"
104 #def inputDevicesRepeatChanged(configElement):
105 # iDevices.setRepeat(configElement.value);
107 #def inputDevicesDelayChanged(configElement):
108 # iDevices.setDelay(configElement.value);
110 # this will call the "setup-val" initial
111 #config.inputDevices.repeat.addNotifier(inputDevicesRepeatChanged);
112 #config.inputDevices.delay.addNotifier(inputDevicesDelayChanged);
114 nimmanager = NimManager()