add vcr scart switch to main menu
[vuplus_dvbapp] / 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", "RGB", "S-Video") );
30         config.av.aspectratio = configElement("config.av.aspectratio", configSelection, 0, ("4:3 Letterbox", "4:3 PanScan", "16:9", "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", "NTSC") );
33         config.av.wss = configElement("config.av.wss", configSelection, 0, ("Enable", "Disable") );
34         config.av.defaultac3 = configElement("config.av.defaultac3", configSelection, 1, ("Enable", "Disable") );
35         config.av.vcrswitch = configElement("config.av.vcrswitch", configSelection, 1, ("Enable", "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