png cleanup by nemesis, source changes.
[enigma2.git] / lib / python / Components / RFmod.py
1 from config import config, ConfigSelection, ConfigSubsection, ConfigOnOff, ConfigSlider
2 from enigma import eRFmod
3 from Components.SystemInfo import SystemInfo
4
5 # CHECK ME.
6 RFMOD_CHANNEL_MIN = 21
7 RFMOD_CHANNEL_MAX = 69 + 1
8
9 class RFmod:
10         def __init__(self):
11                 pass
12
13         def setFunction(self, value):
14                 eRFmod.getInstance().setFunction(not value)
15         def setTestmode(self, value):
16                 eRFmod.getInstance().setTestmode(value)
17         def setSoundFunction(self, value):
18                 eRFmod.getInstance().setSoundFunction(not value)
19         def setSoundCarrier(self, value):
20                 eRFmod.getInstance().setSoundCarrier(value)
21         def setChannel(self, value):
22                 eRFmod.getInstance().setChannel(value)
23         def setFinetune(self, value):
24                 eRFmod.getInstance().setFinetune(value)
25
26 def InitRFmod():
27         detected = eRFmod.getInstance().detected()
28         SystemInfo["RfModulator"] = detected
29         if detected:
30                 config.rfmod = ConfigSubsection()
31                 config.rfmod.enable = ConfigOnOff(default=False)
32                 config.rfmod.test = ConfigOnOff(default=False)
33                 config.rfmod.sound = ConfigOnOff(default=True)
34                 config.rfmod.soundcarrier = ConfigSelection(choices=[("4500","4.5 MHz"), ("5500", "5.5 MHz"), ("6000", "6.0 MHz"), ("6500", "6.5 MHz")], default="5500")
35                 config.rfmod.channel = ConfigSelection(default = "36", choices = ["%d" % x for x in range(RFMOD_CHANNEL_MIN, RFMOD_CHANNEL_MAX)])
36                 config.rfmod.finetune = ConfigSlider(default=5, limits=(1, 10))
37
38                 iRFmod = RFmod()
39
40                 def setFunction(configElement):
41                         iRFmod.setFunction(configElement.value);
42                 def setTestmode(configElement):
43                         iRFmod.setTestmode(configElement.value);
44                 def setSoundFunction(configElement):
45                         iRFmod.setSoundFunction(configElement.value);
46                 def setSoundCarrier(configElement):
47                         iRFmod.setSoundCarrier(configElement.index);
48                 def setChannel(configElement):
49                         iRFmod.setChannel(int(configElement.value));
50                 def setFinetune(configElement):
51                         iRFmod.setFinetune(configElement.value - 5);
52
53                 # this will call the "setup-val" initial
54                 config.rfmod.enable.addNotifier(setFunction);
55                 config.rfmod.test.addNotifier(setTestmode);
56                 config.rfmod.sound.addNotifier(setSoundFunction);
57                 config.rfmod.soundcarrier.addNotifier(setSoundCarrier);
58                 config.rfmod.channel.addNotifier(setChannel);
59                 config.rfmod.finetune.addNotifier(setFinetune);