예제 #1
0
 def send(self, to, command, message=[]):
     message = (message)
     Log.i(
         "self > %x :: %02x %s (%s)" %
         (to, command, self.toHexString(message), config.cec.enabled.value))
     if not config.cec.enabled.value:
         return
     self._cec.sendMsg(to, command, IntList(message))
	def initConfig(self):
		config.misc.videowizardenabled = ConfigBoolean(default = True)

		try:
			x = config.av
		except AttributeError:
			config.av = ConfigSubsection()
		config.av.preferred_modes_only = ConfigBoolean(default = True, descriptions = {False: _("no"), True: _("yes")})

		config.av.videomode = ConfigSubDict()
		config.av.videomode_preferred = ConfigSubDict()
		config.av.videorate = ConfigSubDict()

		policy_standard = IntList()
		policy_widescreen = IntList()
		aspects = IntList()
		osd_alpha_range = IntList()
		scaler_sharpness_range = IntList()
		hlg_support_modes = IntList()
		hdr10_support_modes = IntList()
		allow_10Bit_modes = IntList()
		allow_12Bit_modes = IntList()

		self._displayManager.getAvailableStandardPolicies(policy_standard)
		self._displayManager.getAvailableWidescreenPolicies(policy_widescreen)
		self._displayManager.getAvailableAspects(aspects)
		SystemInfo["CanChangeOsdAlpha"] = self._displayManager.hasOSDAlpha()
		osd_alpha_range = self._displayManager.getOSDAlphaRange()
		SystemInfo["CanChangeScalerSharpness"] = self._displayManager.hasScalerSharpness()
		scaler_sharpness_range = self._displayManager.getScalerSharpnessRange()
		SystemInfo["HDRSupport"] = self._displayManager.hasHDRSupport()
		self._displayManager.getAvailableHLGSupportModes(hlg_support_modes)
		self._displayManager.getAvailableHDR10SupportModes(hdr10_support_modes)
		self._displayManager.getAvailableHDR10BitModes(allow_10Bit_modes)
		self._displayManager.getAvailableHDR12BitModes(allow_12Bit_modes)

		lst_port = []
		for port_name, port in self.availablePorts.items():
			lst_port.append((port_name, port_name))
			self.updateModes(port_name)

		config.av.videoport = ConfigSelection(choices = lst_port)

		config.av.aspect = ConfigSelection(choices = [(self.aspectIndexToKey(aspect), self.aspectIndexToString(aspect)) for (aspect) in aspects],
			default = self.aspectIndexToKey(self._displayManager.getAspectDefault()))

		config.av.policy_43 = ConfigSelection(choices = [(self.policyIndexToKey(policy), self.policyIndexToString(policy)) for (policy) in policy_standard],
			default = self.policyIndexToKey(self._displayManager.getStandardPolicyDefault()))
		config.av.policy_169 = ConfigSelection(choices = [(self.policyIndexToKey(policy), self.policyIndexToString(policy)) for (policy) in policy_widescreen],
			default = self.policyIndexToKey(self._displayManager.getWidescreenPolicyDefault()))

		if SystemInfo["CanChangeOsdAlpha"]:
			config.av.osd_alpha = ConfigSlider(default=osd_alpha_range.defaultValue, increment=(osd_alpha_range.max/20), limits=(osd_alpha_range.min,osd_alpha_range.max))

		if SystemInfo["CanChangeScalerSharpness"]:
			config.av.scaler_sharpness = ConfigSlider(default=scaler_sharpness_range.defaultValue, limits=(scaler_sharpness_range.min,scaler_sharpness_range.max))

		if SystemInfo["HDRSupport"]:
			config.av.hlg_support = ConfigSelection(choices = [(self.hlgIndexToKey(mode), self.hlgIndexToString(mode)) for (mode) in hlg_support_modes],
				default = self.hlgIndexToKey(self._displayManager.getHLGSupportDefault()))
			config.av.hdr10_support = ConfigSelection(choices = [(self.hdrIndexToKey(mode), self.hdrIndexToString(mode)) for (mode) in hdr10_support_modes],
				default = self.hdrIndexToKey(self._displayManager.getHDR10SupportDefault()))
			if len(allow_10Bit_modes):
				config.av.allow_10bit = ConfigSelection(choices = [(self.propertyIndexToKey(mode), self.propertyIndexToString(mode)) for (mode) in allow_10Bit_modes],
					default = self.propertyIndexToKey(self._displayManager.getHDR10BitDefault()))
			else:
				config.av.allow_10bit = ConfigNothing()
			if len(allow_12Bit_modes):
				config.av.allow_12bit = ConfigSelection(choices = [(self.propertyIndexToKey(mode), self.propertyIndexToString(mode)) for (mode) in allow_12Bit_modes],
					default = self.propertyIndexToKey(self._displayManager.getHDR12BitDefault()))
			else:
				config.av.allow_12bit = ConfigNothing()
예제 #3
0
    def initConfig(self, *args):
        config.pep = ConfigSubsection()
        config.pep.configsteps = NoSave(
            ConfigSelection(choices=[1, 5, 10, 25], default=1))

        if self._videoManager.hasContrast():
            contrastRange = self._videoManager.getContrastRange()
            config.pep.contrast = ConfigSlider(
                default=contrastRange.defaultValue,
                limits=(contrastRange.min, contrastRange.max))
            config.pep.contrast.addNotifier(self.setContrast)
        else:
            config.pep.contrast = NoSave(ConfigNothing())

        if self._videoManager.hasSaturation():
            saturationRange = self._videoManager.getSaturationRange()
            config.pep.saturation = ConfigSlider(
                default=saturationRange.defaultValue,
                limits=(saturationRange.min, contrastRange.max))
            config.pep.saturation.addNotifier(self.setSaturation)
        else:
            config.pep.saturation = NoSave(ConfigNothing())

        if self._videoManager.hasHue():
            hueRange = self._videoManager.getHueRange()
            config.pep.hue = ConfigSlider(default=hueRange.defaultValue,
                                          limits=(hueRange.min, hueRange.max))
            config.pep.hue.addNotifier(self.setHue)
        else:
            config.pep.hue = NoSave(ConfigNothing())

        if self._videoManager.hasBrightness():
            brightnessRange = self._videoManager.getBrightnessRange()
            config.pep.brightness = ConfigSlider(
                default=brightnessRange.defaultValue,
                limits=(brightnessRange.min, brightnessRange.max))
            config.pep.brightness.addNotifier(self.setBrightness)
        else:
            config.pep.brightness = NoSave(ConfigNothing())

        try:
            x = config.av.scaler_sharpness.value
        except AttributeError:
            if self._videoManager.hasScalerSharpness():
                scalerSharpnessRange = self._videoManager.getScalerSharpnessRange(
                )
                try:
                    y = config.av
                except AttributeError:
                    config.av = ConfigSubsection()
                config.av.scaler_sharpness = ConfigSlider(
                    default=scalerSharpnessRange.defaultValue,
                    limits=(scalerSharpnessRange.min,
                            scalerSharpnessRange.max))
                config.av.scaler_sharpness.addNotifier(self.setScalerSharpness)

        if self._videoManager.hasSplitMode():
            splitModes = IntList()
            self._videoManager.getAvailableSplitModes(splitModes)
            config.pep.split = ConfigSelection(
                choices=[(self.splitModeIndexToKey(mode),
                          self.splitModeIndexToString(mode))
                         for (mode) in splitModes],
                default=self.splitModeIndexToKey(
                    self._videoManager.getSplitModeDefault()))
            config.pep.split.addNotifier(self.setSplitMode)
        else:
            config.pep.split = NoSave(ConfigNothing())

        if self._videoManager.hasSharpness():
            sharpnessRange = self._videoManager.getSharpnessRange()
            config.pep.sharpness = ConfigSlider(
                default=sharpnessRange.defaultValue,
                limits=(sharpnessRange.min, sharpnessRange.max))
            config.pep.sharpness.addNotifier(self.setSharpness)
        else:
            config.pep.sharpness = NoSave(ConfigNothing())

        if self._videoManager.hasAutoFlesh():
            autoFleshRange = self._videoManager.getAutoFleshRange()
            config.pep.auto_flesh = ConfigSlider(
                default=autoFleshRange.defaultValue,
                limits=(autoFleshRange.min, autoFleshRange.max))
            config.pep.auto_flesh.addNotifier(self.setAutoFlesh)
        else:
            config.pep.auto_flesh = NoSave(ConfigNothing())

        if self._videoManager.hasGreenBoost():
            greenBoostRange = self._videoManager.getGreenBoostRange()
            config.pep.green_boost = ConfigSlider(
                default=greenBoostRange.defaultValue,
                limits=(greenBoostRange.min, greenBoostRange.max))
            config.pep.green_boost.addNotifier(self.setGreenBoost)
        else:
            config.pep.green_boost = NoSave(ConfigNothing())

        if self._videoManager.hasColorTemp():
            colorTempRange = self._videoManager.getColorTempRange()
            config.pep.color_temp = ConfigSlider(
                default=colorTempRange.defaultValue,
                limits=(colorTempRange.min, colorTempRange.max))
            config.pep.color_temp.addNotifier(self.setColorTemp)
        else:
            config.pep.color_temp = NoSave(ConfigNothing())

        if self._videoManager.hasBlueBoost():
            blueBoostRange = self._videoManager.getBlueBoostRange()
            config.pep.blue_boost = ConfigSlider(
                default=blueBoostRange.defaultValue,
                limits=(blueBoostRange.min, blueBoostRange.max))
            config.pep.blue_boost.addNotifier(self.setBlueBoost)
        else:
            config.pep.blue_boost = NoSave(ConfigNothing())

        if self._videoManager.hasDynamicContrast():
            dynamicContrastRange = self._videoManager.getDynamicContrastRange()
            config.pep.dynamic_contrast = ConfigSlider(
                default=dynamicContrastRange.defaultValue,
                limits=(dynamicContrastRange.min, dynamicContrastRange.max))
            config.pep.dynamic_contrast.addNotifier(self.setDynamicContrast)
        else:
            config.pep.dynamic_contrast = NoSave(ConfigNothing())

        if self._videoManager.hasBlockNoiseReduction():
            blockNoiseReductionRange = self._videoManager.getBlockNoiseReductionRange(
            )
            config.pep.block_noise_reduction = ConfigSlider(
                default=blockNoiseReductionRange.defaultValue,
                limits=(blockNoiseReductionRange.min,
                        blockNoiseReductionRange.max))
            config.pep.block_noise_reduction.addNotifier(
                self.setBlockNoiseReduction)
        else:
            config.pep.block_noise_reduction = NoSave(ConfigNothing())

        if self._videoManager.hasMosquitoNoiseReduction():
            mosquitoNoiseReductionRange = self._videoManager.getMosquitoNoiseReductionRange(
            )
            config.pep.mosquito_noise_reduction = ConfigSlider(
                default=mosquitoNoiseReductionRange.defaultValue,
                limits=(mosquitoNoiseReductionRange.min,
                        mosquitoNoiseReductionRange.max))
            config.pep.mosquito_noise_reduction.addNotifier(
                self.setMosquitoNoiseReduction)
        else:
            config.pep.mosquito_noise_reduction = NoSave(ConfigNothing())

        if self._videoManager.hasDigitalContourRemoval():
            digitalContourRemovalRange = self._videoManager.getDigitalContourRemovalRange(
            )
            config.pep.digital_contour_removal = ConfigSlider(
                default=digitalContourRemovalRange.defaultValue,
                limits=(digitalContourRemovalRange.min,
                        digitalContourRemovalRange.max))
            config.pep.digital_contour_removal.addNotifier(
                self.setDigitalContourRemoval)
        else:
            config.pep.digital_contour_removal = NoSave(ConfigNothing())

        if VideoEnhancement.firstRun:
            self.setConfiguredValues()

        VideoEnhancement.firstRun = False