From c39e992eac597c341dfef198d1179f84efa0791e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 29 Sep 2009 20:01:36 +0200 Subject: [PATCH 1/1] code cleanup --- .../VideoEnhancement/VideoEnhancement.py | 291 ++++++++++-------- .../SystemPlugins/VideoEnhancement/plugin.py | 209 +++++-------- 2 files changed, 237 insertions(+), 263 deletions(-) diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py b/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py index 7db02556..3fbef7c2 100755 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/VideoEnhancement.py @@ -1,124 +1,156 @@ -from enigma import eTimer -from Components.config import config, ConfigSubsection, ConfigSlider, ConfigSelection, ConfigYesNo, NoSave +from Components.config import config, ConfigSubsection, ConfigSlider, ConfigSelection, ConfigNothing, NoSave from Tools.CList import CList -from Tools.HardwareInfo import HardwareInfo -import os +from os import path as os_path # The "VideoEnhancement" is the interface to /proc/stb/vmpeg/0. class VideoEnhancement: - - firstRun = None + firstRun = True def __init__(self): self.last_modes_preferred = [ ] - self.on_hotplug = CList() self.createConfig() def createConfig(self, *args): - hw_type = HardwareInfo().get_device_name() config.pep = ConfigSubsection() - config.pep.configsteps = NoSave(ConfigSelection(choices=[1, 5, 10, 25], default = 1)) - def setContrast(config): - myval = int(config.value*256) - try: - print "--> setting contrast to: %0.8X" % myval - open("/proc/stb/vmpeg/0/pep_contrast", "w").write("%0.8X" % myval) - except IOError: - print "couldn't write pep_contrast." - - if VideoEnhancement.firstRun is False: - self.setConfiguredValues() - - config.pep.contrast = ConfigSlider(default=128, limits=(0,256)) - config.pep.contrast.addNotifier(setContrast) - - def setSaturation(config): - myval = int(config.value*256) - try: - print "--> setting saturation to: %0.8X" % myval - open("/proc/stb/vmpeg/0/pep_saturation", "w").write("%0.8X" % myval) - except IOError: - print "couldn't write pep_saturaion." - - if VideoEnhancement.firstRun is False: - self.setConfiguredValues() - - config.pep.saturation = ConfigSlider(default=128, limits=(0,256)) - config.pep.saturation.addNotifier(setSaturation) - - def setHue(config): - myval = int(config.value*256) - try: - print "--> setting hue to: %0.8X" % myval - open("/proc/stb/vmpeg/0/pep_hue", "w").write("%0.8X" % myval) - except IOError: - print "couldn't write pep_hue." - - if VideoEnhancement.firstRun is False: - self.setConfiguredValues() - - config.pep.hue = ConfigSlider(default=128, limits=(0,256)) - config.pep.hue.addNotifier(setHue) - - def setBrightness(config): - myval = int(config.value*256) - try: - print "--> setting brightness to: %0.8X" % myval - open("/proc/stb/vmpeg/0/pep_brightness", "w").write("%0.8X" % myval) - except IOError: - print "couldn't write pep_brightness." - - if VideoEnhancement.firstRun is False: - self.setConfiguredValues() - - config.pep.brightness = ConfigSlider(default=128, limits=(0,256)) - config.pep.brightness.addNotifier(setBrightness) - - def setBlock_noise_reduction(config): - myval = int(config.value) - try: - print "--> setting block_noise_reduction to: %0.8X" % myval - open("/proc/stb/vmpeg/0/pep_block_noise_reduction", "w").write("%0.8X" % myval) - except IOError: - print "couldn't write pep_block_noise_reduction." - - if VideoEnhancement.firstRun is False: - self.setConfiguredValues() - - config.pep.block_noise_reduction = ConfigSlider(default=0, limits=(0,5)) - config.pep.block_noise_reduction.addNotifier(setBlock_noise_reduction) - - def setMosquito_noise_reduction(config): - myval = int(config.value) - try: - print "--> setting mosquito_noise_reduction to: %0.8X" % myval - open("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction", "w").write("%0.8X" % myval) - except IOError: - print "couldn't write pep_mosquito_noise_reduction." - - if VideoEnhancement.firstRun is False: - self.setConfiguredValues() - - config.pep.mosquito_noise_reduction = ConfigSlider(default=0, limits=(0,5)) - config.pep.mosquito_noise_reduction.addNotifier(setMosquito_noise_reduction) - - def setDigital_contour_removal(config): - myval = int(config.value) - try: - print "--> setting digital_contour_removal to: %0.8X" % myval - open("/proc/stb/vmpeg/0/pep_digital_contour_removal", "w").write("%0.8X" % myval) - except IOError: - print "couldn't write pep_digital_contour_removal." - - if VideoEnhancement.firstRun is False: - self.setConfiguredValues() - - config.pep.digital_contour_removal = ConfigSlider(default=0, limits=(0,5)) - config.pep.digital_contour_removal.addNotifier(setDigital_contour_removal) - - if hw_type in ( 'dm8000', 'dm500hd' ): + if os_path.exists("/proc/stb/vmpeg/0/pep_contrast"): + def setContrast(config): + myval = int(config.value*256) + try: + print "--> setting contrast to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_contrast", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_contrast." + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.contrast = ConfigSlider(default=128, limits=(0,256)) + config.pep.contrast.addNotifier(setContrast) + else: + config.pep.contrast = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_saturation"): + def setSaturation(config): + myval = int(config.value*256) + try: + print "--> setting saturation to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_saturation", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_saturaion." + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.saturation = ConfigSlider(default=128, limits=(0,256)) + config.pep.saturation.addNotifier(setSaturation) + else: + config.pep.saturation = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_hue"): + def setHue(config): + myval = int(config.value*256) + try: + print "--> setting hue to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_hue", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_hue." + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.hue = ConfigSlider(default=128, limits=(0,256)) + config.pep.hue.addNotifier(setHue) + else: + config.pep.hue = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_brightness"): + def setBrightness(config): + myval = int(config.value*256) + try: + print "--> setting brightness to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_brightness", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_brightness." + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.brightness = ConfigSlider(default=128, limits=(0,256)) + config.pep.brightness.addNotifier(setBrightness) + else: + config.pep.brightness = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_block_noise_reduction"): + def setBlock_noise_reduction(config): + myval = int(config.value) + try: + print "--> setting block_noise_reduction to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_block_noise_reduction", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_block_noise_reduction." + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.block_noise_reduction = ConfigSlider(default=0, limits=(0,5)) + config.pep.block_noise_reduction.addNotifier(setBlock_noise_reduction) + else: + config.pep.block_noise_reduction = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction"): + def setMosquito_noise_reduction(config): + myval = int(config.value) + try: + print "--> setting mosquito_noise_reduction to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_mosquito_noise_reduction." + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.mosquito_noise_reduction = ConfigSlider(default=0, limits=(0,5)) + config.pep.mosquito_noise_reduction.addNotifier(setMosquito_noise_reduction) + else: + config.pep.mosquito_noise_reduction = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_digital_contour_removal"): + def setDigital_contour_removal(config): + myval = int(config.value) + try: + print "--> setting digital_contour_removal to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_digital_contour_removal", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_digital_contour_removal." + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.digital_contour_removal = ConfigSlider(default=0, limits=(0,5)) + config.pep.digital_contour_removal.addNotifier(setDigital_contour_removal) + else: + config.pep.digital_contour_removal = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"): + def setScaler_sharpness(config): + myval = int(config.value) + try: + print "--> setting scaler_sharpness to: %0.8X" % myval + open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w").write("%0.8X" % myval) + except IOError: + print "couldn't write pep_scaler_sharpness" + + if not VideoEnhancement.firstRun: + self.setConfiguredValues() + + config.pep.scaler_sharpness = ConfigSlider(default=13, limits=(0,26)) + config.pep.scaler_sharpness.addNotifier(setScaler_sharpness) + else: + config.pep.scaler_sharpness = NoSave(ConfigNothing()) + + if os_path.exists("/proc/stb/vmpeg/0/pep_split"): def setSplitMode(config): try: print "--> setting splitmode to:",str(config.value) @@ -126,7 +158,7 @@ class VideoEnhancement: except IOError: print "couldn't write pep_split." - if VideoEnhancement.firstRun is False: + if not VideoEnhancement.firstRun: self.setConfiguredValues() config.pep.split = ConfigSelection(choices={ @@ -135,7 +167,10 @@ class VideoEnhancement: "right": _("Right")}, default = "off") config.pep.split.addNotifier(setSplitMode) + else: + config.pep.split = NoSave(ConfigNothing()) + if os_path.exists("/proc/stb/vmpeg/0/pep_sharpness"): def setSharpness(config): myval = int(config.value*256) try: @@ -144,12 +179,15 @@ class VideoEnhancement: except IOError: print "couldn't write pep_sharpness." - if VideoEnhancement.firstRun is False: + if not VideoEnhancement.firstRun: self.setConfiguredValues() config.pep.sharpness = ConfigSlider(default=0, limits=(0,256)) config.pep.sharpness.addNotifier(setSharpness) + else: + config.pep.sharpness = NoSave(ConfigNothing()) + if os_path.exists("/proc/stb/vmpeg/0/pep_auto_flesh"): def setAutoflesh(config): myval = int(config.value) try: @@ -158,12 +196,15 @@ class VideoEnhancement: except IOError: print "couldn't write pep_auto_flesh." - if VideoEnhancement.firstRun is False: + if not VideoEnhancement.firstRun: self.setConfiguredValues() config.pep.auto_flesh = ConfigSlider(default=0, limits=(0,4)) config.pep.auto_flesh.addNotifier(setAutoflesh) + else: + config.pep.auto_flesh = NoSave(ConfigNothing()) + if os_path.exists("/proc/stb/vmpeg/0/pep_green_boost"): def setGreenboost(config): myval = int(config.value) try: @@ -172,12 +213,15 @@ class VideoEnhancement: except IOError: print "couldn't write pep_green_boost." - if VideoEnhancement.firstRun is False: + if not VideoEnhancement.firstRun: self.setConfiguredValues() config.pep.green_boost = ConfigSlider(default=0, limits=(0,4)) config.pep.green_boost.addNotifier(setGreenboost) + else: + config.pep.green_boost = NoSave(ConfigNothing()) + if os_path.exists("/proc/stb/vmpeg/0/pep_blue_boost"): def setBlueboost(config): myval = int(config.value) try: @@ -186,12 +230,15 @@ class VideoEnhancement: except IOError: print "couldn't write pep_blue_boost." - if VideoEnhancement.firstRun is False: + if not VideoEnhancement.firstRun: self.setConfiguredValues() config.pep.blue_boost = ConfigSlider(default=0, limits=(0,4)) config.pep.blue_boost.addNotifier(setBlueboost) + else: + config.pep.blue_boost = NoSave(ConfigNothing()) + if os_path.exists("/proc/stb/vmpeg/0/pep_dynamic_contrast"): def setDynamic_contrast(config): myval = int(config.value) try: @@ -200,26 +247,24 @@ class VideoEnhancement: except IOError: print "couldn't write pep_dynamic_contrast." - if VideoEnhancement.firstRun is False: + if not VideoEnhancement.firstRun: self.setConfiguredValues() config.pep.dynamic_contrast = ConfigSlider(default=0, limits=(0,256)) config.pep.dynamic_contrast.addNotifier(setDynamic_contrast) + else: + config.pep.dynamic_contrast = NoSave(ConfigNothing()) + + if VideoEnhancement.firstRun: + self.setConfiguredValues() - VideoEnhancement.firstRun = True + VideoEnhancement.firstRun = False def setConfiguredValues(self): try: print "--> applying pep values" open("/proc/stb/vmpeg/0/pep_apply", "w").write("1") - VideoEnhancement.firstRun = False except IOError: print "couldn't apply pep values." - -if config.usage.setup_level.index >= 2: # expert+ - hw_type = HardwareInfo().get_device_name() - if hw_type in ( 'dm8000', 'dm800', 'dm500hd' ): - video_enhancement = VideoEnhancement() - if video_enhancement.firstRun == True: - video_enhancement.setConfiguredValues() +VideoEnhancement() diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py index 8f8f56e1..e25ad38e 100755 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py @@ -1,17 +1,12 @@ from Plugins.Plugin import PluginDescriptor from Components.ConfigList import ConfigListScreen -from Components.config import getConfigListEntry, config, ConfigBoolean +from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection from Components.ActionMap import ActionMap from Components.Sources.StaticText import StaticText from Screens.Screen import Screen -from Screens.VirtualKeyBoard import VirtualKeyBoard -from Screens.ChoiceBox import ChoiceBox from Screens.MessageBox import MessageBox -from enigma import ePoint -from Tools import Notifications -from Tools.HardwareInfo import HardwareInfo -from VideoEnhancement import video_enhancement -import os +import VideoEnhancement +from os import path as os_path class VideoEnhancementSetup(Screen, ConfigListScreen): @@ -30,35 +25,15 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): """ - def __init__(self, session, hw): + def __init__(self, session): Screen.__init__(self, session) self.session = session - self.hw = hw self.onChangedEntry = [ ] self.setup_title = "Videoenhancement" - self.contrastEntry = None - self.saturationEntry = None - self.hueEntry = None - self.brightnessEntry = None - self.splitEntry = None - self.sharpnessEntry = None - self.auto_fleshEntry = None - self.green_boostEntry = None - self.blue_boostEntry = None - self.block_noise_reductionEntry = None - self.mosquito_noise_reductionEntry = None - self.digital_contour_removalEntry = None - self.dynamic_contrastEntry = None - - # handle hotplug by re-creating setup - self.onShow.append(self.startHotplug) - self.onHide.append(self.stopHotplug) - self.list = [ ] self.xtdlist = [ ] - self.hw_type = HardwareInfo().get_device_name() ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) self["actions"] = ActionMap(["SetupActions", "ColorActions"], @@ -82,12 +57,6 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): def layoutFinished(self): self.setTitle(_("Video enhancement setup")) - def startHotplug(self): - self.hw.on_hotplug.append(self.createSetup) - - def stopHotplug(self): - self.hw.on_hotplug.remove(self.createSetup) - def rememberOldSettings(self): self.oldContrast = config.pep.contrast.value self.oldSaturation = config.pep.saturation.value @@ -96,73 +65,42 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): self.oldBlock_noise = config.pep.block_noise_reduction.value self.oldMosquito_noise = config.pep.mosquito_noise_reduction.value self.oldDigital_contour = config.pep.digital_contour_removal.value - if self.hw_type in ('dm8000', 'dm500hd'): - self.oldSplit = config.pep.split.value - self.oldSharpness = config.pep.sharpness.value - self.oldAuto_flesh = config.pep.auto_flesh.value - self.oldGreen_boost = config.pep.green_boost.value - self.oldBlue_boost = config.pep.blue_boost.value - self.oldDynamic_contrast = config.pep.dynamic_contrast.value + self.oldScaler_sharpness = config.pep.scaler_sharpness.value + self.oldSplit = config.pep.split.value + self.oldSharpness = config.pep.sharpness.value + self.oldAuto_flesh = config.pep.auto_flesh.value + self.oldGreen_boost = config.pep.green_boost.value + self.oldBlue_boost = config.pep.blue_boost.value + self.oldDynamic_contrast = config.pep.dynamic_contrast.value + + def addToConfigList(self, description, configEntry, add_to_xtdlist=False): + if isinstance(configEntry, ConfigNothing): + return None + entry = getConfigListEntry(description, configEntry) + self.list.append(entry); + if add_to_xtdlist: + self.xtdlist.append(entry) + return entry def createSetup(self): - self.contrastEntry = getConfigListEntry(_("Contrast"), config.pep.contrast) - self.saturationEntry = getConfigListEntry(_("Saturation"), config.pep.saturation) - self.hueEntry = getConfigListEntry(_("Hue"), config.pep.hue) - self.brightnessEntry = getConfigListEntry(_("Brightness"), config.pep.brightness) - self.block_noise_reductionEntry = getConfigListEntry(_("Block noise reduction"), config.pep.block_noise_reduction) - self.mosquito_noise_reductionEntry = getConfigListEntry(_("Mosquito noise reduction"), config.pep.mosquito_noise_reduction) - self.digital_contour_removalEntry = getConfigListEntry(_("Digital contour removal"), config.pep.digital_contour_removal) - - self.list = [ - self.contrastEntry - ] - - self.list.extend(( - self.saturationEntry, - self.hueEntry, - self.brightnessEntry - )) - if self.hw_type == 'dm800': - self.list.extend(( - self.block_noise_reductionEntry, - self.mosquito_noise_reductionEntry, - self.digital_contour_removalEntry - )) - - elif self.hw_type in ( 'dm8000', 'dm500hd' ): - self.splitEntry = getConfigListEntry(_("Split preview mode"), config.pep.split) - self.sharpnessEntry = getConfigListEntry(_("Sharpness"), config.pep.sharpness) - self.auto_fleshEntry = getConfigListEntry(_("Auto flesh"), config.pep.auto_flesh) - self.green_boostEntry = getConfigListEntry(_("Green boost"), config.pep.green_boost) - self.blue_boostEntry = getConfigListEntry(_("Blue boost"), config.pep.blue_boost) - self.dynamic_contrastEntry = getConfigListEntry(_("Dynamic contrast"), config.pep.dynamic_contrast) - - self.xtdlist = [ - self.splitEntry - ] - - self.xtdlist.extend(( - self.sharpnessEntry, - self.auto_fleshEntry, - self.green_boostEntry, - self.blue_boostEntry, - self.block_noise_reductionEntry, - self.mosquito_noise_reductionEntry, - self.digital_contour_removalEntry, - self.dynamic_contrastEntry - )) - - self.list.extend(( - self.splitEntry, - self.sharpnessEntry, - self.auto_fleshEntry, - self.green_boostEntry, - self.blue_boostEntry, - self.block_noise_reductionEntry, - self.mosquito_noise_reductionEntry, - self.digital_contour_removalEntry, - self.dynamic_contrastEntry - )) + self.list = [] + self.xtdlist = [] + addToConfigList = self.addToConfigList + self.contrastEntry = addToConfigList(_("Contrast"), config.pep.contrast) + self.saturationEntry = addToConfigList(_("Saturation"), config.pep.saturation) + self.hueEntry = addToConfigList(_("Hue"), config.pep.hue) + self.brightnessEntry = addToConfigList(_("Brightness"), config.pep.brightness) + self.scaler_sharpnessEntry = addToConfigList(_("Scaler sharpness"), config.pep.scaler_sharpness) + self.splitEntry = addToConfigList(_("Split preview mode"), config.pep.split, True) + add_to_xtdlist = self.splitEntry is not None + self.sharpnessEntry = addToConfigList(_("Sharpness"), config.pep.sharpness, add_to_xtdlist) + self.auto_fleshEntry = addToConfigList(_("Auto flesh"), config.pep.auto_flesh, add_to_xtdlist) + self.green_boostEntry = addToConfigList(_("Green boost"), config.pep.green_boost, add_to_xtdlist) + self.blue_boostEntry = addToConfigList(_("Blue boost"), config.pep.blue_boost, add_to_xtdlist) + self.dynamic_contrastEntry = addToConfigList(_("Dynamic contrast"), config.pep.dynamic_contrast, add_to_xtdlist) + self.block_noise_reductionEntry = addToConfigList(_("Block noise reduction"), config.pep.block_noise_reduction, add_to_xtdlist) + self.mosquito_noise_reductionEntry = addToConfigList(_("Mosquito noise reduction"), config.pep.mosquito_noise_reduction, add_to_xtdlist) + self.digital_contour_removalEntry = addToConfigList(_("Digital contour removal"), config.pep.digital_contour_removal, add_to_xtdlist) self["config"].list = self.list self["config"].l.setSeperation(300) @@ -182,7 +120,6 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): current = self["config"].getCurrent() if current == self.splitEntry: ConfigListScreen.keyLeft(self) - self.createSetup() elif current != self.splitEntry and current in self.xtdlist: self.previewlist = [ current, @@ -201,7 +138,6 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): current = self["config"].getCurrent() if current == self.splitEntry: ConfigListScreen.keyRight(self) - self.createSetup() elif current != self.splitEntry and current in self.xtdlist: self.previewlist = [ current, @@ -257,20 +193,20 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): config.pep.mosquito_noise_reduction.setValue(self.oldMosquito_noise) if self.digital_contour_removalEntry is not None: config.pep.digital_contour_removal.setValue(self.oldDigital_contour) - - if self.hw_type in ( 'dm8000', 'dm500hd' ): - if self.splitEntry is not None: - config.pep.split.setValue('off') - if self.sharpnessEntry is not None: - config.pep.sharpness.setValue(self.oldSharpness) - if self.auto_fleshEntry is not None: - config.pep.auto_flesh.setValue(self.oldAuto_flesh) - if self.green_boostEntry is not None: - config.pep.green_boost.setValue(self.oldGreen_boost) - if self.blue_boostEntry is not None: - config.pep.blue_boost.setValue(self.oldBlue_boost) - if self.dynamic_contrastEntry is not None: - config.pep.dynamic_contrast.setValue(self.oldDynamic_contrast) + if self.scaler_sharpnessEntry is not None: + config.pep.scaler_sharpness.setValue(self.oldScaler_sharpness) + if self.splitEntry is not None: + config.pep.split.setValue('off') + if self.sharpnessEntry is not None: + config.pep.sharpness.setValue(self.oldSharpness) + if self.auto_fleshEntry is not None: + config.pep.auto_flesh.setValue(self.oldAuto_flesh) + if self.green_boostEntry is not None: + config.pep.green_boost.setValue(self.oldGreen_boost) + if self.blue_boostEntry is not None: + config.pep.blue_boost.setValue(self.oldBlue_boost) + if self.dynamic_contrastEntry is not None: + config.pep.dynamic_contrast.setValue(self.oldDynamic_contrast) self.keySave() def keyYellow(self): @@ -294,20 +230,20 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): config.pep.mosquito_noise_reduction.setValue(0) if self.digital_contour_removalEntry is not None: config.pep.digital_contour_removal.setValue(0) - - if self.hw_type in ( 'dm8000', 'dm500hd' ): - if self.splitEntry is not None: - config.pep.split.setValue('off') - if self.sharpnessEntry is not None: - config.pep.sharpness.setValue(0) - if self.auto_fleshEntry is not None: - config.pep.auto_flesh.setValue(0) - if self.green_boostEntry is not None: - config.pep.green_boost.setValue(0) - if self.blue_boostEntry is not None: - config.pep.blue_boost.setValue(0) - if self.dynamic_contrastEntry is not None: - config.pep.dynamic_contrast.setValue(0) + if self.scaler_sharpnessEntry is not None: + config.pep.scaler_sharpness.setValue(13) + if self.splitEntry is not None: + config.pep.split.setValue('off') + if self.sharpnessEntry is not None: + config.pep.sharpness.setValue(0) + if self.auto_fleshEntry is not None: + config.pep.auto_flesh.setValue(0) + if self.green_boostEntry is not None: + config.pep.green_boost.setValue(0) + if self.blue_boostEntry is not None: + config.pep.blue_boost.setValue(0) + if self.dynamic_contrastEntry is not None: + config.pep.dynamic_contrast.setValue(0) self.keySave() def keyBlue(self): @@ -447,23 +383,16 @@ class VideoEnhancementPreview(Screen, ConfigListScreen): from Screens.Setup import SetupSummary return SetupSummary - def videoEnhancementSetupMain(session, **kwargs): - session.open(VideoEnhancementSetup, video_enhancement) - + session.open(VideoEnhancementSetup) def startSetup(menuid): if menuid != "system": return [ ] - return [(_("Video enhancement settings") , videoEnhancementSetupMain, "videoenhancement_setup", 41)] - def Plugins(**kwargs): list = [] - if config.usage.setup_level.index >= 2: # expert+ - hw_type = HardwareInfo().get_device_name() - if hw_type in ( 'dm8000', 'dm800', 'dm500hd' ): - if (os.path.exists("/proc/stb/vmpeg/0/pep_apply") == True): - list.append(PluginDescriptor(name=_("Videoenhancement Setup"), description=_("Advanced Video Enhancement Setup"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup)) + if config.usage.setup_level.index >= 2 and os_path.exists("/proc/stb/vmpeg/0/pep_apply"): + list.append(PluginDescriptor(name=_("Videoenhancement Setup"), description=_("Advanced Video Enhancement Setup"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup)) return list -- 2.30.2