fixed sequence to floating point conversion in usals parameters
[enigma2.git] / lib / python / Components / AVSwitch.py
1 from config import *
2 import os
3 from enigma import *
4
5 class AVSwitch:
6         INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 }
7         def __init__(self):
8                 pass
9
10         def setColorFormat(self, value):
11                 eAVSwitch.getInstance().setColorFormat(value)
12                 
13         def setAspectRatio(self, value):
14                 eAVSwitch.getInstance().setAspectRatio(value)
15
16         def setSystem(self, value):
17                 print "system:" + str(value)
18                 eAVSwitch.getInstance().setVideomode(value)
19
20         def setWSS(self, value):
21                 #print "wss:" + str(value)
22                 pass
23         
24         def setInput(self, input):
25                 eAVSwitch.getInstance().setInput(self.INPUT[input])
26
27 def InitAVSwitch():
28         config.av = ConfigSubsection();
29         config.av.colorformat = configElement("config.av.colorformat", configSelection, 1, (("cvbs", _("CVBS")), ("rgb", _("RGB")), ("svideo", _("S-Video")) ));
30         config.av.aspectratio = configElement("config.av.aspectratio", configSelection, 0, (("4_3_letterbox", _("4:3 Letterbox")), ("4_3_panscan", _("4:3 PanScan")), ("16_9", _("16:9")), ("16_9_always", _("16:9 always"))) );
31         #config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") );
32         config.av.tvsystem = configElement("config.av.tvsystem", configSelection, 0, (("pal", _("PAL")), ("ntsc", _("NTSC"))) );
33         config.av.wss = configElement("config.av.wss", configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))) );
34         config.av.defaultac3 = configElement("config.av.defaultac3", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))));
35         config.av.vcrswitch = configElement("config.av.vcrswitch", configSelection, 1, (("enable", _("Enable")), ("disable", _("Disable"))));
36
37         iAVSwitch = AVSwitch()
38
39         def setColorFormat(configElement):
40                 iAVSwitch.setColorFormat(configElement.value);
41         def setAspectRatio(configElement):
42                 iAVSwitch.setAspectRatio(configElement.value);
43         def setSystem(configElement):
44                 iAVSwitch.setSystem(configElement.value);
45         def setWSS(configElement):
46                 iAVSwitch.setWSS(configElement.value);
47
48         # this will call the "setup-val" initial
49         config.av.colorformat.addNotifier(setColorFormat);
50         config.av.aspectratio.addNotifier(setAspectRatio);
51         config.av.tvsystem.addNotifier(setSystem);
52         config.av.wss.addNotifier(setWSS);
53         
54         iAVSwitch.setInput("ENCODER") # init on startup