X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/03d4d7f20769bf42e9312f718d5c7923d37693db..a6db6ed10bd1e49fc009554d7a5db2f573491736:/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py index 03fbe95c..8f8f56e1 100755 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py @@ -2,8 +2,7 @@ from Plugins.Plugin import PluginDescriptor from Components.ConfigList import ConfigListScreen from Components.config import getConfigListEntry, config, ConfigBoolean from Components.ActionMap import ActionMap -from Components.Button import Button -from Components.Label import Label +from Components.Sources.StaticText import StaticText from Screens.Screen import Screen from Screens.VirtualKeyBoard import VirtualKeyBoard from Screens.ChoiceBox import ChoiceBox @@ -22,14 +21,13 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): - - - - + + + + - - + """ def __init__(self, session, hw): @@ -71,11 +69,11 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): "blue": self.keyBlue, }, -2) - self["key_red"] = Button(_("Cancel")) - self["key_green"] = Button(_("OK")) - self["key_yellow"] = Button(_("Last config")) - self["key_blue"] = Button(_("Default")) - self["introduction"] = Label() + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self["key_yellow"] = StaticText(_("Last config")) + self["key_blue"] = StaticText(_("Default")) + self["introduction"] = StaticText() self.createSetup() self.rememberOldSettings() @@ -95,15 +93,15 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): self.oldSaturation = config.pep.saturation.value self.oldHue = config.pep.hue.value self.oldBrightness = config.pep.brightness.value - if self.hw_type == 'dm8000': + 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.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 self.oldDynamic_contrast = config.pep.dynamic_contrast.value def createSetup(self): @@ -111,6 +109,9 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): 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 @@ -121,15 +122,19 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): self.hueEntry, self.brightnessEntry )) - if self.hw_type == 'dm8000': + 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.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.dynamic_contrastEntry = getConfigListEntry(_("Dynamic contrast"), config.pep.dynamic_contrast) self.xtdlist = [ @@ -183,12 +188,14 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): current, self.splitEntry ] - self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist, oldSplitMode = config.pep.split.value) + maxvalue = current[1].max + self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist, oldSplitMode = config.pep.split.value, maxValue = maxvalue) else: self.previewlist = [ current ] - self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist) + maxvalue = current[1].max + self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist, oldSplitMode = None, maxValue = maxvalue) def keyRight(self): current = self["config"].getCurrent() @@ -200,12 +207,14 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): current, self.splitEntry ] - self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist, oldSplitMode = config.pep.split.value ) + maxvalue = current[1].max + self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist, oldSplitMode = config.pep.split.value, maxValue = maxvalue ) else: self.previewlist = [ current ] - self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist) + maxvalue = current[1].max + self.session.openWithCallback(self.PreviewClosed, VideoEnhancementPreview, configEntry = self.previewlist, oldSplitMode = None, maxValue = maxvalue) def confirm(self, confirmed): if not confirmed: @@ -242,8 +251,14 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): config.pep.hue.setValue(self.oldHue) if self.brightnessEntry is not None: config.pep.brightness.setValue(self.oldBrightness) - - if self.hw_type == 'dm8000': + if self.block_noise_reductionEntry is not None: + config.pep.block_noise_reduction.setValue(self.oldBlock_noise) + if self.mosquito_noise_reductionEntry is not None: + 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: @@ -254,12 +269,6 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): 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.block_noise_reductionEntry is not None: - config.pep.block_noise_reduction.setValue(self.oldBlock_noise) - if self.mosquito_noise_reductionEntry is not None: - 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.dynamic_contrastEntry is not None: config.pep.dynamic_contrast.setValue(self.oldDynamic_contrast) self.keySave() @@ -279,8 +288,14 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): config.pep.hue.setValue(128) if self.brightnessEntry is not None: config.pep.brightness.setValue(128) - - if self.hw_type == 'dm8000': + if self.block_noise_reductionEntry is not None: + config.pep.block_noise_reduction.setValue(0) + if self.mosquito_noise_reductionEntry is not None: + 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: @@ -291,12 +306,6 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): config.pep.green_boost.setValue(0) if self.blue_boostEntry is not None: config.pep.blue_boost.setValue(0) - if self.block_noise_reductionEntry is not None: - config.pep.block_noise_reduction.setValue(0) - if self.mosquito_noise_reductionEntry is not None: - config.pep.mosquito_noise_reduction.setValue(0) - if self.digital_contour_removalEntry is not None: - config.pep.digital_contour_removal.setValue(0) if self.dynamic_contrastEntry is not None: config.pep.dynamic_contrast.setValue(0) self.keySave() @@ -308,6 +317,7 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): def changedEntry(self): for x in self.onChangedEntry: x() + self.selectionChanged() def getCurrentEntry(self): return self["config"].getCurrent()[0] @@ -323,20 +333,25 @@ class VideoEnhancementSetup(Screen, ConfigListScreen): class VideoEnhancementPreview(Screen, ConfigListScreen): skin = """ - + - - - + + + + + """ - def __init__(self, session, configEntry = None, oldSplitMode = None): + def __init__(self, session, configEntry = None, oldSplitMode = None, maxValue = None): Screen.__init__(self, session) self.onChangedEntry = [ ] self.setup_title = "Videoenhancement" self.oldSplitMode = oldSplitMode + self.maxValue = maxValue + self.configStepsEntry = None + self.isStepSlider = None self.list = [ ] self.configEntry = configEntry @@ -348,8 +363,9 @@ class VideoEnhancementPreview(Screen, ConfigListScreen): "save": self.keySave, }, -2) - self["key_red"] = Button(_("Cancel")) - self["key_green"] = Button(_("OK")) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self["introduction"] = StaticText() self.createSetup() self.onLayoutFinish.append(self.layoutFinished) @@ -359,19 +375,41 @@ class VideoEnhancementPreview(Screen, ConfigListScreen): def createSetup(self): self.list = [ ] + if self.maxValue == 256: + self.configStepsEntry = getConfigListEntry(_("Change step size"), config.pep.configsteps) + if self.configEntry is not None: self.list = self.configEntry + if self.maxValue == 256: + self.list.append(self.configStepsEntry) + self["config"].list = self.list self["config"].l.setSeperation(300) self["config"].l.setList(self.list) + if not self.selectionChanged in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.selectionChanged) + self.selectionChanged() + + def selectionChanged(self): + self["introduction"].setText(_("Current value: ") + self.getCurrentValue()) + try: + max_avail=self["config"].getCurrent()[1].max + if max_avail == 256: + self.isStepSlider = True + else: + self.isStepSlider = False + except AttributeError: + print "no max value" def keyLeft(self): + if self.isStepSlider is True: + self["config"].getCurrent()[1].increment = config.pep.configsteps.value ConfigListScreen.keyLeft(self) - self.createSetup() def keyRight(self): + if self.isStepSlider is True: + self["config"].getCurrent()[1].increment = config.pep.configsteps.value ConfigListScreen.keyRight(self) - self.createSetup() def keySave(self): if self.oldSplitMode is not None: @@ -397,6 +435,7 @@ class VideoEnhancementPreview(Screen, ConfigListScreen): def changedEntry(self): for x in self.onChangedEntry: x() + self.selectionChanged() def getCurrentEntry(self): return self["config"].getCurrent()[0] @@ -424,7 +463,7 @@ def Plugins(**kwargs): list = [] if config.usage.setup_level.index >= 2: # expert+ hw_type = HardwareInfo().get_device_name() - if hw_type == 'dm8000' or hw_type == 'dm800': + 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)) return list