X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FComponents%2FLcd.py;h=dde158b6a16f4c1d97d697b312f12f239a7637bb;hp=d547a58c523037a2284ad9c41d5c44638c3e9483;hb=c4a55fbb1dbb22ccd43bfd92f1ec9df4f811310f;hpb=6eeefece35e4269e02fdb7abab4f79d8e7b8f98b diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index d547a58..dde158b 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -1,42 +1,85 @@ -from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo - +from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo, ConfigNothing from enigma import eDBoxLCD +from Components.SystemInfo import SystemInfo 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: value = 255 eDBoxLCD.getInstance().setInverted(value) + def isOled(self): + return eDBoxLCD.getInstance().isOled() + +def leaveStandby(): + config.lcd.bright.apply() + +def standbyCounterChanged(configElement): + from Screens.Standby import inStandby + inStandby.onClose.append(leaveStandby) + config.lcd.standby.apply() + def InitLcd(): + detected = eDBoxLCD.getInstance().detected() + SystemInfo["Display"] = detected config.lcd = ConfigSubsection(); - config.lcd.bright = ConfigSlider(default=10, limits=(1, 10)) - config.lcd.contrast = ConfigSlider(default=10, limits=(1, 10)) - config.lcd.standby = ConfigSlider(default=0, limits=(1,10)) - config.lcd.invert = ConfigYesNo(default=False) + if detected: + def setLCDbright(configElement): + ilcd.setBright(configElement.value); + + def setLCDcontrast(configElement): + ilcd.setContrast(configElement.value); + + def setLCDinverted(configElement): + ilcd.setInverted(configElement.value); + + standby_default = 0 + + ilcd = LCD() + + if not ilcd.isOled(): + config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20)) + config.lcd.contrast.addNotifier(setLCDcontrast); + else: + config.lcd.contrast = ConfigNothing() + standby_default = 1 - ilcd = LCD() + config.lcd.standby = ConfigSlider(default=standby_default, limits=(0, 10)) + config.lcd.standby.addNotifier(setLCDbright); + config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby) - def setLCDbright(configElement): - ilcd.setBright(configElement.value); + config.lcd.bright = ConfigSlider(default=5, limits=(0, 10)) + config.lcd.bright.addNotifier(setLCDbright); + config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright) + config.lcd.bright.callNotifiersOnSaveAndCancel = True - def setLCDcontrast(configElement): - ilcd.setContrast(configElement.value); + config.lcd.invert = ConfigYesNo(default=False) + config.lcd.invert.addNotifier(setLCDinverted); + else: + def doNothing(): + pass + config.lcd.contrast = ConfigNothing() + config.lcd.bright = ConfigNothing() + config.lcd.standby = ConfigNothing() + config.lcd.bright.apply = lambda : doNothing() + config.lcd.standby.apply = lambda : doNothing() - def setLCDinverted(configElement): - ilcd.setInverted(configElement.value); + config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False) - config.lcd.bright.addNotifier(setLCDbright); - config.lcd.contrast.addNotifier(setLCDcontrast); - config.lcd.invert.addNotifier(setLCDinverted);