From d89be097be4a9ac52166c5f47cc189c5522d3441 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Fri, 1 Feb 2008 23:15:24 +0000 Subject: add possibilty to hide menu entries when needed hardware is not available --- lib/python/Components/AVSwitch.py | 3 ++ lib/python/Components/Harddisk.py | 4 +++ lib/python/Components/Makefile.am | 2 +- lib/python/Components/RFmod.py | 65 +++++++++++++++++++----------------- lib/python/Components/UsageConfig.py | 3 ++ 5 files changed, 45 insertions(+), 32 deletions(-) (limited to 'lib/python/Components') diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index d3224fd7..ab17fd82 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -1,5 +1,6 @@ from config import config, ConfigSelection, ConfigYesNo, ConfigEnableDisable, ConfigSubsection, ConfigBoolean from enigma import eAVSwitch +from SystemInfo import SystemInfo class AVSwitch: INPUT = { "ENCODER": (0, 4), "SCART": (1, 3), "AUX": (2, 4) } @@ -120,3 +121,5 @@ def InitAVSwitch(): config.av.wss.addNotifier(setWSS) iAVSwitch.setInput("ENCODER") # init on startup + SystemInfo["ScartSwitch"] = eAVSwitch.getInstance().haveScartSwitch() + diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 16736b20..82535447 100644 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -3,6 +3,8 @@ from os import system, listdir, statvfs, popen, makedirs from Tools.Directories import SCOPE_HDD, resolveFilename from Tools.CList import CList +from SystemInfo import SystemInfo + def tryOpen(filename): try: procFile = open(filename) @@ -215,6 +217,8 @@ class HarddiskManager: hdd = Harddisk(hddNum) self.hdd.append(hdd) + SystemInfo["Harddisc"] = len(self.hdd) > 0 + # currently, this is just an enumeration of what's possible, # this probably has to be changed to support automount stuff. # still, if stuff is mounted into the correct mountpoints by diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am index 03c5d1c2..7a17eb74 100644 --- a/lib/python/Components/Makefile.am +++ b/lib/python/Components/Makefile.am @@ -17,4 +17,4 @@ install_PYTHON = \ FIFOList.py ServiceEventTracker.py Input.py TimerSanityCheck.py FileList.py \ MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py ChoiceList.py \ Element.py Playlist.py ParentalControl.py ParentalControlList.py \ - Ipkg.py SelectionList.py Scanner.py + Ipkg.py SelectionList.py Scanner.py SystemInfo.py diff --git a/lib/python/Components/RFmod.py b/lib/python/Components/RFmod.py index be088a53..a8f7c9f5 100644 --- a/lib/python/Components/RFmod.py +++ b/lib/python/Components/RFmod.py @@ -1,5 +1,6 @@ from config import config, ConfigSelection, ConfigSubsection, ConfigOnOff, ConfigSlider from enigma import eRFmod +from Components.SystemInfo import SystemInfo # CHECK ME. RFMOD_CHANNEL_MIN = 21 @@ -23,34 +24,36 @@ class RFmod: eRFmod.getInstance().setFinetune(value) def InitRFmod(): - - config.rfmod = ConfigSubsection() - config.rfmod.enable = ConfigOnOff(default=False) - config.rfmod.test = ConfigOnOff(default=False) - config.rfmod.sound = ConfigOnOff(default=True) - config.rfmod.soundcarrier = ConfigSelection(choices=[("4500","4.5 MHz"), ("5500", "5.5 MHz"), ("6000", "6.0 MHz"), ("6500", "6.5 MHz")], default="5500") - config.rfmod.channel = ConfigSelection(default = "36", choices = ["%d" % x for x in range(RFMOD_CHANNEL_MIN, RFMOD_CHANNEL_MAX)]) - config.rfmod.finetune = ConfigSlider(default=5, limits=(1, 10)) - - iRFmod = RFmod() - - def setFunction(configElement): - iRFmod.setFunction(configElement.value); - def setTestmode(configElement): - iRFmod.setTestmode(configElement.value); - def setSoundFunction(configElement): - iRFmod.setSoundFunction(configElement.value); - def setSoundCarrier(configElement): - iRFmod.setSoundCarrier(configElement.index); - def setChannel(configElement): - iRFmod.setChannel(int(configElement.value)); - def setFinetune(configElement): - iRFmod.setFinetune(configElement.value - 5); - - # this will call the "setup-val" initial - config.rfmod.enable.addNotifier(setFunction); - config.rfmod.test.addNotifier(setTestmode); - config.rfmod.sound.addNotifier(setSoundFunction); - config.rfmod.soundcarrier.addNotifier(setSoundCarrier); - config.rfmod.channel.addNotifier(setChannel); - config.rfmod.finetune.addNotifier(setFinetune); + detected = eRFmod.getInstance().detected() + SystemInfo["RfModulator"] = detected + if detected: + config.rfmod = ConfigSubsection() + config.rfmod.enable = ConfigOnOff(default=False) + config.rfmod.test = ConfigOnOff(default=False) + config.rfmod.sound = ConfigOnOff(default=True) + config.rfmod.soundcarrier = ConfigSelection(choices=[("4500","4.5 MHz"), ("5500", "5.5 MHz"), ("6000", "6.0 MHz"), ("6500", "6.5 MHz")], default="5500") + config.rfmod.channel = ConfigSelection(default = "36", choices = ["%d" % x for x in range(RFMOD_CHANNEL_MIN, RFMOD_CHANNEL_MAX)]) + config.rfmod.finetune = ConfigSlider(default=5, limits=(1, 10)) + + iRFmod = RFmod() + + def setFunction(configElement): + iRFmod.setFunction(configElement.value); + def setTestmode(configElement): + iRFmod.setTestmode(configElement.value); + def setSoundFunction(configElement): + iRFmod.setSoundFunction(configElement.value); + def setSoundCarrier(configElement): + iRFmod.setSoundCarrier(configElement.index); + def setChannel(configElement): + iRFmod.setChannel(int(configElement.value)); + def setFinetune(configElement): + iRFmod.setFinetune(configElement.value - 5); + + # this will call the "setup-val" initial + config.rfmod.enable.addNotifier(setFunction); + config.rfmod.test.addNotifier(setTestmode); + config.rfmod.sound.addNotifier(setSoundFunction); + config.rfmod.soundcarrier.addNotifier(setSoundCarrier); + config.rfmod.channel.addNotifier(setChannel); + config.rfmod.finetune.addNotifier(setFinetune); diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 73538eaf..36d149cf 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -1,5 +1,6 @@ from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigInteger from enigma import Misc_Options, setTunerTypePriorityOrder; +from SystemInfo import SystemInfo import os def InitUsageConfig(): @@ -63,4 +64,6 @@ def InitUsageConfig(): Misc_Options.getInstance().set_12V_output(0) config.usage.output_12V.addNotifier(set12VOutput) + SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output() + config.usage.keymap = ConfigText(default = "/usr/share/enigma2/keymap.xml") -- cgit v1.2.3