added lcd controls
[enigma2.git] / lib / python / Components / SetupDevices.py
index c8c05f4ee51f8b1c1761970d14c01f42f982de5b..7ffdd1095730d64352985cefe35af209103ea4bf 100644 (file)
@@ -1,3 +1,5 @@
+import os
+
 from config import config                              #global config instance
 
 from config import configElement
@@ -5,6 +7,18 @@ from config import ConfigSubsection
 from config import ConfigSlider
 from config import configBoolean
 
+#temp. class for exhibition
+
+class LCD:
+       def __init__(self):
+               pass
+
+       def setBright(self, value):
+               os.system("lcddimm " + str(value * 10))
+
+       def setContrast(self, value):
+               os.system("lcdcontrast " + str(value * 6))
+
 def InitSetupDevices():
        config.timezone = ConfigSubsection();
        config.timezone.val = configElement("", configBoolean, 1, ("GMT", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5", "GMT+6", "GMT+7", "GMT+8", "GMT+9") );
@@ -12,13 +26,13 @@ def InitSetupDevices():
        config.rc = ConfigSubsection();
        config.rc.map = configElement("", configBoolean, 0, ("Default", "Classic") );
 
-       config.av = ConfigSubsection();
-       config.av.colorformat = configElement("", configBoolean, 1, ("CVBS", "RGB", "S-Video") );
-       config.av.aspectratio = configElement("", configBoolean, 0, ("4:3 Letterbox", "4:3 PanScan", "16:9", "16:9 always") );
-       config.av.tvsystem = configElement("", configBoolean, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") );
-       config.av.wss = configElement("", configBoolean, 0, ("Enable", "Disable") );
-       config.av.defaultac3 = configElement("", configBoolean, 1, ("Enable", "Disable") );
-       config.av.vcrswitch = configElement("", configBoolean, 0, ("Enable", "Disable") );
+#      config.av = ConfigSubsection();
+#      config.av.colorformat = configElement("", configBoolean, 1, ("CVBS", "RGB", "S-Video") );
+#      config.av.aspectratio = configElement("", configBoolean, 0, ("4:3 Letterbox", "4:3 PanScan", "16:9", "16:9 always") );
+#      config.av.tvsystem = configElement("", configBoolean, 0, ("PAL", "PAL + PAL60", "Multi", "NTSC") );
+#      config.av.wss = configElement("", configBoolean, 0, ("Enable", "Disable") );
+#      config.av.defaultac3 = configElement("", configBoolean, 1, ("Enable", "Disable") );
+#      config.av.vcrswitch = configElement("", configBoolean, 0, ("Enable", "Disable") );
 
        config.rfmod = ConfigSubsection();
        config.rfmod.enable = configElement("", configBoolean, 1, ("Enable", "Disable") );
@@ -39,9 +53,21 @@ def InitSetupDevices():
 
        config.lcd = ConfigSubsection();
        config.lcd.bright = configElement("", ConfigSlider, 7, "");
+       config.lcd.contrast = configElement("", ConfigSlider, 2, "");
        config.lcd.standby = configElement("", ConfigSlider, 1, "");
        config.lcd.invert = configElement("", configBoolean, 1, ("Enable", "Disable") );
 
+       ilcd = LCD()
+
+       def setLCDbright(configElement):
+               ilcd.setBright(configElement.value);
+
+       def setLCDcontrast(configElement):
+               ilcd.setContrast(configElement.value);
+
+       config.lcd.bright.addNotifier(setLCDbright);
+       config.lcd.contrast.addNotifier(setLCDcontrast);
+
        config.parental = ConfigSubsection();
        config.parental.lock = configElement("", configBoolean, 1, ("Enable", "Disable") );
        config.parental.setuplock = configElement("", configBoolean, 1, ("Enable", "Disable") );