aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Lcd.py
blob: 77975f4d18fa326f2d26d6a3be060e1aea51554e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from config import config				#global config instance
from config import ConfigSlider
from config import configSelection
from config import ConfigSubsection
from config import configElement

from enigma import *

class LCD:
	def __init__(self):
		pass

	def setBright(self, value):
		eDBoxLCD.getInstance().setLCDBrightness(value * 20)
		pass

	def setContrast(self, value):
		eDBoxLCD.getInstance().setLCDContrast(value)
		pass

	def setInverted(self, value):
		if value:
			value = 255
		eDBoxLCD.getInstance().setInverted(1 - value)
		pass

def InitLcd():
	config.lcd = ConfigSubsection();
	config.lcd.bright = configElement("config.lcd.bright", ConfigSlider, 10, "")
	config.lcd.contrast = configElement("config.lcd.contrast", ConfigSlider, 10, "")
	config.lcd.standby = configElement("config.lcd.standby", ConfigSlider, 0, "")
	config.lcd.invert = configElement("config.lcd.invert", configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))))

	ilcd = LCD()

	def setLCDbright(configElement):
		ilcd.setBright(configElement.value);

	def setLCDcontrast(configElement):
		ilcd.setContrast(configElement.value);

	def setLCDinverted(configElement):
		ilcd.setInverted(configElement.value);

	config.lcd.bright.addNotifier(setLCDbright);
	config.lcd.contrast.addNotifier(setLCDcontrast);
	config.lcd.invert.addNotifier(setLCDinverted);