prepare skinning of python GUIComponents
[enigma2.git] / lib / python / Components / Lcd.py
index ea0c37a1d99c5de8cfbf45033a1257acab995602..b043f393a636ac5464916ffe9ce517ddd3df074d 100644 (file)
@@ -1,22 +1,24 @@
-from config import config                              #global config instance
-from config import configSlider
-from config import configSelection
-from config import ConfigSubsection
-from config import configElement
+from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo
 
-from enigma import *
+from enigma import eDBoxLCD
 
 class LCD:
        def __init__(self):
                pass
 
        def setBright(self, value):
-               eDBoxLCD.getInstance().setLCDBrightness(value * 20)
-               pass
+               value *= 255
+               value /= 10
+               if value > 255:
+                       value = 255
+               eDBoxLCD.getInstance().setLCDBrightness(value)
 
        def setContrast(self, value):
+               value *= 63
+               value /= 20
+               if value > 63:
+                       value = 63
                eDBoxLCD.getInstance().setLCDContrast(value)
-               pass
 
        def setInverted(self, value):
                if value:
@@ -25,10 +27,10 @@ class LCD:
 
 def InitLcd():
        config.lcd = ConfigSubsection();
-       config.lcd.bright = configElement("config.lcd.bright", configSlider, 10, (1, 10))
-       config.lcd.contrast = configElement("config.lcd.contrast", configSlider, 10, (1, 10))
-       config.lcd.standby = configElement("config.lcd.standby", configSlider, 0, (1,10))
-       config.lcd.invert = configElement("config.lcd.invert", configSelection, 0, (("disable", _("Disable")), ("enable", _("Enable"))))
+       config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
+       config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
+       config.lcd.standby = ConfigSlider(default=0, limits=(0, 10))
+       config.lcd.invert = ConfigYesNo(default=False)
 
        ilcd = LCD()
 
@@ -44,6 +46,3 @@ def InitLcd():
        config.lcd.bright.addNotifier(setLCDbright);
        config.lcd.contrast.addNotifier(setLCDcontrast);
        config.lcd.invert.addNotifier(setLCDinverted);
-       
-
-