dont show display contrast setting in display setup when a oled is detected
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 26 Nov 2007 12:39:43 +0000 (12:39 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 26 Nov 2007 12:39:43 +0000 (12:39 +0000)
make standby display brightness working

lib/gdi/lcd.h
lib/python/Components/Lcd.py
lib/python/Screens/Setup.py
lib/python/Screens/Standby.py

index de49571..e45d88b 100644 (file)
@@ -56,6 +56,7 @@ public:
        int setLCDContrast(int contrast);
        int setLCDBrightness(int brightness);
        void setInverted( unsigned char );
        int setLCDContrast(int contrast);
        int setLCDBrightness(int brightness);
        void setInverted( unsigned char );
+       bool isOled() const { return !!is_oled; }
        void update();
 };
 
        void update();
 };
 
index b043f39..eb3e3df 100644 (file)
@@ -1,4 +1,4 @@
-from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo
+from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo, ConfigNothing
 
 from enigma import eDBoxLCD
 
 
 from enigma import eDBoxLCD
 
@@ -25,14 +25,10 @@ class LCD:
                        value = 255
                eDBoxLCD.getInstance().setInverted(value)
 
                        value = 255
                eDBoxLCD.getInstance().setInverted(value)
 
-def InitLcd():
-       config.lcd = ConfigSubsection();
-       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)
+       def isOled(self):
+               return eDBoxLCD.getInstance().isOled()
 
 
-       ilcd = LCD()
+def InitLcd():
 
        def setLCDbright(configElement):
                ilcd.setBright(configElement.value);
 
        def setLCDbright(configElement):
                ilcd.setBright(configElement.value);
@@ -43,6 +39,22 @@ def InitLcd():
        def setLCDinverted(configElement):
                ilcd.setInverted(configElement.value);
 
        def setLCDinverted(configElement):
                ilcd.setInverted(configElement.value);
 
+       ilcd = LCD()
+
+       config.lcd = ConfigSubsection();
+
+       config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
        config.lcd.bright.addNotifier(setLCDbright);
        config.lcd.bright.addNotifier(setLCDbright);
-       config.lcd.contrast.addNotifier(setLCDcontrast);
+       config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright)
+
+       if not ilcd.isOled():
+               config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
+               config.lcd.contrast.addNotifier(setLCDcontrast);
+       else:
+               config.lcd.contrast = ConfigNothing()
+
+       config.lcd.standby = ConfigSlider(default=0, limits=(0, 10))
+       config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby)
+
+       config.lcd.invert = ConfigYesNo(default=False)
        config.lcd.invert.addNotifier(setLCDinverted);
        config.lcd.invert.addNotifier(setLCDinverted);
index 1f262e3..3439954 100644 (file)
@@ -1,6 +1,6 @@
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
-from Components.config import config
+from Components.config import config, ConfigNothing
 from Components.ConfigList import ConfigListScreen
 from Components.Label import Label
 from Components.Pixmap import Pixmap
 from Components.ConfigList import ConfigListScreen
 from Components.Label import Label
 from Components.Pixmap import Pixmap
@@ -138,7 +138,8 @@ class Setup(ConfigListScreen, Screen):
                                item = b
                                # the first b is the item itself, ignored by the configList.
                                # the second one is converted to string.
                                item = b
                                # the first b is the item itself, ignored by the configList.
                                # the second one is converted to string.
-                               list.append( (item_text, item) )
+                               if not isinstance(item, ConfigNothing):
+                                       list.append( (item_text, item) )
 
 def getSetupTitle(id):
        xmldata = setupdom.childNodes[0].childNodes
 
 def getSetupTitle(id):
        xmldata = setupdom.childNodes[0].childNodes
index 6807c1a..b8af16f 100644 (file)
@@ -2,7 +2,7 @@ from Screen import Screen
 from Components.ActionMap import ActionMap
 from Components.config import config
 from Components.AVSwitch import AVSwitch
 from Components.ActionMap import ActionMap
 from Components.config import config
 from Components.AVSwitch import AVSwitch
-from enigma import eDVBVolumecontrol, eDBoxLCD
+from enigma import eDVBVolumecontrol
 from Components.Sources.Source import ObsoleteSource
 
 inStandby = None
 from Components.Sources.Source import ObsoleteSource
 
 inStandby = None
@@ -18,7 +18,7 @@ class Standby(Screen):
                #unmute adc
                self.leaveMute()
                #set brightness of lcd
                #unmute adc
                self.leaveMute()
                #set brightness of lcd
-               eDBoxLCD.getInstance().setLCDBrightness(config.lcd.bright.value * 20)
+               config.lcd.bright.apply()
                #kill me
                self.close(True)
 
                #kill me
                self.close(True)
 
@@ -54,7 +54,7 @@ class Standby(Screen):
                #set input to vcr scart
                self.avswitch.setInput("SCART")
                #set lcd brightness to standby value
                #set input to vcr scart
                self.avswitch.setInput("SCART")
                #set lcd brightness to standby value
-               eDBoxLCD.getInstance().setLCDBrightness(config.lcd.standby.value * 20)
+               config.lcd.standby.apply()
                self.onShow.append(self.__onShow)
                self.onHide.append(self.__onHide)
 
                self.onShow.append(self.__onShow)
                self.onHide.append(self.__onHide)