dont show display setup in menu, when no display is available
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 15 Feb 2008 17:28:23 +0000 (17:28 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 15 Feb 2008 17:28:23 +0000 (17:28 +0000)
data/menu.xml
lib/gdi/lcd.h
lib/python/Components/Lcd.py

index 977a209..cc0d410 100644 (file)
@@ -62,7 +62,7 @@
                                <!--<item text="Remote Control"><setup id="rc" /></item>-->
                                <!--<item text="Keyboard"><setup id="keyboard" /></item>-->
                                <!--<item text="OSD"><setup id="osd" /></item>-->
-                               <item><setup level="1" id="lcd" /></item>
+                               <item requires="Display"><setup level="1" id="lcd" /></item>
                                <menu level="1" text="Network..." entryID="network_setup">
                                        <id val="network" />
                                        <item level="1" text="Device Setup..." entryID="device_setup"><screen module="NetworkSetup" screen="NetworkAdapterSelection"/></item>
index e45d88b..99f921b 100644 (file)
@@ -27,6 +27,7 @@ public:
        int lock();
        void unlock();
        int islocked() { return locked; }
+       bool detected() { return lcdfd >= 0; }
 #ifndef SWIG
        eLCD(eSize size);
        virtual ~eLCD();
index eb3e3df..e722250 100644 (file)
@@ -1,6 +1,6 @@
 from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo, ConfigNothing
-
 from enigma import eDBoxLCD
+from Components.SystemInfo import SystemInfo
 
 class LCD:
        def __init__(self):
@@ -29,32 +29,34 @@ class LCD:
                return eDBoxLCD.getInstance().isOled()
 
 def InitLcd():
+       detected = eDBoxLCD.getInstance().detected()
+       SystemInfo["Display"] = detected
+       if detected:
+               def setLCDbright(configElement):
+                       ilcd.setBright(configElement.value);
 
-       def setLCDbright(configElement):
-               ilcd.setBright(configElement.value);
-
-       def setLCDcontrast(configElement):
-               ilcd.setContrast(configElement.value);
+               def setLCDcontrast(configElement):
+                       ilcd.setContrast(configElement.value);
 
-       def setLCDinverted(configElement):
-               ilcd.setInverted(configElement.value);
+               def setLCDinverted(configElement):
+                       ilcd.setInverted(configElement.value);
 
-       ilcd = LCD()
+               ilcd = LCD()
 
-       config.lcd = ConfigSubsection();
+               config.lcd = ConfigSubsection();
 
-       config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
-       config.lcd.bright.addNotifier(setLCDbright);
-       config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright)
+               config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
+               config.lcd.bright.addNotifier(setLCDbright);
+               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()
+               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.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 = ConfigYesNo(default=False)
+               config.lcd.invert.addNotifier(setLCDinverted);