def createSetup(self):
		self.list = []

		params = BrowserPositionSetting().getPosition()
		vbcfg.setPosition(params)

		left   = params[0]
		width  = params[1]
		top    = params[2]
		height = params[3]

		self.dst_left   = ConfigSlider(default = left, increment = 5, limits = (0, 720))
		self.dst_width  = ConfigSlider(default = width, increment = 5, limits = (0, 720))
		self.dst_top    = ConfigSlider(default = top, increment = 5, limits = (0, 576))
		self.dst_height = ConfigSlider(default = height, increment = 5, limits = (0, 576))

		self.dst_left_entry   = getConfigListEntry(_("left"), self.dst_left)
		self.dst_width_entry  = getConfigListEntry(_("width"), self.dst_width)
		self.dst_top_entry    = getConfigListEntry(_("top"), self.dst_top)
		self.dst_height_entry = getConfigListEntry(_("height"), self.dst_height)

		self.list.append(self.dst_left_entry)
		self.list.append(self.dst_width_entry)
		self.list.append(self.dst_top_entry)
		self.list.append(self.dst_height_entry)

		self["config"].list = self.list
		self["config"].l.setList(self.list)
 def handleKey(self, key):
     if key == KEY_OK:
         debug("[SliderWidget] KEY_OK pressed")
         if self.value == SliderWidget.MIN_VAL:
             self.value = SliderWidget.MAX_VAL
         else:
             self.value = SliderWidget.MIN_VAL
         self.send_command()
     else:
         ConfigSlider.handleKey(self, key)
Exemple #3
0
	def __init__(self, session):
		self.skin = OSD3DSetupScreen.skin
		Screen.__init__(self, session)

		from Components.ActionMap import ActionMap
		from Components.Button import Button

		self["ok"] = Button(_("OK"))
		self["cancel"] = Button(_("Cancel"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"green": self.keyGo,
			"red": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session)

		mode = config.plugins.OSD3DSetup.mode.getValue()
		znorm = config.plugins.OSD3DSetup.znorm.getValue()

		self.mode = ConfigSelection(choices = modelist, default = mode)
		self.znorm = ConfigSlider(default = znorm + 50, increment = 1, limits = (0, 100))
		self.list.append(getConfigListEntry(_("3d mode"), self.mode))
		self.list.append(getConfigListEntry(_("Depth"), self.znorm))
		self["config"].list = self.list
		self["config"].l.setList(self.list)
Exemple #4
0
    def __init__(self, session):
        self.skin = OSDScreenPosition.skin
        Screen.__init__(self, session)

        from Components.ActionMap import ActionMap
        from Components.Button import Button

        self["ok"] = Button(_("OK"))
        self["cancel"] = Button(_("Cancel"))

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions", "MenuActions"],
            {
                "ok": self.keyGo,
                "save": self.keyGo,
                "cancel": self.keyCancel,
                "green": self.keyGo,
                "red": self.keyCancel,
                "menu": self.closeRecursive,
            },
            -2,
        )

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=self.session)

        left = config.plugins.OSDPositionSetup.dst_left.getValue()
        width = config.plugins.OSDPositionSetup.dst_width.getValue()
        top = config.plugins.OSDPositionSetup.dst_top.getValue()
        height = config.plugins.OSDPositionSetup.dst_height.getValue()

        self.dst_left = ConfigSlider(default=left, increment=1, limits=(0, 720))
        self.dst_width = ConfigSlider(default=width, increment=1, limits=(0, 720))
        self.dst_top = ConfigSlider(default=top, increment=1, limits=(0, 576))
        self.dst_height = ConfigSlider(default=height, increment=1, limits=(0, 576))
        self.list.append(getConfigListEntry(_("left"), self.dst_left))
        self.list.append(getConfigListEntry(_("width"), self.dst_width))
        self.list.append(getConfigListEntry(_("top"), self.dst_top))
        self.list.append(getConfigListEntry(_("height"), self.dst_height))
        self["config"].list = self.list
        self["config"].l.setList(self.list)
Exemple #5
0
	def __init__(self, session):
		self.skin = OSD3DSetupScreen.skin
		Screen.__init__(self, session)

		from Components.ActionMap import ActionMap
		from Components.Button import Button

		self["ok"] = Button(_("OK"))
		self["cancel"] = Button(_("Cancel"))
		self["help"] = StaticText()

		self["actions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"green": self.keyGo,
			"red": self.keyCancel,
			"0": self.keyZero,
		}, -2)

		# preparing setting items
		mode = config.plugins.OSD3DSetup.mode.value
		znorm = config.plugins.OSD3DSetup.znorm.value
		menuext = config.plugins.OSD3DSetup.menuext.value
		auto = config.plugins.OSD3DSetup.auto.value
		toggle = config.plugins.OSD3DSetup.toggle.value
		prompt = config.plugins.OSD3DSetup.prompt.value

		self.mode = ConfigSelection(choices = modelist, default = nz(mode, val_auto))
		self.znorm = ConfigSlider(default = znorm + 50, increment = 1, limits = (0, 100))
		self.menuext = ConfigSelection(choices = menulist, default = nz(menuext, "none"))
		self.auto = ConfigYesNo(default = nz(auto, False))
		self.toggle = ConfigSelection(choices = togglelist, default = nz(toggle, val_sidebyside))
		self.prompt = ConfigInteger(nz(prompt,10), limits=(0, 30))
		# adding notifiers to immediatelly preview changed 3D settings
		self.mode.addNotifier(self.setPreviewSettings, initial_call = False)
		self.znorm.addNotifier(self.setPreviewSettings, initial_call = False)

		self.refresh()
		self.initHelpTexts()
		ConfigListScreen.__init__(self, self.list, session = self.session)
		self["config"].onSelectionChanged.append(self.updateHelp)
Exemple #6
0
class UI3DSetupScreen(Screen, ConfigListScreen):
	skin = """
		<screen position="center,center" size="440,300" title="UI 3D setup" >
			<ePixmap pixmap="skin_default/buttons/red.png" position="10,10" size="140,40" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="290,10" size="140,40" alphatest="on" />
			<widget source="key_red" render="Label" position="10,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" transparent="1" />
			<widget source="key_green" render="Label" position="290,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" transparent="1" />
			<widget name="config" zPosition="2" position="10,70" size="410,200" scrollbarMode="showOnDemand" transparent="1" />
		</screen>"""

	def __init__(self, session):
		self.skin = UI3DSetupScreen.skin
		Screen.__init__(self, session)

		from Components.ActionMap import ActionMap
		from Components.Button import Button
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Save"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"green": self.keyGo,
			"red": self.keyCancel,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session)

		mode = config.plugins.UI3DSetup.mode.getValue()
		znorm = config.plugins.UI3DSetup.znorm.getValue()
		setmode = config.plugins.UI3DSetup.setmode.getValue()

		self.mode = ConfigSelection(choices = modelist, default = mode)
		self.znorm = ConfigSlider(default = znorm + 50, increment = 1, limits = (0, 100))
		self.setmode = ConfigSelection(choices = setmodelist, default = setmode)
		self.list.append(getConfigListEntry(_("Setup mode"), self.setmode))
		self.list.append(getConfigListEntry(_("3d mode"), self.mode))
		self.list.append(getConfigListEntry(_("Depth"), self.znorm))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.setPreviewSettings()

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.setPreviewSettings()

	def setPreviewSettings(self):
		applySettings(self.mode.getValue(), self.znorm.getValue() - 50, self.setmode.getValue())

	def keyGo(self):
		config.plugins.UI3DSetup.mode.setValue(self.mode.getValue())
		config.plugins.UI3DSetup.znorm.setValue(self.znorm.getValue() - 50)
		config.plugins.UI3DSetup.setmode.setValue(self.setmode.getValue())
		config.plugins.UI3DSetup.save()
		self.close()

	def keyCancel(self):
		setConfiguredSettings()
		self.close()
Exemple #7
0
	f.close()
	return value

def setPWM(fanid, value):
	if value > 255:
		return
	f = open("/proc/stb/fp/fan_pwm", "w")
	f.write("%x" % value)
	f.close()

#Configuration
config.plugins.FanControl = ConfigSubsection()

config.plugins.FanControl.Fan = ConfigSelection(choices = [("disabled", _("disabled")), ("aus", _("Control disabled")), ("3pin", _("3Pin")), ("4pin", _("4Pin")), ("4pinREG", _("4Pin (PID)"))], default = "disabled")
config.plugins.FanControl.StandbyOff = ConfigSelection(choices = [("false", _("no")), ("true", _("yes")), ("trueRec", _("yes, Except for Recording or HDD"))], default="false")
config.plugins.FanControl.minRPM = ConfigSlider(default = 600, increment = 50, limits = (0, 1500))
config.plugins.FanControl.maxRPM = ConfigSlider(default = 3000, increment = 50, limits = (500, 6000))
config.plugins.FanControl.temp = ConfigSlider(default = 40, increment = 1, limits = (30, 50))
config.plugins.FanControl.tempmax = ConfigSlider(default = 50, increment = 1, limits = (35, 55))
config.plugins.FanControl.pwm = ConfigSlider(default = 130, increment = 5, limits = (0, 255))
config.plugins.FanControl.vlt = ConfigSlider(default = 255, increment = 5, limits = (0, 255))
config.plugins.FanControl.ShowError = ConfigSelection(choices = [("false", _("do nothing")), ("true", _("display Info")), ("shutdown", _("Box Shutdown"))], default="true")
config.plugins.FanControl.ShutdownTemp = ConfigInteger(default = 65,limits = (50, 80))
config.plugins.FanControl.AddOverheat = ConfigInteger(default = 0,limits = (0, 9))
config.plugins.FanControl.DisableDMM = ConfigYesNo(default = False)
config.plugins.FanControl.LogCount = ConfigInteger(default = 40,limits = (40, 999))
config.plugins.FanControl.LogPath = ConfigText(default="/tmp/", fixed_size=False)
config.plugins.FanControl.DeleteData = ConfigSelection(choices = [("0", _("no")), ("2", "2"), ("3", "3"), ("7", "7"), ("14", "14"), ("30", "30")], default="14")
config.plugins.FanControl.EnableConsoleLog = ConfigYesNo(default = False)
config.plugins.FanControl.EnableDataLog = ConfigYesNo(default = False)
config.plugins.FanControl.EnableEventLog = ConfigYesNo(default = False)
Exemple #8
0
    def createConfig(self, *args):
        config.pep = ConfigSubsection()
        config.pep.configsteps = NoSave(
            ConfigSelection(choices=[1, 5, 10, 25], default=1))

        if os.path.exists("/proc/stb/vmpeg/0/pep_contrast"):

            def setContrast(config):
                myval = int(config.value * 256)
                try:
                    print "[VideoEnhancement] setting contrast to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_contrast",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_contrast."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.contrast = ConfigSlider(default=128, limits=(0, 255))
            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 "[VideoEnhancement] setting saturation to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_saturation",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_saturaion."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.saturation = ConfigSlider(default=128, limits=(0, 255))
            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 "[VideoEnhancement] setting hue to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_hue",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_hue."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.hue = ConfigSlider(default=128, limits=(0, 255))
            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 "[VideoEnhancement] setting brightness to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_brightness",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_brightness."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.brightness = ConfigSlider(default=128, limits=(0, 255))
            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 "[VideoEnhancement] 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 "[VideoEnhancement] 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 "[VideoEnhancement] 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 "[VideoEnhancement] 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 "[VideoEnhancement] 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 "[VideoEnhancement] 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_split"):

            def setSplitMode(config):
                try:
                    print "[VideoEnhancement] setting splitmode to:", str(
                        config.value)
                    open("/proc/stb/vmpeg/0/pep_split",
                         "w").write(str(config.value))
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_split."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.split = ConfigSelection(choices={
                "off": _("Off"),
                "left": _("Left"),
                "right": _("Right")
            },
                                               default="off")
            config.pep.split.addNotifier(setSplitMode)
        else:
            config.pep.split = NoSave(ConfigNothing())

        if SystemInfo["ScalerSharpness"]:

            def setSharpness(config):
                myval = int(config.value * 256)
                try:
                    print "[VideoEnhancement] setting sharpness to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_sharpness",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_sharpness."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.sharpness = ConfigSlider(default=0, limits=(0, 255))
            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:
                    print "[VideoEnhancement] setting auto_flesh to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_auto_flesh",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_auto_flesh."

                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:
                    print "[VideoEnhancement] setting green_boost to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_green_boost",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_green_boost."

                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:
                    print "[VideoEnhancement] setting blue_boost to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_blue_boost",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_blue_boost."

                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:
                    print "[VideoEnhancement] setting dynamic_contrast to: %0.8X" % myval
                    open("/proc/stb/vmpeg/0/pep_dynamic_contrast",
                         "w").write("%0.8X" % myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_dynamic_contrast."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.dynamic_contrast = ConfigSlider(default=0,
                                                       limits=(0, 255))
            config.pep.dynamic_contrast.addNotifier(setDynamic_contrast)
        else:
            config.pep.dynamic_contrast = NoSave(ConfigNothing())

        try:
            x = config.av.scaler_sharpness.value
        except KeyError:
            if SystemInfo["ScalerSharpness"]:

                def setScaler_sharpness(config):
                    myval = int(config.value)
                    try:
                        print "[VideoEnhancement] setting scaler_sharpness to: %0.8X" % myval
                        open("/proc/stb/vmpeg/0/pep_scaler_sharpness",
                             "w").write("%0.8X" % myval)
                    except IOError:
                        print "[VideoEnhancement] couldn't write pep_scaler_sharpness."

                    if not VideoEnhancement.firstRun:
                        self.setConfiguredValues()

                config.av.scaler_sharpness = ConfigSlider(default=13,
                                                          limits=(0, 26))
                config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
            else:
                config.av.scaler_sharpness = NoSave(ConfigNothing())

        if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_vertical_dejagging"):

            def setScaler_vertical_dejagging(configElement):
                myval = configElement.value and "enable" or "disable"
                try:
                    print "[VideoEnhancement] setting scaler_vertical_dejagging to: %s" % myval
                    open("/proc/stb/vmpeg/0/pep_scaler_vertical_dejagging",
                         "w").write(myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write pep_scaler_vertical_dejagging."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.scaler_vertical_dejagging = ConfigBoolean(
                default=False,
                descriptions={
                    False: _("Disabled"),
                    True: _("Enabled")
                })
            config.pep.scaler_vertical_dejagging.addNotifier(
                setScaler_vertical_dejagging)
        else:
            config.pep.scaler_vertical_dejagging = NoSave(ConfigNothing())

        if os.path.exists("/proc/stb/vmpeg/0/smooth"):

            def setSmooth(configElement):
                myval = configElement.value and "enable" or "disable"
                try:
                    print "[VideoEnhancement] setting smooth to: %s" % myval
                    open("/proc/stb/vmpeg/0/smooth", "w").write(myval)
                except IOError:
                    print "[VideoEnhancement] couldn't write smooth."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.smooth = ConfigBoolean(default=False,
                                              descriptions={
                                                  False: _("Disabled"),
                                                  True: _("Enabled")
                                              })
            config.pep.smooth.addNotifier(setSmooth)
        else:
            config.pep.smooth = NoSave(ConfigNothing())

        if VideoEnhancement.firstRun:
            self.setConfiguredValues()

        VideoEnhancement.firstRun = False
config.plugins.FanSetup = ConfigSubsection()
config.plugins.FanSetup.mode = ConfigSelection(choices=modelist,
                                               default="auto")
config.plugins.FanSetup.timeset = ConfigSelection(choices=timsetlist,
                                                  default="none")
config.plugins.FanSetup.timestartoff = ConfigClock(default=((21 * 60 + 30) *
                                                            60))
config.plugins.FanSetup.timeendoff = ConfigClock(default=((7 * 60 + 0) * 60))
config.plugins.FanSetup.hddwatch = ConfigSelection(choices=hddwatchlist,
                                                   default="none")
config.plugins.FanSetup.hdddevice = ConfigText(default="all")
config.plugins.FanSetup.hddsleep = ConfigBoolean(default=False)
config.plugins.FanSetup.hddtemp = ConfigInteger(0, limits=(0, 80))
config.plugins.FanSetup.menuhdd = ConfigYesNo(default=False)
config.plugins.FanSetup.fanspeed = ConfigSlider(default=127,
                                                increment=8,
                                                limits=(0, 255))
config.plugins.FanSetup.systemtemp = ConfigInteger(40, limits=(15, 80))
config.plugins.FanSetup.systempwatch = ConfigSelection(choices=syswatchlist,
                                                       default="off")


class FanSetupScreen(Screen, ConfigListScreen):
    global PLUGIN_VERSION
    skin = """
		<screen position="center,center" size="550,335" >
		<widget name="config" position="c-261,c-145" size="533,270" />
		<ePixmap pixmap="skin_default/buttons/green.png" position="c-240,e-45" zPosition="0" size="140,40" alphatest="on" />
		<ePixmap pixmap="skin_default/buttons/red.png" position="c-70,e-45" zPosition="0" size="140,40" alphatest="on" />
		<widget name="ok" position="c-240,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;17" transparent="1" backgroundColor="green" />
		<widget name="cancel" position="c-70,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;17" transparent="1" backgroundColor="red" />
    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
Exemple #11
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    config.av.yuvenabled = ConfigBoolean(default=True)
    colorformat_choices = {"cvbs": _("CVBS")}

    # when YUV, Scart or S-Video is not support by HW, don't let the user select it
    if SystemInfo["HasYPbPr"]:
        colorformat_choices["yuv"] = _("YPbPr")
    if SystemInfo["HasScart"]:
        colorformat_choices["rgb"] = _("RGB")
    if SystemInfo["HasSVideo"]:
        colorformat_choices["svideo"] = _("S-Video")

    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="cvbs")
    config.av.aspectratio = ConfigSelection(choices={
        "4_3_letterbox":
        _("4:3 Letterbox"),
        "4_3_panscan":
        _("4:3 PanScan"),
        "16_9":
        _("16:9"),
        "16_9_always":
        _("16:9 always"),
        "16_10_letterbox":
        _("16:10 Letterbox"),
        "16_10_panscan":
        _("16:10 PanScan"),
        "16_9_letterbox":
        _("16:9 Letterbox")
    },
                                            default="16_9")
    config.av.aspect = ConfigSelection(choices={
        "4_3": _("4:3"),
        "16_9": _("16:9"),
        "16_10": _("16:10"),
        "auto": _("Automatic")
    },
                                       default="auto")
    policy2_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on top/bottom) in doubt, keep english term.
        "letterbox": _("Letterbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "full" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy2_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy2_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_169 = ConfigSelection(choices=policy2_choices,
                                           default="scale")
    policy_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "nonlinear" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
            policy_choices.update({"nonlinear": _("Nonlinear")})
    except:
        pass
    try:
        if "full" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="scale")
    config.av.tvsystem = ConfigSelection(choices={
        "pal": _("PAL"),
        "ntsc": _("NTSC"),
        "multinorm": _("multinorm")
    },
                                         default="pal")
    config.av.wss = ConfigEnableDisable(default=True)
    config.av.generalAC3delay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      5,
                                                      default=0)
    config.av.generalPCMdelay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      5,
                                                      default=0)
    config.av.vcrswitch = ConfigEnableDisable(default=False)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    def setAspectRatio(configElement):
        map = {
            "4_3_letterbox": 0,
            "4_3_panscan": 1,
            "16_9": 2,
            "16_9_always": 3,
            "16_10_letterbox": 4,
            "16_10_panscan": 5,
            "16_9_letterbox": 6
        }
        iAVSwitch.setAspectRatio(map[configElement.value])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

    iAVSwitch.setInput("ENCODER")  # init on startup
    SystemInfo["ScartSwitch"] = eAVSwitch.getInstance().haveScartSwitch()

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_ac3 = ConfigYesNo(default=True)
        config.av.downmix_ac3.addNotifier(setAC3Downmix)

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDownmixAAC"]:

        def setAACDownmix(configElement):
            open("/proc/stb/audio/aac",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_aac = ConfigYesNo(default=True)
        config.av.downmix_aac.addNotifier(setAACDownmix)

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    if SystemInfo["ScalerSharpness"]:

        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)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            except IOError:
                print("[AVSwitch] couldn't write pep_scaler_sharpness")

        config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0, 26))
        config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
    else:
        config.av.scaler_sharpness = NoSave(ConfigNothing())

    if SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["HDMIAudioSource"]:

        def setHDMIAudioSource(configElement):
            open(SystemInfo["HDMIAudioSource"], "w").write(configElement.value)

        config.av.hdmi_audio_source = ConfigSelection(default="pcm",
                                                      choices=[
                                                          ("pcm", _("PCM")),
                                                          ("spdif", _("SPDIF"))
                                                      ])
        config.av.hdmi_audio_source.addNotifier(setHDMIAudioSource)

    def setVolumeStepsize(configElement):
        eDVBVolumecontrol.getInstance().setVolumeSteps(int(
            configElement.value))

    config.av.volume_stepsize = ConfigSelectionNumber(1, 10, 1, default=2)
    config.av.volume_stepsize.addNotifier(setVolumeStepsize)
Exemple #12
0

def leaveStandby():
    toggleDisplay(config.plugins.threed.toggleState)


def standbyCounterChanged(configElement):
    from Screens.Standby import inStandby
    inStandby.onClose.append(leaveStandby)


config.plugins.threed = ConfigSubsection()
config.plugins.threed.showSBSmenu = ConfigYesNo(default=False)
config.plugins.threed.showTBmenu = ConfigYesNo(default=False)
config.plugins.threed.zoffset = ConfigSlider(default=0,
                                             increment=1,
                                             limits=[0, 10])
config.plugins.threed.zoffset.addNotifier(setZOffset)
config.plugins.threed.autothreed = ConfigSelection(
    default="0",
    choices=[("0", _("off")), ("1", _("on with side by side")),
             ("2", _("on with top/bottom"))])


def switchmode(mode):
    if mode in modes.keys():
        print "[3D Settings] switching to mode ", mode
        open("/proc/stb/fb/primary/3d", "w").write(modes[mode])
        AutoThreeD.instance.setLastMode(mode)
        if eDBoxLCD.getInstance().detected():  # display found, update it
            config.plugins.threed.toggleState.setValue(
Exemple #13
0
             ("True", _("Channelnumber in Standby Clock")),
             ("True_Switch", _("Channelnumber/Clock in Standby Clock")),
             ("True_All", _("Clock always")), ("Off", _("Always off"))])
config.plugins.VFD_ini.timeMode = ConfigSelection(default="24h",
                                                  choices=[("12h", _("12h")),
                                                           ("24h", _("24h"))])
config.plugins.VFD_ini.recDisplay = ConfigSelection(default="False",
                                                    choices=[
                                                        ("True", _("yes")),
                                                        ("False", _("no"))
                                                    ])
config.plugins.VFD_ini.recClockBlink = ConfigSelection(
    default="off",
    choices=[("off", _("Off")), ("on_off", _("On/Off")),
             ("brightness", _("Brightness level"))])
config.plugins.VFD_ini.ClockLevel1 = ConfigSlider(default=1, limits=(0, 10))
config.plugins.VFD_ini.ClockLevel2 = ConfigSlider(default=4, limits=(1, 10))

MyRecLed = False


def vfd_write(text):
    if use_oled:
        try:
            open("/dev/dbox/oled0", "w").write(text)
        except:
            pass
    else:
        try:
            open("/dev/dbox/lcd0", "w").write(text)
        except:
Exemple #14
0
    def __init__(self, session):
        self.skin = ScreenPosition.skin
        Screen.__init__(self, session)

        self["ok"] = Button(_("OK"))
        self["cancel"] = Button(_("Cancel"))

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions"], {
                "ok": self.keyGo,
                "save": self.keyGo,
                "cancel": self.keyCancel,
                "green": self.keyGo,
                "red": self.keyCancel,
            }, -2)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=self.session)

        h_start = self.h_start_offset
        h_end = self.h_end_offset
        v_start = self.v_start_offset
        v_end = self.v_end_offset

        try:
            file = open("/proc/stb/video/pal_h_start", "r")
            line = file.readline()
            file.close()
            h_start = int(line, 16)
            file = open("/proc/stb/video/pal_h_end", "r")
            line = file.readline()
            file.close()
            h_end = int(line, 16)
            file = open("/proc/stb/video/pal_v_start", "r")
            line = file.readline()
            file.close()
            v_start = int(line, 16)
            file = open("/proc/stb/video/pal_v_end", "r")
            line = file.readline()
            file.close()
            v_end = int(line, 16)
        except:
            pass

        self.h_start = ConfigSlider(default=h_start - self.h_start_offset,
                                    increment=32,
                                    limits=(0, 0x200))
        self.h_end = ConfigSlider(default=h_end - self.h_end_offset,
                                  increment=32,
                                  limits=(0, 0x200))
        self.v_start = ConfigSlider(default=v_start - self.v_start_offset,
                                    increment=4,
                                    limits=(0, 0x50))
        self.v_end = ConfigSlider(default=v_end - self.v_end_offset,
                                  increment=4,
                                  limits=(0, 0x50))
        self.list.append(getConfigListEntry(_("left"), self.h_start))
        self.list.append(getConfigListEntry(_("right"), self.h_end))
        self.list.append(getConfigListEntry(_("top"), self.v_start))
        self.list.append(getConfigListEntry(_("bottom"), self.v_end))
        self["config"].list = self.list
        self["config"].l.setList(self.list)
Exemple #15
0
class OSD3DSetupScreen(Screen, ConfigListScreen):
    #class for configure 3D default settings
    skin = """
	<screen position="c-200,c-100" size="400,200" title="OSD 3D setup">
		<widget name="config" position="c-175,c-75" size="350,150" />
		<ePixmap pixmap="buttons/green.png" position="c-145,e-45" zPosition="0" size="140,40" alphatest="on" />
		<ePixmap pixmap="buttons/red.png" position="c+5,e-45" zPosition="0" size="140,40" alphatest="on" />
		<widget name="ok" position="c-145,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="green" />
		<widget name="cancel" position="c+5,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="red" />
	</screen>"""

    def __init__(self, session):
        self.skin = OSD3DSetupScreen.skin
        Screen.__init__(self, session)

        from Components.ActionMap import ActionMap
        from Components.Button import Button

        self["ok"] = Button(_("OK"))
        self["cancel"] = Button(_("Cancel"))
        self["help"] = StaticText()

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions"], {
                "ok": self.keyGo,
                "save": self.keyGo,
                "cancel": self.keyCancel,
                "green": self.keyGo,
                "red": self.keyCancel,
                "0": self.keyZero,
            }, -2)

        # preparing setting items
        mode = config.plugins.OSD3DSetup.mode.value
        znorm = config.plugins.OSD3DSetup.znorm.value
        menuext = config.plugins.OSD3DSetup.menuext.value
        auto = config.plugins.OSD3DSetup.auto.value
        toggle = config.plugins.OSD3DSetup.toggle.value
        prompt = config.plugins.OSD3DSetup.prompt.value

        self.mode = ConfigSelection(choices=modelist,
                                    default=nz(mode, val_auto))
        self.znorm = ConfigSlider(default=znorm + 50,
                                  increment=1,
                                  limits=(0, 100))
        self.menuext = ConfigSelection(choices=menulist,
                                       default=nz(menuext, "none"))
        self.auto = ConfigYesNo(default=nz(auto, False))
        self.toggle = ConfigSelection(choices=togglelist,
                                      default=nz(toggle, val_sidebyside))
        self.prompt = ConfigInteger(nz(prompt, 10), limits=(0, 30))
        # adding notifiers to immediatelly preview changed 3D settings
        self.mode.addNotifier(self.setPreviewSettings, initial_call=False)
        self.znorm.addNotifier(self.setPreviewSettings, initial_call=False)

        self.refresh()
        self.initHelpTexts()
        ConfigListScreen.__init__(self, self.list, session=self.session)
        self["config"].onSelectionChanged.append(self.updateHelp)

    def keyLeft(self):
        ConfigListScreen.keyLeft(self)
        self.reloadList()

    def keyRight(self):
        ConfigListScreen.keyRight(self)
        self.reloadList()

    def keyZero(self):
        cur = self["config"].getCurrent()
        if cur == getConfigListEntry(_("Depth"), self.znorm):
            self.znorm.value = 50
            self.reloadList()
        else:
            ConfigListScreen.keyNumberGlobal(self, 0)

    def reloadList(self):
        self.refresh()
        self["config"].setList(self.list)

    def refresh(self):
        list = []
        list.extend((getConfigListEntry(_("3d mode"), self.mode),
                     getConfigListEntry(_("Depth"), self.znorm),
                     getConfigListEntry(_("Show in menu"), self.menuext),
                     getConfigListEntry(_("Turn on automatically"),
                                        self.auto)))

        # Only allow editing toggle mode when the 3d switch command is supposed to apear in menu or 3d should be turned on automatically
        if self.menuext.value is not "none" or self.auto.value:
            list.append(getConfigListEntry(_("Toggle mode"), self.toggle))

        # Only allow editing user prompt when the 3d auto toggle is activated
        if self.auto.value:
            list.append(
                getConfigListEntry(_("Display 3D confirmation"), self.prompt))

        self.list = list

    def initHelpTexts(self):
        self.helpDict = {
            self.mode:
            _("Choose 3D mode (Side by Side, Top And Bottom, Auto, Off)."),
            self.znorm:
            _("Set the depth of 3D effect. Press [0] for standard value."),
            self.menuext:
            _("Should quick toggle command be present in menu / extensions list?"
              ),
            self.auto:
            _("Should the plugin turn on 3D mode automatically judging on the playing media title (3D in service or file name)?"
              ),
            self.toggle:
            _("Define the mode to turn on 3D automatically or by quick toggle menu command [Side By Side] or [Top And Bottom]."
              ),
            self.prompt:
            _("How long should 3D mode on confirmation be displayed (seconds). 0 for none."
              ),
        }

    def updateHelp(self):
        cur = self["config"].getCurrent()
        if cur:
            self["help"].text = self.helpDict.get(cur[1], "")

    #channging mode or znorm is immediatelly previewed

    def setPreviewSettings(self, value):
        applySettings(self.mode.value, int(self.znorm.value) - 50)

    #setting are stored in enigma configuration file

    def keyGo(self):
        config.plugins.OSD3DSetup.mode.value = self.mode.value
        config.plugins.OSD3DSetup.znorm.value = int(self.znorm.value) - 50
        config.plugins.OSD3DSetup.menuext.value = self.menuext.value
        config.plugins.OSD3DSetup.auto.value = self.auto.value
        config.plugins.OSD3DSetup.toggle.value = self.toggle.value
        config.plugins.OSD3DSetup.prompt.value = self.prompt.value
        config.plugins.OSD3DSetup.save()
        #refresh menus to reflect current settings
        plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
        self.close()

    #roll-back changes - read settings from configuration

    def keyCancel(self):
        setConfiguredSettings()
        self.close()
    choices=[("0", "Static color"), ("1", "Fading color (coming soon)")])

config.plugins.Boblight_grab.standby = ConfigEnableDisable(default=False)
config.plugins.Boblight_grab.blackbar = ConfigEnableDisable(default=False)
config.plugins.Boblight_grab.threshold = ConfigInteger(0, (0, 255))
config.plugins.Boblight_grab.pixels = ConfigSelection(default="128",
                                                      choices=[("32", "32"),
                                                               ("64", "64"),
                                                               ("128", "128")])
config.plugins.Boblight_grab.setup = ConfigSelection(default="0",
                                                     choices=[("0", "0"),
                                                              ("1", "1")])
config.plugins.Boblight_grab.chasemode = ConfigEnableDisable(default=False)

config.plugins.Boblight_grab.vscanstart = ConfigSlider(default=0,
                                                       increment=5,
                                                       limits=(0, 100))
config.plugins.Boblight_grab.vscanend = ConfigSlider(default=0,
                                                     increment=5,
                                                     limits=(0, 100))
config.plugins.Boblight_grab.hscanstart = ConfigSlider(default=0,
                                                       increment=5,
                                                       limits=(0, 100))
config.plugins.Boblight_grab.hscanend = ConfigSlider(default=0,
                                                     increment=5,
                                                     limits=(0, 100))

config.plugins.Boblight_grab.autostart = ConfigEnableDisable(default=False)
config.plugins.Boblight_grab.presets = ConfigSelection(
    default="1",
    choices=[("1", "Smooth"), ("2", "Very Smooth"), ("3", "Smooth/Action"),
	def createConfig(self, frontendData):
							   #("Type", frontendData["system"], TYPE_TEXT),
					   #("Modulation", frontendData["modulation"], TYPE_TEXT),
					   #("Orbital position", frontendData["orbital_position"], TYPE_VALUE_DEC),
					   #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
					   #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
					   #("Polarization", frontendData["polarization"], TYPE_TEXT),
					   #("Inversion", frontendData["inversion"], TYPE_TEXT),
					   #("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
				   		#)
		#elif frontendData["tuner_type"] == "DVB-C":
			#return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
					   #("Type", frontendData["tuner_type"], TYPE_TEXT),
					   #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
					   #("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),
					   #("Modulation", frontendData["modulation"], TYPE_TEXT),
					   #("Inversion", frontendData["inversion"], TYPE_TEXT),
			#		   ("FEC inner", frontendData["fec_inner"], TYPE_TEXT),
				   		#)
		#elif frontendData["tuner_type"] == "DVB-T":
			#return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
					   #("Type", frontendData["tuner_type"], TYPE_TEXT),
					   #("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
					   #("Inversion", frontendData["inversion"], TYPE_TEXT),
					   #("Bandwidth", frontendData["bandwidth"], TYPE_VALUE_DEC),
					   #("CodeRateLP", frontendData["code_rate_lp"], TYPE_TEXT),
					   #("CodeRateHP", frontendData["code_rate_hp"], TYPE_TEXT),
					   #("Constellation", frontendData["constellation"], TYPE_TEXT),
					   #("Transmission Mode", frontendData["transmission_mode"], TYPE_TEXT),
					   #("Guard Interval", frontendData["guard_interval"], TYPE_TEXT),
					   #("Hierarchy Inform.", frontendData["hierarchy_information"], TYPE_TEXT),
			defaultSat = {
				"orbpos": 192,
				"system": eDVBFrontendParametersSatellite.System_DVB_S,
				"frequency": 11836,
				"inversion": eDVBFrontendParametersSatellite.Inversion_Unknown,
				"symbolrate": 27500,
				"polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal,
				"fec": eDVBFrontendParametersSatellite.FEC_Auto,
				"fec_s2": eDVBFrontendParametersSatellite.FEC_9_10,
				"modulation": eDVBFrontendParametersSatellite.Modulation_QPSK }
			defaultCab = {
				"frequency": 466,
				"inversion": eDVBFrontendParametersCable.Inversion_Unknown,
				"modulation": eDVBFrontendParametersCable.Modulation_QAM64,
				"fec": eDVBFrontendParametersCable.FEC_Auto,
				"symbolrate": 6900 }
			defaultTer = {
				"frequency" : 466000,
				"inversion" : eDVBFrontendParametersTerrestrial.Inversion_Unknown,
				"bandwidth" : eDVBFrontendParametersTerrestrial.Bandwidth_7MHz,
				"fechigh" : eDVBFrontendParametersTerrestrial.FEC_Auto,
				"feclow" : eDVBFrontendParametersTerrestrial.FEC_Auto,
				"modulation" : eDVBFrontendParametersTerrestrial.Modulation_Auto,
				"transmission_mode" : eDVBFrontendParametersTerrestrial.TransmissionMode_Auto,
				"guard_interval" : eDVBFrontendParametersTerrestrial.GuardInterval_Auto,
				"hierarchy": eDVBFrontendParametersTerrestrial.Hierarchy_Auto }

			if frontendData is not None:
				ttype = frontendData.get("tuner_type", "UNKNOWN")
				if ttype == "DVB-S":
					defaultSat["system"] = frontendData.get("system", eDVBFrontendParametersSatellite.System_DVB_S)
					defaultSat["frequency"] = frontendData.get("frequency", 0) / 1000
					defaultSat["inversion"] = frontendData.get("inversion", eDVBFrontendParametersSatellite.Inversion_Unknown)
					defaultSat["symbolrate"] = frontendData.get("symbol_rate", 0) / 1000
					defaultSat["polarization"] = frontendData.get("polarization", eDVBFrontendParametersSatellite.Polarisation_Horizontal)
					if defaultSat["system"] == eDVBFrontendParametersSatellite.System_DVB_S2:
						defaultSat["fec_s2"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
						defaultSat["rolloff"] = frontendData.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35)
						defaultSat["pilot"] = frontendData.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown)
					else:
						defaultSat["fec"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
					defaultSat["modulation"] = frontendData.get("modulation", eDVBFrontendParametersSatellite.Modulation_QPSK)
					defaultSat["orbpos"] = frontendData.get("orbital_position", 0)
				elif ttype == "DVB-C":
					defaultCab["frequency"] = frontendData.get("frequency", 0) / 1000
					defaultCab["symbolrate"] = frontendData.get("symbol_rate", 0) / 1000
					defaultCab["inversion"] = frontendData.get("inversion", eDVBFrontendParametersCable.Inversion_Unknown)
					defaultCab["fec"] = frontendData.get("fec_inner", eDVBFrontendParametersCable.FEC_Auto)
					defaultCab["modulation"] = frontendData.get("modulation", eDVBFrontendParametersCable.Modulation_QAM16)
				elif ttype == "DVB-T":
					defaultTer["frequency"] = frontendData.get("frequency", 0)
					defaultTer["inversion"] = frontendData.get("inversion", eDVBFrontendParametersTerrestrial.Inversion_Unknown)
					defaultTer["bandwidth"] = frontendData.get("bandwidth", eDVBFrontendParametersTerrestrial.Bandwidth_7MHz)
					defaultTer["fechigh"] = frontendData.get("code_rate_hp", eDVBFrontendParametersTerrestrial.FEC_Auto)
					defaultTer["feclow"] = frontendData.get("code_rate_lp", eDVBFrontendParametersTerrestrial.FEC_Auto)
					defaultTer["modulation"] = frontendData.get("constellation", eDVBFrontendParametersTerrestrial.Modulation_Auto)
					defaultTer["transmission_mode"] = frontendData.get("transmission_mode", eDVBFrontendParametersTerrestrial.TransmissionMode_Auto)
					defaultTer["guard_interval"] = frontendData.get("guard_interval", eDVBFrontendParametersTerrestrial.GuardInterval_Auto)
					defaultTer["hierarchy"] = frontendData.get("hierarchy_information", eDVBFrontendParametersTerrestrial.Hierarchy_Auto)

			self.scan_sat = ConfigSubsection()
			self.scan_cab = ConfigSubsection()
			self.scan_ter = ConfigSubsection()

			self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat")), ("multisat_yes", _("Multisat"))])
			self.scan_typecable = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
			self.scan_typeterrestrial = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
			self.scan_clearallservices = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
			self.scan_onlyfree = ConfigYesNo(default = False)
			self.scan_networkScan = ConfigYesNo(default = False)

			nim_list = []
			# collect all nims which are *not* set to "nothing"
			for n in nimmanager.nim_slots:
				if n.config_mode == "nothing":
					continue
				if n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1:
					continue
				if n.config_mode in ("loopthrough", "satposdepends"):
					root_id = nimmanager.sec.getRoot(n.slot_id, int(n.config.connectedTo.value))
					if n.type == nimmanager.nim_slots[root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa
						continue
				nim_list.append((str(n.slot), n.friendly_full_description))

			self.scan_nims = ConfigSelection(choices = nim_list)

			# status
			self.scan_snr = ConfigSlider()
			self.scan_snr.enabled = False
			self.scan_agc = ConfigSlider()
			self.scan_agc.enabled = False
			self.scan_ber = ConfigSlider()
			self.scan_ber.enabled = False

			# sat
			self.scan_sat.system = ConfigSelection(default = defaultSat["system"], choices = [
				(eDVBFrontendParametersSatellite.System_DVB_S, _("DVB-S")),
				(eDVBFrontendParametersSatellite.System_DVB_S2, _("DVB-S2"))])
			self.scan_sat.frequency = ConfigInteger(default = defaultSat["frequency"], limits = (1, 99999))
			self.scan_sat.inversion = ConfigSelection(default = defaultSat["inversion"], choices = [
				(eDVBFrontendParametersSatellite.Inversion_Off, _("Off")),
				(eDVBFrontendParametersSatellite.Inversion_On, _("On")),
				(eDVBFrontendParametersSatellite.Inversion_Unknown, _("Auto"))])
			self.scan_sat.symbolrate = ConfigInteger(default = defaultSat["symbolrate"], limits = (1, 99999))
			self.scan_sat.polarization = ConfigSelection(default = defaultSat["polarization"], choices = [
				(eDVBFrontendParametersSatellite.Polarisation_Horizontal, _("horizontal")),
				(eDVBFrontendParametersSatellite.Polarisation_Vertical, _("vertical")),
				(eDVBFrontendParametersSatellite.Polarisation_CircularLeft, _("circular left")),
				(eDVBFrontendParametersSatellite.Polarisation_CircularRight, _("circular right"))])
			self.scan_sat.fec = ConfigSelection(default = defaultSat["fec"], choices = [
				(eDVBFrontendParametersSatellite.FEC_Auto, _("Auto")),
				(eDVBFrontendParametersSatellite.FEC_1_2, "1/2"),
				(eDVBFrontendParametersSatellite.FEC_2_3, "2/3"),
				(eDVBFrontendParametersSatellite.FEC_3_4, "3/4"),
				(eDVBFrontendParametersSatellite.FEC_5_6, "5/6"),
				(eDVBFrontendParametersSatellite.FEC_7_8, "7/8"),
				(eDVBFrontendParametersSatellite.FEC_None, _("None"))])
			self.scan_sat.fec_s2 = ConfigSelection(default = defaultSat["fec_s2"], choices = [
				(eDVBFrontendParametersSatellite.FEC_1_2, "1/2"),
				(eDVBFrontendParametersSatellite.FEC_2_3, "2/3"),
				(eDVBFrontendParametersSatellite.FEC_3_4, "3/4"),
				(eDVBFrontendParametersSatellite.FEC_3_5, "3/5"),
				(eDVBFrontendParametersSatellite.FEC_4_5, "4/5"),
				(eDVBFrontendParametersSatellite.FEC_5_6, "5/6"),
				(eDVBFrontendParametersSatellite.FEC_7_8, "7/8"),
				(eDVBFrontendParametersSatellite.FEC_8_9, "8/9"),
				(eDVBFrontendParametersSatellite.FEC_9_10, "9/10")])
			self.scan_sat.modulation = ConfigSelection(default = defaultSat["modulation"], choices = [
				(eDVBFrontendParametersSatellite.Modulation_QPSK, "QPSK"),
				(eDVBFrontendParametersSatellite.Modulation_8PSK, "8PSK")])
			self.scan_sat.rolloff = ConfigSelection(default = defaultSat.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35), choices = [
				(eDVBFrontendParametersSatellite.RollOff_alpha_0_35, "0.35"),
				(eDVBFrontendParametersSatellite.RollOff_alpha_0_25, "0.25"),
				(eDVBFrontendParametersSatellite.RollOff_alpha_0_20, "0.20"),
				(eDVBFrontendParametersSatellite.RollOff_auto, _("Auto"))])
			self.scan_sat.pilot = ConfigSelection(default = defaultSat.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown), choices = [
				(eDVBFrontendParametersSatellite.Pilot_Off, _("Off")),
				(eDVBFrontendParametersSatellite.Pilot_On, _("On")),
				(eDVBFrontendParametersSatellite.Pilot_Unknown, _("Auto"))])

			# cable
			self.scan_cab.frequency = ConfigInteger(default = defaultCab["frequency"], limits = (50, 999))
			self.scan_cab.inversion = ConfigSelection(default = defaultCab["inversion"], choices = [
				(eDVBFrontendParametersCable.Inversion_Off, _("Off")),
				(eDVBFrontendParametersCable.Inversion_On, _("On")),
				(eDVBFrontendParametersCable.Inversion_Unknown, _("Auto"))])
			self.scan_cab.modulation = ConfigSelection(default = defaultCab["modulation"], choices = [
				(eDVBFrontendParametersCable.Modulation_QAM16, "16-QAM"),
				(eDVBFrontendParametersCable.Modulation_QAM32, "32-QAM"),
				(eDVBFrontendParametersCable.Modulation_QAM64, "64-QAM"),
				(eDVBFrontendParametersCable.Modulation_QAM128, "128-QAM"),
				(eDVBFrontendParametersCable.Modulation_QAM256, "256-QAM")])
			self.scan_cab.fec = ConfigSelection(default = defaultCab["fec"], choices = [
				(eDVBFrontendParametersCable.FEC_Auto, _("Auto")),
				(eDVBFrontendParametersCable.FEC_1_2, "1/2"),
				(eDVBFrontendParametersCable.FEC_2_3, "2/3"),
				(eDVBFrontendParametersCable.FEC_3_4, "3/4"),
				(eDVBFrontendParametersCable.FEC_5_6, "5/6"),
				(eDVBFrontendParametersCable.FEC_7_8, "7/8"),
				(eDVBFrontendParametersCable.FEC_8_9, "8/9"),
				(eDVBFrontendParametersCable.FEC_None, _("None"))])
			self.scan_cab.symbolrate = ConfigInteger(default = defaultCab["symbolrate"], limits = (1, 99999))

			# terrestial
			self.scan_ter.frequency = ConfigInteger(default = 466000, limits = (50000, 999000))
			self.scan_ter.inversion = ConfigSelection(default = defaultTer["inversion"], choices = [
				(eDVBFrontendParametersTerrestrial.Inversion_Off, _("Off")),
				(eDVBFrontendParametersTerrestrial.Inversion_On, _("On")),
				(eDVBFrontendParametersTerrestrial.Inversion_Unknown, _("Auto"))])
			# WORKAROUND: we can't use BW-auto
			self.scan_ter.bandwidth = ConfigSelection(default = defaultTer["bandwidth"], choices = [
				(eDVBFrontendParametersTerrestrial.Bandwidth_8MHz, "8MHz"),
				(eDVBFrontendParametersTerrestrial.Bandwidth_7MHz, "7MHz"),
				(eDVBFrontendParametersTerrestrial.Bandwidth_6MHz, "6MHz")])
			#, (eDVBFrontendParametersTerrestrial.Bandwidth_Auto, _("Auto"))))
			self.scan_ter.fechigh = ConfigSelection(default = defaultTer["fechigh"], choices = [
				(eDVBFrontendParametersTerrestrial.FEC_1_2, "1/2"),
				(eDVBFrontendParametersTerrestrial.FEC_2_3, "2/3"),
				(eDVBFrontendParametersTerrestrial.FEC_3_4, "3/4"),
				(eDVBFrontendParametersTerrestrial.FEC_5_6, "5/6"),
				(eDVBFrontendParametersTerrestrial.FEC_7_8, "7/8"),
				(eDVBFrontendParametersTerrestrial.FEC_Auto, _("Auto"))])
			self.scan_ter.feclow = ConfigSelection(default = defaultTer["feclow"], choices = [
				(eDVBFrontendParametersTerrestrial.FEC_1_2, "1/2"),
				(eDVBFrontendParametersTerrestrial.FEC_2_3, "2/3"),
				(eDVBFrontendParametersTerrestrial.FEC_3_4, "3/4"),
				(eDVBFrontendParametersTerrestrial.FEC_5_6, "5/6"),
				(eDVBFrontendParametersTerrestrial.FEC_7_8, "7/8"),
				(eDVBFrontendParametersTerrestrial.FEC_Auto, _("Auto"))])
			self.scan_ter.modulation = ConfigSelection(default = defaultTer["modulation"], choices = [
				(eDVBFrontendParametersTerrestrial.Modulation_QPSK, "QPSK"),
				(eDVBFrontendParametersTerrestrial.Modulation_QAM16, "QAM16"),
				(eDVBFrontendParametersTerrestrial.Modulation_QAM64, "QAM64"),
				(eDVBFrontendParametersTerrestrial.Modulation_Auto, _("Auto"))])
			self.scan_ter.transmission = ConfigSelection(default = defaultTer["transmission_mode"], choices = [
				(eDVBFrontendParametersTerrestrial.TransmissionMode_2k, "2K"),
				(eDVBFrontendParametersTerrestrial.TransmissionMode_8k, "8K"),
				(eDVBFrontendParametersTerrestrial.TransmissionMode_Auto, _("Auto"))])
			self.scan_ter.guard = ConfigSelection(default = defaultTer["guard_interval"], choices = [
				(eDVBFrontendParametersTerrestrial.GuardInterval_1_32, "1/32"),
				(eDVBFrontendParametersTerrestrial.GuardInterval_1_16, "1/16"),
				(eDVBFrontendParametersTerrestrial.GuardInterval_1_8, "1/8"),
				(eDVBFrontendParametersTerrestrial.GuardInterval_1_4, "1/4"),
				(eDVBFrontendParametersTerrestrial.GuardInterval_Auto, _("Auto"))])
			self.scan_ter.hierarchy = ConfigSelection(default = defaultTer["hierarchy"], choices = [
				(eDVBFrontendParametersTerrestrial.Hierarchy_None, _("None")),
				(eDVBFrontendParametersTerrestrial.Hierarchy_1, "1"),
				(eDVBFrontendParametersTerrestrial.Hierarchy_2, "2"),
				(eDVBFrontendParametersTerrestrial.Hierarchy_4, "4"),
				(eDVBFrontendParametersTerrestrial.Hierarchy_Auto, _("Auto"))])

			self.scan_scansat = {}
			for sat in nimmanager.satList:
				#print sat[1]
				self.scan_scansat[sat[0]] = ConfigYesNo(default = False)

			self.scan_satselection = []
			for slot in nimmanager.nim_slots:
				if slot.isCompatible("DVB-S"):
					self.scan_satselection.append(getConfigSatlist(defaultSat["orbpos"], self.satList[slot.slot]))
				else:
					self.scan_satselection.append(None)

			return True
Exemple #18
0
config.plugins.extrafancontrol.hddsleep = ConfigYesNo(default=False)
config.plugins.extrafancontrol.hddtemp = ConfigInteger(0, limits=(0, 80))
config.plugins.extrafancontrol.interval = ConfigSelection(choices=intervallist,
                                                          default="120")
config.plugins.extrafancontrol.interval_tempwatcher = ConfigSelection(
    choices=[("30", "30"), ("45", "45")] + intervallist, default="60")
config.plugins.extrafancontrol.menuhdd = ConfigYesNo(default=False)
config.plugins.extrafancontrol.alt_auto = ConfigYesNo(default=default_auto)
config.plugins.extrafancontrol.warning = NoSave(ConfigNothing())
try:
    config.plugins.extrafancontrol.fanspeed = config.usage.fanspeed
    isSetPMW = False
except:
    isSetPMW = True
    config.plugins.extrafancontrol.fanspeed = ConfigSlider(default=127,
                                                           increment=8,
                                                           limits=(0, 255))
config.plugins.extrafancontrol.altfanspeed = ConfigSlider(default=127,
                                                          increment=8,
                                                          limits=(0, 255))
config.plugins.extrafancontrol.standbyfanspeed = ConfigSlider(default=127,
                                                              increment=8,
                                                              limits=(0, 255))
config.plugins.extrafancontrol.timeset = ConfigSelection(choices=timsetlist,
                                                         default="none")
config.plugins.extrafancontrol.usealtfanspeed = ConfigYesNo(default=False)
config.plugins.extrafancontrol.systemtemp = ConfigInteger(0, limits=(0, 80))
config.plugins.extrafancontrol.cputemp = ConfigInteger(0, limits=(0, 120))
config.plugins.extrafancontrol.speedstandby = ConfigSelection(
    choices=standbylist, default="equal")
config.plugins.extrafancontrol.syswatch = ConfigSelection(
Exemple #19
0
def InitLcd():
	detected = eDBoxLCD.getInstance() and eDBoxLCD.getInstance().detected()
	config.lcd = ConfigSubsection();
	if detected:
		def setLCDbright(configElement):
			ilcd.setBright(configElement.value);

		def setLCDcontrast(configElement):
			ilcd.setContrast(configElement.value);

		def setLCDinverted(configElement):
			ilcd.setInverted(configElement.value);

		def setLCDflipped(configElement):
			ilcd.setFlipped(configElement.value);

		standby_default = 0

		ilcd = LCD()

		if not ilcd.isOled():
			config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
			config.lcd.contrast.addNotifier(setLCDcontrast);
		else:
			config.lcd.contrast = ConfigNothing()
			standby_default = 1

		config.lcd.standby = ConfigSlider(default=standby_default, limits=(0, 10))
		config.lcd.standby.addNotifier(setLCDbright);
		config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby)

		config.lcd.bright = ConfigSlider(default=5, limits=(0, 10))
		config.lcd.bright.addNotifier(setLCDbright);
		config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright)
		config.lcd.bright.callNotifiersOnSaveAndCancel = True

		config.lcd.invert = ConfigYesNo(default=False)
		config.lcd.invert.addNotifier(setLCDinverted);

		config.lcd.flip = ConfigYesNo(default=False)
		config.lcd.flip.addNotifier(setLCDflipped);

		if SystemInfo["LedPowerColor"]:
			def setLedPowerColor(configElement):
				open(SystemInfo["LedPowerColor"], "w").write(configElement.value)
			config.lcd.ledpowercolor = ConfigSelection(default = "1", choices = [("0", _("off")),("1", _("blue")), ("2", _("red")), ("3", _("violet"))])
			config.lcd.ledpowercolor.addNotifier(setLedPowerColor)

		if SystemInfo["LedStandbyColor"]:
			def setLedStandbyColor(configElement):
				open(SystemInfo["LedStandbyColor"], "w").write(configElement.value)
			config.lcd.ledstandbycolor = ConfigSelection(default = "3", choices = [("0", _("off")),("1", _("blue")), ("2", _("red")), ("3", _("violet"))])
			config.lcd.ledstandbycolor.addNotifier(setLedStandbyColor)

		if SystemInfo["LedSuspendColor"]:
			def setLedSuspendColor(configElement):
				open(SystemInfo["LedSuspendColor"], "w").write(configElement.value)
			config.lcd.ledsuspendcolor = ConfigSelection(default = "2", choices = [("0", _("off")),("1", _("blue")), ("2", _("red")), ("3", _("violet"))])
			config.lcd.ledsuspendcolor.addNotifier(setLedSuspendColor)

		if SystemInfo["Power4x7On"]:
			def setPower4x7On(configElement):
				open(SystemInfo["Power4x7On"], "w").write(configElement.value)
			config.lcd.power4x7on = ConfigSelection(default = "on", choices = [("off", _("Off")), ("on", _("On"))])
			config.lcd.power4x7on.addNotifier(setPower4x7On)

		if SystemInfo["Power4x7Standby"]:
			def setPower4x7Standby(configElement):
				open(SystemInfo["Power4x7Standby"], "w").write(configElement.value)
			config.lcd.power4x7standby = ConfigSelection(default = "on", choices = [("off", _("Off")), ("on", _("On"))])
			config.lcd.power4x7standby.addNotifier(setPower4x7Standby)

		if SystemInfo["Power4x7Suspend"]:
			def setPower4x7Suspend(configElement):
				open(SystemInfo["Power4x7Suspend"], "w").write(configElement.value)
			config.lcd.power4x7suspend = ConfigSelection(default = "off", choices = [("off", _("Off")), ("on", _("On"))])
			config.lcd.power4x7suspend.addNotifier(setPower4x7Suspend)

		if SystemInfo["LcdLiveTV"]:
			def lcdLiveTvChanged(configElement):
				setLCDLiveTv(configElement.value)
				configElement.save()
			config.lcd.showTv = ConfigYesNo(default = False)
			config.lcd.showTv.addNotifier(lcdLiveTvChanged)

			if "live_enable" in SystemInfo["LcdLiveTV"]:
				config.misc.standbyCounter.addNotifier(standbyCounterChangedLCDLiveTV, initial_call = False)
	else:
		def doNothing():
			pass
		config.lcd.contrast = ConfigNothing()
		config.lcd.bright = ConfigNothing()
		config.lcd.standby = ConfigNothing()
		config.lcd.bright.apply = lambda : doNothing()
		config.lcd.standby.apply = lambda : doNothing()

	config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False)
Exemple #20
0
    def createConfig(self, *args):
        config.pep = ConfigSubsection()
        config.pep.configsteps = NoSave(
            ConfigSelection(choices=[1, 5, 10, 25], default=1))

        if os_path.exists("/proc/stb/vmpeg/0/pep_contrast"):

            def setContrast(config):
                myval = int(config.getValue() * 256)
                try:
                    print "--> setting contrast to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_contrast", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                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.getValue() * 256)
                try:
                    print "--> setting saturation to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_saturation", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                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.getValue() * 256)
                try:
                    print "--> setting hue to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_hue", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                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.getValue() * 256)
                try:
                    print "--> setting brightness to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_brightness", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                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.getValue())
                try:
                    print "--> setting block_noise_reduction to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_block_noise_reduction",
                             "w")
                    f.write("%0.8X" % myval)
                    f.close()
                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.getValue())
                try:
                    print "--> setting mosquito_noise_reduction to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction",
                             "w")
                    f.write("%0.8X" % myval)
                    f.close()
                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.getValue())
                try:
                    print "--> setting digital_contour_removal to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_digital_contour_removal",
                             "w")
                    f.write("%0.8X" % myval)
                    f.close()
                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_split"):

            def setSplitMode(config):
                try:
                    print "--> setting splitmode to:", str(config.getValue())
                    f = open("/proc/stb/vmpeg/0/pep_split", "w")
                    f.write(str(config.getValue()))
                    f.close()
                except IOError:
                    print "couldn't write pep_split."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.split = ConfigSelection(choices={
                "off": _("Off"),
                "left": _("Left"),
                "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.getValue() * 256)
                try:
                    print "--> setting sharpness to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_sharpness", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                except IOError:
                    print "couldn't write pep_sharpness."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            if getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus':
                config.pep.sharpness = ConfigSlider(default=256,
                                                    limits=(0, 256))
            else:
                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.getValue())
                try:
                    print "--> setting auto_flesh to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_auto_flesh", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                except IOError:
                    print "couldn't write pep_auto_flesh."

                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.getValue())
                try:
                    print "--> setting green_boost to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_green_boost", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                except IOError:
                    print "couldn't write pep_green_boost."

                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.getValue())
                try:
                    print "--> setting blue_boost to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_blue_boost", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                except IOError:
                    print "couldn't write pep_blue_boost."

                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.getValue())
                try:
                    print "--> setting dynamic_contrast to: %0.8X" % myval
                    f = open("/proc/stb/vmpeg/0/pep_dynamic_contrast", "w")
                    f.write("%0.8X" % myval)
                    f.close()
                except IOError:
                    print "couldn't write pep_dynamic_contrast."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            if getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus':
                config.pep.dynamic_contrast = ConfigSlider(default=3,
                                                           limits=(0, 256))
            else:
                config.pep.dynamic_contrast = ConfigSlider(default=0,
                                                           limits=(0, 256))
            config.pep.dynamic_contrast.addNotifier(setDynamic_contrast)
        else:
            config.pep.dynamic_contrast = NoSave(ConfigNothing())

        try:
            x = config.av.scaler_sharpness.getValue()
        except KeyError:
            if os_path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):

                def setScaler_sharpness(config):
                    myval = int(config.getValue())
                    try:
                        print "--> setting scaler_sharpness to: %0.8X" % myval
                        f = open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w")
                        f.write("%0.8X" % myval)
                        f.close()
                    except IOError:
                        print "couldn't write pep_scaler_sharpness."

                    if not VideoEnhancement.firstRun:
                        self.setConfiguredValues()

                config.av.scaler_sharpness = ConfigSlider(default=13,
                                                          limits=(0, 26))
                config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
            else:
                config.av.scaler_sharpness = NoSave(ConfigNothing())

        if os_path.exists(
                "/proc/stb/video/hdmi_colorspace") and os_path.exists(
                    "/proc/stb/video/hdmi_colorspace_choices"):

            def setColour_space(config):
                myval = config.getValue()
                try:
                    print "--> setting color_soace to:", myval
                    f = open("/proc/stb/video/hdmi_colorspace", "w")
                    f.write(myval)
                    f.close()
                except IOError:
                    print "couldn't write color_soace."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            file = open("/proc/stb/video/hdmi_colorspace_choices", "r")
            modes = file.readline().split()
            file.close()
            config.pep.color_space = ConfigSelection(modes, modes[0])
            config.pep.color_space.addNotifier(setColour_space)
        else:
            config.pep.color_space = NoSave(ConfigNothing())

        if VideoEnhancement.firstRun:
            self.setConfiguredValues()

        VideoEnhancement.firstRun = False
Exemple #21
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSlider
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.Label import Label
from Plugins.Plugin import PluginDescriptor
import fcntl

config.plugins.brightnesssetup = ConfigSubsection()
config.plugins.brightnesssetup.brightness = ConfigSlider(default=1,
                                                         increment=1,
                                                         limits=(0, 15))
config.plugins.brightnesssetup.brightnessdeepstandby = ConfigSlider(
    default=5, increment=1, limits=(0, 15))
config.plugins.brightnesssetup.blinkingtime = ConfigSlider(default=5,
                                                           increment=1,
                                                           limits=(0, 15))


class LEDOption:
    BRIGHTNESS = 0
    DEEPSTANDBY = 1
    BLINKINGTIME = 2


class LEDSetup:
    LED_IOCTL_BRIGHTNESS_NORMAL = 0X10
    LED_IOCTL_BRIGHTNESS_DEEPSTANDBY = 0X11
Exemple #22
0
# for localized messages
from . import _

from Components.config import config, ConfigSubList, ConfigSubsection
import NavigationInstance
from enigma import iRecordableService, eTimer, iPlayableService, eServiceCenter, iServiceInformation
from Components.ConfigList import ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSlider
from Components.Harddisk import harddiskmanager

config.plugins.manualfancontrols = ConfigSubsection()
config.plugins.manualfancontrols.standbymode = ConfigSelection(default = "yes", choices = [
	("no", _("no")), ("yes", _("yes"))])

if config.misc.boxtype.value == 'vuultimo':
	config.plugins.manualfancontrols.pwmvalue = ConfigSlider(default = 100, increment = 5, limits = (0, 255))
else:
	config.plugins.manualfancontrols.pwmvalue = ConfigSlider(default = 10, increment = 5, limits = (0, 255))

config.plugins.manualfancontrols.checkperiod = ConfigSelection(default = "10", choices = [
		("5", "5 " + _("seconds")), ("10", "10 " + _("seconds")), ("30", "30 " + _("seconds")),
		("60", "1 " + _("minute")), ("120", "2 " + _("minutes")),
		("300", "5 " + _("minutes")), ("600", "10 " + _("minutes"))])

instandbyOn_playingpvr = False

class instandbyOn:
	def __init__(self):
		self.fanoffmode = 'OFF'
		self.minimum_pwm = 5
		self.setPWM(config.plugins.manualfancontrols.pwmvalue.value)
Exemple #23
0
config.plugins.VFD_Giga.ledDSBY2 = ConfigYesNo(default = True)
config.plugins.VFD_Giga.ledDSBY2 = ConfigSelection(default = "1", choices = [("0", _("No")), ("1", _("Yes"))])
config.plugins.VFD_Giga.ledSDA1 = ConfigSelection(led, default = "0")
config.plugins.VFD_Giga.ledSDB1 = ConfigSelection(led, default = "0")
config.plugins.VFD_Giga.timeMode = ConfigSelection(default = "24h", choices = [("12h"), ("24h")])
if BOX == "gbtrio4k":
	Brightness_default = 1
	Brightness_increment = 1
	Brightness_limits_min = 0
	Brightness_limits_max = 8
else:
	Brightness_default = 255
	Brightness_increment = 5
	Brightness_limits_min = 0
	Brightness_limits_max = 255
config.plugins.VFD_Giga.vfdBrightness = ConfigSlider(default=255, increment = 5, limits=(0, 255))
config.plugins.VFD_Giga.vfdBrightnessStandby = ConfigSlider(default=Brightness_default, increment = Brightness_increment, limits=(0, Brightness_limits_max))

RecLed = None

def vfd_write(text):
	try:
		open("/dev/mcu", "w").write(text)
	except IOError:
		print("[LED-GIGA] vfd_write failed!")

def setvfdBrightness(value):
	if BOX in ('gbtrio4k'):
		value *= 255 // 10
		if value > 255:
			value = 255
def InitOsd():
    SystemInfo["CanChange3DOsd"] = (access('/proc/stb/fb/3dmode', R_OK)
                                    or access('/proc/stb/fb/primary/3d',
                                              R_OK)) and True or False
    SystemInfo["CanChangeOsdAlpha"] = access('/proc/stb/video/alpha',
                                             R_OK) and True or False
    SystemInfo["CanChangeOsdPosition"] = access('/proc/stb/fb/dst_left',
                                                R_OK) and True or False
    SystemInfo["OsdSetup"] = SystemInfo["CanChangeOsdPosition"]

    def languageNotifier(configElement):
        language.activateLanguage(configElement.value)

    config.osd = ConfigSubsection()
    config.osd.language = ConfigText(default="en_GB")
    config.osd.language.addNotifier(languageNotifier)
    config.osd.dst_left = ConfigSelectionNumber(default=0,
                                                stepwidth=1,
                                                min=0,
                                                max=720,
                                                wraparound=False)
    config.osd.dst_width = ConfigSelectionNumber(default=720,
                                                 stepwidth=1,
                                                 min=0,
                                                 max=720,
                                                 wraparound=False)
    config.osd.dst_top = ConfigSelectionNumber(default=0,
                                               stepwidth=1,
                                               min=0,
                                               max=576,
                                               wraparound=False)
    config.osd.dst_height = ConfigSelectionNumber(default=576,
                                                  stepwidth=1,
                                                  min=0,
                                                  max=576,
                                                  wraparound=False)
    config.osd.alpha = ConfigSelectionNumber(default=255,
                                             stepwidth=1,
                                             min=0,
                                             max=255,
                                             wraparound=False)
    config.av.osd_alpha = NoSave(ConfigNumber(default=255))
    config.osd.threeDmode = ConfigSelection(
        [("off", _("Off")), ("auto", _("Auto")),
         ("sidebyside", _("Side by Side")),
         ("topandbottom", _("Top and Bottom"))], "auto")
    config.osd.threeDznorm = ConfigSlider(default=50,
                                          increment=1,
                                          limits=(0, 100))
    config.osd.show3dextensions = ConfigYesNo(default=False)

    if SystemInfo["CanChangeOsdAlpha"] == True or SystemInfo[
            "CanChangeOsdPosition"] == True:
        SystemInfo["OsdMenu"] = True
    else:
        SystemInfo["OsdMenu"] = False

    def setOSDLeft(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/fb/dst_left", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_left.addNotifier(setOSDLeft)

    def setOSDWidth(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/fb/dst_width", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_width.addNotifier(setOSDWidth)

    def setOSDTop(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/fb/dst_top", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_top.addNotifier(setOSDTop)

    def setOSDHeight(configElement):
        if SystemInfo["CanChangeOsdPosition"]:
            f = open("/proc/stb/fb/dst_height", "w")
            f.write('%X' % configElement.value)
            f.close()

    config.osd.dst_height.addNotifier(setOSDHeight)
    print 'Setting OSD position: %s %s %s %s' % (
        config.osd.dst_left.value, config.osd.dst_width.value,
        config.osd.dst_top.value, config.osd.dst_height.value)

    def setOSDAlpha(configElement):
        print 'Setting OSD alpha:', str(configElement.value)
        config.av.osd_alpha.setValue(configElement.value)
        f = open("/proc/stb/video/alpha", "w")
        f.write(str(configElement.value))
        f.close()

    config.osd.alpha.addNotifier(setOSDAlpha)

    def set3DMode(configElement):
        if SystemInfo["CanChange3DOsd"] and getBoxType() not in ('spycat'):
            print 'Setting 3D mode:', configElement.value
            file3d = fileCheck('/proc/stb/fb/3dmode') or fileCheck(
                '/proc/stb/fb/primary/3d')
            f = open(file3d, "w")
            f.write(configElement.value)
            f.close()

    config.osd.threeDmode.addNotifier(set3DMode)

    def set3DZnorm(configElement):
        if SystemInfo["CanChange3DOsd"] and getBoxType() not in ('spycat'):
            print 'Setting 3D depth:', configElement.value
            f = open("/proc/stb/fb/znorm", "w")
            f.write('%d' % int(configElement.value))
            f.close()

    config.osd.threeDznorm.addNotifier(set3DZnorm)
Exemple #25
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    if model == "vuduo" or getBoxBrand() == "ixuss":
        config.av.yuvenabled = ConfigBoolean(default=False)
    else:
        config.av.yuvenabled = ConfigBoolean(default=True)
    colorformat_choices = {"cvbs": _("CVBS")}

    # when YUV, Scart or S-Video is not support by HW, don't let the user select it
    if SystemInfo["HasYPbPr"]:
        colorformat_choices["yuv"] = _("YPbPr")
    if SystemInfo["HasScart"]:
        colorformat_choices["rgb"] = _("RGB")
    if SystemInfo["HasSVideo"]:
        colorformat_choices["svideo"] = _("S-Video")

    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="cvbs")
    config.av.aspectratio = ConfigSelection(choices={
        "4_3_letterbox":
        _("4:3 Letterbox"),
        "4_3_panscan":
        _("4:3 PanScan"),
        "16_9":
        _("16:9"),
        "16_9_always":
        _("16:9 always"),
        "16_10_letterbox":
        _("16:10 Letterbox"),
        "16_10_panscan":
        _("16:10 PanScan"),
        "16_9_letterbox":
        _("16:9 Letterbox")
    },
                                            default="16_9")
    config.av.aspect = ConfigSelection(choices={
        "4_3": _("4:3"),
        "16_9": _("16:9"),
        "16_10": _("16:10"),
        "auto": _("Automatic")
    },
                                       default="auto")
    policy2_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on top/bottom) in doubt, keep english term.
        "letterbox": _("Letterbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "full" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy2_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy2_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_169 = ConfigSelection(choices=policy2_choices,
                                           default="scale")
    policy_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "nonlinear" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
            policy_choices.update({"nonlinear": _("Nonlinear")})
    except:
        pass
    try:
        if "full" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="scale")
    config.av.tvsystem = ConfigSelection(choices={
        "pal": _("PAL"),
        "ntsc": _("NTSC"),
        "multinorm": _("multinorm")
    },
                                         default="pal")
    config.av.wss = ConfigEnableDisable(default=True)
    config.av.generalAC3delay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      5,
                                                      default=0)
    config.av.generalPCMdelay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      5,
                                                      default=0)
    config.av.vcrswitch = ConfigEnableDisable(default=False)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        if model == "et6x00":
            map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}
        elif platform == "gb7356" or model.startswith('et'):
            map = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3}
        else:
            map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    def setAspectRatio(configElement):
        map = {
            "4_3_letterbox": 0,
            "4_3_panscan": 1,
            "16_9": 2,
            "16_9_always": 3,
            "16_10_letterbox": 4,
            "16_10_panscan": 5,
            "16_9_letterbox": 6
        }
        iAVSwitch.setAspectRatio(map[configElement.value])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

    iAVSwitch.setInput("ENCODER")  # init on startup
    if platform == "gb7356" or model in (
            "et5x00", "et6x00", "ixussone", "ixusszero", "axodin", "axase3",
            "optimussos1", "optimussos2", "gb800seplus", "gb800ueplus",
            "gbultrase", "gbultraue", "gbultraueh", "twinboxlcd"):
        detected = False
    else:
        detected = eAVSwitch.getInstance().haveScartSwitch()

    SystemInfo["ScartSwitch"] = detected

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            if SystemInfo["DreamBoxAudio"]:
                open("/proc/stb/audio/ac3", "w").write(configElement.value)
            else:
                open("/proc/stb/audio/ac3",
                     "w").write(configElement.value and "downmix"
                                or "passthrough")

        if SystemInfo["DreamBoxAudio"]:
            choice_list = [("downmix", _("Downmix")),
                           ("passthrough", _("Passthrough")),
                           ("multichannel", _("convert to multi-channel PCM")),
                           ("hdmi_best", _("use best / controlled by HDMI"))]
            config.av.downmix_ac3 = ConfigSelection(choices=choice_list,
                                                    default="downmix")
        else:
            config.av.downmix_ac3 = ConfigYesNo(default=True)
        config.av.downmix_ac3.addNotifier(setAC3Downmix)

    if SystemInfo["CanAC3plusTranscode"]:

        def setAC3plusTranscode(configElement):
            open("/proc/stb/audio/ac3plus", "w").write(configElement.value)

        if SystemInfo["DreamBoxAudio"]:
            choice_list = [("use_hdmi_caps", _("controlled by HDMI")),
                           ("force_ac3", _("convert to AC3")),
                           ("multichannel", _("convert to multi-channel PCM")),
                           ("hdmi_best", _("use best / controlled by HDMI")),
                           ("force_ddp", _("force AC3plus"))]
            config.av.transcodeac3plus = ConfigSelection(choices=choice_list,
                                                         default="force_ac3")
        elif platform in ("gb7252", "gb72604"):
            choice_list = [("downmix", _("Downmix")),
                           ("passthrough", _("Passthrough")),
                           ("force_ac3", _("convert to AC3")),
                           ("multichannel", _("convert to multi-channel PCM")),
                           ("force_dts", _("convert to DTS"))]
            config.av.transcodeac3plus = ConfigSelection(choices=choice_list,
                                                         default="force_ac3")
        else:
            choice_list = [("use_hdmi_caps", _("controlled by HDMI")),
                           ("force_ac3", _("convert to AC3"))]
            config.av.transcodeac3plus = ConfigSelection(choices=choice_list,
                                                         default="force_ac3")
        config.av.transcodeac3plus.addNotifier(setAC3plusTranscode)

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDTSHD"]:

        def setDTSHD(configElement):
            open("/proc/stb/audio/dtshd", "w").write(configElement.value)

        if model in ("dm7080", "dm820"):
            choice_list = [("use_hdmi_caps", _("controlled by HDMI")),
                           ("force_dts", _("convert to DTS"))]
            config.av.dtshd = ConfigSelection(choices=choice_list,
                                              default="use_hdmi_caps")
        else:
            choice_list = [("downmix", _("Downmix")),
                           ("force_dts", _("convert to DTS")),
                           ("use_hdmi_caps", _("controlled by HDMI")),
                           ("multichannel", _("convert to multi-channel PCM")),
                           ("hdmi_best", _("use best / controlled by HDMI"))]
            config.av.dtshd = ConfigSelection(choices=choice_list,
                                              default="downmix")
        config.av.dtshd.addNotifier(setDTSHD)

    if SystemInfo["CanWMAPRO"]:

        def setWMAPRO(configElement):
            open("/proc/stb/audio/wmapro", "w").write(configElement.value)

        choice_list = [("downmix", _("Downmix")),
                       ("passthrough", _("Passthrough")),
                       ("multichannel", _("convert to multi-channel PCM")),
                       ("hdmi_best", _("use best / controlled by HDMI"))]
        config.av.wmapro = ConfigSelection(choices=choice_list,
                                           default="downmix")
        config.av.wmapro.addNotifier(setWMAPRO)

    if SystemInfo["CanDownmixAAC"]:

        def setAACDownmix(configElement):
            if SystemInfo["DreamBoxAudio"] or platform in ("gb7252",
                                                           "gb72604"):
                open("/proc/stb/audio/aac", "w").write(configElement.value)
            else:
                open("/proc/stb/audio/aac",
                     "w").write(configElement.value and "downmix"
                                or "passthrough")

        if SystemInfo["DreamBoxAudio"]:
            choice_list = [("downmix", _("Downmix")),
                           ("passthrough", _("Passthrough")),
                           ("multichannel", _("convert to multi-channel PCM")),
                           ("hdmi_best", _("use best / controlled by HDMI"))]
            config.av.downmix_aac = ConfigSelection(choices=choice_list,
                                                    default="downmix")
        elif platform in ("gb7252", "gb72604"):
            choice_list = [("downmix", _("Downmix")),
                           ("passthrough", _("Passthrough")),
                           ("multichannel", _("convert to multi-channel PCM")),
                           ("force_ac3", _("convert to AC3")),
                           ("force_dts", _("convert to DTS")),
                           ("use_hdmi_cacenter", _("use_hdmi_cacenter")),
                           ("wide", _("wide")), ("extrawide", _("extrawide"))]
            config.av.downmix_aac = ConfigSelection(choices=choice_list,
                                                    default="downmix")
        else:
            config.av.downmix_aac = ConfigYesNo(default=True)
        config.av.downmix_aac.addNotifier(setAACDownmix)

    if SystemInfo["CanDownmixAACPlus"]:

        def setAACDownmixPlus(configElement):
            open("/proc/stb/audio/aacplus", "w").write(configElement.value)

        choice_list = [("downmix", _("Downmix")),
                       ("passthrough", _("Passthrough")),
                       ("multichannel", _("convert to multi-channel PCM")),
                       ("force_ac3", _("convert to AC3")),
                       ("force_dts", _("convert to DTS")),
                       ("use_hdmi_cacenter", _("use_hdmi_cacenter")),
                       ("wide", _("wide")), ("extrawide", _("extrawide"))]
        config.av.downmix_aacplus = ConfigSelection(choices=choice_list,
                                                    default="downmix")
        config.av.downmix_aacplus.addNotifier(setAACDownmixPlus)

    if SystemInfo["CanAACTranscode"]:

        def setAACTranscode(configElement):
            open("/proc/stb/audio/aac_transcode",
                 "w").write(configElement.value)

        choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]
        config.av.transcodeaac = ConfigSelection(choices=choice_list,
                                                 default="off")
        config.av.transcodeaac.addNotifier(setAACTranscode)
    else:
        config.av.transcodeaac = ConfigNothing()

    if SystemInfo["CanBTAudio"]:

        def setBTAudio(configElement):
            open("/proc/stb/audio/btaudio", "w").write(configElement.value)

        choice_list = [("off", _("off")), ("on", _("on"))]
        config.av.btaudio = ConfigSelection(choices=choice_list, default="off")
        config.av.btaudio.addNotifier(setBTAudio)
    else:
        config.av.btaudio = ConfigNothing()

    if SystemInfo["CanBTAudioDelay"]:

        def setBTAudioDelay(configElement):
            open("/proc/stb/audio/btaudio",
                 "w").write(format(configElement.value * 90))

        config.av.btaudiodelay = ConfigSelectionNumber(-1000,
                                                       1000,
                                                       5,
                                                       default=0)
        config.av.btaudiodelay.addNotifier(setBTAudioDelay)
    else:
        config.av.btaudiodelay = ConfigNothing()

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    if SystemInfo["ScalerSharpness"]:

        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)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            except IOError:
                print("[AVSwitch] couldn't write pep_scaler_sharpness")

        if platform == "gb7356":
            config.av.scaler_sharpness = ConfigSlider(default=5,
                                                      limits=(0, 26))
        else:
            config.av.scaler_sharpness = ConfigSlider(default=13,
                                                      limits=(0, 26))
        config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
    else:
        config.av.scaler_sharpness = NoSave(ConfigNothing())

    if SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["HasAutoVolume"]:

        def setAutoVolume(configElement):
            open(SystemInfo["HasAutoVolume"], "w").write(configElement.value)

        config.av.autovolume = ConfigSelection(default="none",
                                               choices=[("none", _("off")),
                                                        ("hdmi", _("HDMI")),
                                                        ("spdif", _("SPDIF")),
                                                        ("dac", _("DAC"))])
        config.av.autovolume.addNotifier(setAutoVolume)

    if SystemInfo["HasAutoVolumeLevel"]:

        def setAutoVolumeLevel(configElement):
            open(SystemInfo["HasAutoVolumeLevel"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.autovolumelevel = ConfigYesNo(default=False)
        config.av.autovolumelevel.addNotifier(setAutoVolumeLevel)

    if SystemInfo["Has3DSurround"]:

        def set3DSurround(configElement):
            open(SystemInfo["Has3DSurround"], "w").write(configElement.value)

        config.av.surround_3d = ConfigSelection(default="none",
                                                choices=[("none", _("off")),
                                                         ("hdmi", _("HDMI")),
                                                         ("spdif", _("SPDIF")),
                                                         ("dac", _("DAC"))])
        config.av.surround_3d.addNotifier(set3DSurround)

    if SystemInfo["Has3DSpeaker"]:

        def set3DSpeaker(configElement):
            open(SystemInfo["Has3DSpeaker"], "w").write(configElement.value)

        config.av.speaker_3d = ConfigSelection(default="center",
                                               choices=[("center",
                                                         _("center")),
                                                        ("wide", _("wide")),
                                                        ("extrawide",
                                                         _("extra wide"))])
        config.av.speaker_3d.addNotifier(set3DSpeaker)

    if SystemInfo["Has3DSurroundSpeaker"]:

        def set3DSurroundSpeaker(configElement):
            open(SystemInfo["Has3DSurroundSpeaker"],
                 "w").write(configElement.value)

        config.av.surround_3d_speaker = ConfigSelection(
            default="disabled",
            choices=[("disabled", _("off")), ("center", _("center")),
                     ("wide", _("wide")), ("extrawide", _("extra wide"))])
        config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)

    if SystemInfo["Has3DSurroundSoftLimiter"]:

        def set3DSurroundSoftLimiter(configElement):
            open(SystemInfo["Has3DSurroundSoftLimiter"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.surround_softlimiter_3d = ConfigYesNo(default=False)
        config.av.surround_softlimiter_3d.addNotifier(set3DSurroundSoftLimiter)

    if SystemInfo["HDMIAudioSource"]:

        def setHDMIAudioSource(configElement):
            open(SystemInfo["HDMIAudioSource"], "w").write(configElement.value)

        config.av.hdmi_audio_source = ConfigSelection(default="pcm",
                                                      choices=[
                                                          ("pcm", _("PCM")),
                                                          ("spdif", _("SPDIF"))
                                                      ])
        config.av.hdmi_audio_source.addNotifier(setHDMIAudioSource)

    def setVolumeStepsize(configElement):
        eDVBVolumecontrol.getInstance().setVolumeSteps(int(
            configElement.value))

    config.av.volume_stepsize = ConfigSelectionNumber(1, 10, 1, default=5)
    config.av.volume_stepsize.addNotifier(setVolumeStepsize)
Exemple #26
0
class OSDScreenPosition(Screen, ConfigListScreen):
	skin = """
	<screen position="0,0" size="e,e" title="OSD position setup" backgroundColor="blue">
		<widget name="config" position="c-175,c-75" size="350,150" foregroundColor="black" backgroundColor="blue" />
		<ePixmap pixmap="skin_default/buttons/green.png" position="c-145,e-100" zPosition="0" size="140,40" alphatest="on" />
		<ePixmap pixmap="skin_default/buttons/red.png" position="c+5,e-100" zPosition="0" size="140,40" alphatest="on" />
		<widget name="ok" position="c-145,e-100" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="green" />
		<widget name="cancel" position="c+5,e-100" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="red" />
	</screen>"""

	def __init__(self, session):
		self.skin = OSDScreenPosition.skin
		Screen.__init__(self, session)

		from Components.ActionMap import ActionMap
		from Components.Button import Button

		self["ok"] = Button(_("OK"))
		self["cancel"] = Button(_("Cancel"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"green": self.keyGo,
			"red": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session)

		left = config.plugins.OSDPositionSetup.dst_left.getValue()
		width = config.plugins.OSDPositionSetup.dst_width.getValue()
		top = config.plugins.OSDPositionSetup.dst_top.getValue()
		height = config.plugins.OSDPositionSetup.dst_height.getValue()

		self.dst_left = ConfigSlider(default = left, increment = 1, limits = (0, 720))
		self.dst_width = ConfigSlider(default = width, increment = 1, limits = (0, 720))
		self.dst_top = ConfigSlider(default = top, increment = 1, limits = (0, 576))
		self.dst_height = ConfigSlider(default = height, increment = 1, limits = (0, 576))
		self.list.append(getConfigListEntry(_("left"), self.dst_left))
		self.list.append(getConfigListEntry(_("width"), self.dst_width))
		self.list.append(getConfigListEntry(_("top"), self.dst_top))
		self.list.append(getConfigListEntry(_("height"), self.dst_height))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.setPreviewPosition()

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.setPreviewPosition()

	def setPreviewPosition(self):
		setPosition(int(self.dst_left.getValue()), int(self.dst_width.getValue()), int(self.dst_top.getValue()), int(self.dst_height.getValue()))

	def keyGo(self):
		config.plugins.OSDPositionSetup.dst_left.value = self.dst_left.getValue()
		config.plugins.OSDPositionSetup.dst_width.value = self.dst_width.getValue()
		config.plugins.OSDPositionSetup.dst_top.value = self.dst_top.getValue()
		config.plugins.OSDPositionSetup.dst_height.value = self.dst_height.getValue()
		config.plugins.OSDPositionSetup.save()
		self.close()

	def keyCancel(self):
		setConfiguredPosition()
		self.close()
Exemple #27
0
class BrowserPositionWindow(Screen, ConfigListScreen):
	skin = """
		<screen position="0,0" size="%d,%d" title="Browser Position Setup" backgroundColor="#27d8dee2" >
			<ePixmap pixmap="buttons/red.png" position="%d,%d" size="140,40" alphatest="on" />
			<ePixmap pixmap="buttons/green.png" position="%d,%d" size="140,40" alphatest="on" />"

			<widget source="key_red" render="Label" position="%d,%d" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
			<widget source="key_green" render="Label" position="%d,%d" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />

			<widget name="config" zPosition="2" position="%d,%d" size="500,200" scrollbarMode="showOnDemand" foregroundColor="#1c1c1c" transparent="1" />
		</screen>
		"""

	def __init__(self, session):
		w, h = session.desktop.size().width(), session.desktop.size().height()
		cw, ch = w / 2, h / 2
		#                             btn_red        btn_green     lb_red         lb_green      config
		self.skin = self.skin % (w, h, cw - 190, ch - 110, cw + 50, ch - 110, cw - 190, ch - 110, cw + 50, ch - 110, cw - 250, ch - 50)

		Screen.__init__(self, session)
		self.session = session
		self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions"],
		{
			"ok": self.keyOk,
			"cancel": self.keyCancel,
			"red": self.keyCancel,
			"green": self.keyOk,
		}, -2)
		self.list = []
		ConfigListScreen.__init__(self, self.list, session=self.session)

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Save"))
		self["current"] = StaticText(_(" "))
		vbcfg.g_position = vbcfg.getPosition()
		self.createSetup()

	def createSetup(self):
		self.list = []

		params = BrowserPositionSetting().getPosition()
		vbcfg.setPosition(params)

		left = params[0]
		width = params[1]
		top = params[2]
		height = params[3]

		self.dst_left = ConfigSlider(default=left, increment=5, limits=(0, 720))
		self.dst_width = ConfigSlider(default=width, increment=5, limits=(0, 720))
		self.dst_top = ConfigSlider(default=top, increment=5, limits=(0, 576))
		self.dst_height = ConfigSlider(default=height, increment=5, limits=(0, 576))

		self.dst_left_entry = getConfigListEntry(_("left"), self.dst_left)
		self.dst_width_entry = getConfigListEntry(_("width"), self.dst_width)
		self.dst_top_entry = getConfigListEntry(_("top"), self.dst_top)
		self.dst_height_entry = getConfigListEntry(_("height"), self.dst_height)

		self.list.append(self.dst_left_entry)
		self.list.append(self.dst_width_entry)
		self.list.append(self.dst_top_entry)
		self.list.append(self.dst_height_entry)

		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def resetDisplay(self):
		for entry in self["config"].getList():
			self["config"].l.invalidateEntry(self["config"].getList().index(entry))

	def adjustBorder(self):
		if self["config"].getCurrent() == self.dst_left_entry:
			if self.dst_left.value + self.dst_width.value > 720:
				self.dst_width.setValue(720 - self.dst_left.value)
				self.resetDisplay()
		elif self["config"].getCurrent() == self.dst_width_entry:
			if self.dst_left.value + self.dst_width.value > 720:
				self.dst_left.setValue(720 - self.dst_width.value)
				self.resetDisplay()
		elif self["config"].getCurrent() == self.dst_top_entry:
			if self.dst_top.value + self.dst_height.value > 576:
				self.dst_height.setValue(576 - self.dst_top.value)
				self.resetDisplay()
		elif self["config"].getCurrent() == self.dst_height_entry:
			if self.dst_top.value + self.dst_height.value > 576:
				self.dst_top.setValue(576 - self.dst_height.value)
				self.resetDisplay()

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.adjustBorder()
		params = (int(self.dst_left.value), int(self.dst_width.value), int(self.dst_top.value), int(self.dst_height.value))
		vbcfg.setPosition(params)

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.adjustBorder()
		params = (int(self.dst_left.value), int(self.dst_width.value), int(self.dst_top.value), int(self.dst_height.value))
		vbcfg.setPosition(params)

	def keyOk(self):
		params = (int(self.dst_left.value), int(self.dst_width.value), int(self.dst_top.value), int(self.dst_height.value))
		BrowserPositionSetting().setPosition(params)
		vbcfg.setPosition(vbcfg.g_position)
		self.close()

	def keyCancel(self):
		if self["config"].isChanged():
			self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
		else:
			vbcfg.setPosition(vbcfg.g_position)
			self.close()

	def cancelConfirm(self, ret):
		if ret:
			vbcfg.setPosition(vbcfg.g_position)
			self.close()
Exemple #28
0
def InitOsd():
    SystemInfo["CanChange3DOsd"] = (access('/proc/stb/fb/3dmode', R_OK)
                                    or access('/proc/stb/fb/primary/3d',
                                              R_OK)) and True or False

    def languageNotifier(configElement):
        language.activateLanguage(configElement.value)

    config.osd = ConfigSubsection()
    config.osd.language = ConfigText(default="en_GB")
    config.osd.language.addNotifier(languageNotifier)
    config.osd.dst_left = ConfigSelectionNumber(default=0,
                                                stepwidth=1,
                                                min=0,
                                                max=720,
                                                wraparound=False)
    config.osd.dst_width = ConfigSelectionNumber(default=720,
                                                 stepwidth=1,
                                                 min=0,
                                                 max=720,
                                                 wraparound=False)
    config.osd.dst_top = ConfigSelectionNumber(default=0,
                                               stepwidth=1,
                                               min=0,
                                               max=576,
                                               wraparound=False)
    config.osd.dst_height = ConfigSelectionNumber(default=576,
                                                  stepwidth=1,
                                                  min=0,
                                                  max=576,
                                                  wraparound=False)
    config.osd.alpha = ConfigSelectionNumber(default=255,
                                             stepwidth=1,
                                             min=0,
                                             max=255,
                                             wraparound=False)
    config.av.osd_alpha = NoSave(ConfigNumber(default=255))
    config.osd.threeDmode = ConfigSelection(
        [("off", _("Off")), ("auto", _("Auto")),
         ("sidebyside", _("Side by Side")),
         ("topandbottom", _("Top and Bottom"))], "auto")
    config.osd.threeDznorm = ConfigSlider(default=50,
                                          increment=1,
                                          limits=(0, 100))
    config.osd.show3dextensions = ConfigYesNo(default=False)

    def set3DMode(configElement):
        if SystemInfo["CanChange3DOsd"] and getBoxType() not in ('spycat'):
            print '[UserInterfacePositioner] Setting 3D mode:', configElement.value
            file3d = fileCheck('/proc/stb/fb/3dmode') or fileCheck(
                '/proc/stb/fb/primary/3d')
            f = open(file3d, "w")
            f.write(configElement.value)
            f.close()

    config.osd.threeDmode.addNotifier(set3DMode)

    def set3DZnorm(configElement):
        if SystemInfo["CanChange3DOsd"] and getBoxType() not in ('spycat'):
            print '[UserInterfacePositioner] Setting 3D depth:', configElement.value
            f = open("/proc/stb/fb/znorm", "w")
            f.write('%d' % int(configElement.value))
            f.close()

    config.osd.threeDznorm.addNotifier(set3DZnorm)
Exemple #29
0
 def setScreen(self):
     self.list = []
     if self.step == 1:
         self["introduction"].setText(
             _("The overscan wizard helps you to setup your TV in the correct way.\n\n"
               "For the majority of TV's, the factory default is to have overscan enabled. "
               "This means you are always watching a \"zoomed in\" picture instead of real HD, and parts of the user inferface (skin) may be invisible.\n\n"
               "The yellow area means a 5% border area of a full HD picture will be invisible.\n"
               "The green area means a 10% border area of a full HD picture will be invisible.\n\n"
               "In other words, if the yellow box touches all four sides of your screen, you have at least 5% overscan on all sides.\n\n"
               "If you see the tips of all eight arrowheads, then your TV has overscan disabled.\n\n"
               "Test Pattern by TigerDave - www.tigerdave.com/ht_menu.htm"))
         self.yes_no = ConfigYesNo(default=True, graphic=False)
         self.list.append(
             getConfigListEntry(_("Did you see all eight arrow heads?"),
                                self.yes_no))
         self.save_new_position = False
         setPosition(0, 0, 0, 0)
     elif self.step == 2:
         self.Timer.stop()
         self["title"].setText(_("Overscan wizard"))
         self["introduction"].setText(
             _("It seems you did not see all the eight arrow heads. This means your TV "
               "has overscan enabled, and is not configured properly.\n\n"
               "Please refer to your TV's manual to find how you can disable overscan on your TV. Look for terms like 'Just fit', 'Full width', etc. "
               "If you can't find it, ask other users at http://forums.openpli.org.\n\n"
               ))
         self.list.append(
             getConfigListEntry(_("Did you see all eight arrow heads?"),
                                self.yes_no))
         self.yes_no.value = True
         self.save_new_position = False
         setPosition(0, 0, 0, 0)
     elif self.step == 3:
         self["introduction"].setText(
             _("You did not see all eight arrow heads. This means your TV has overscan enabled "
               "and presents you with a zoomed-in picture, causing you to loose part of a full HD screen. In addition to this "
               "you may also miss parts of the user interface, for example volume bars and more.\n\n"
               "You can now try to resize and change the position of the user interface until you see the eight arrow heads.\n\n"
               "When done press OK.\n\n"))
         self.dst_left = ConfigSlider(
             default=config.plugins.OSDPositionSetup.dst_left.value,
             increment=1,
             limits=(0, 150))
         self.dst_right = ConfigSlider(
             default=config.plugins.OSDPositionSetup.dst_right.value + 150,
             increment=1,
             limits=(0, 150))
         self.dst_top = ConfigSlider(
             default=config.plugins.OSDPositionSetup.dst_top.value,
             increment=1,
             limits=(0, 150))
         self.dst_bottom = ConfigSlider(
             default=config.plugins.OSDPositionSetup.dst_bottom.value + 150,
             increment=1,
             limits=(0, 150))
         self.list.append(getConfigListEntry(_("left"), self.dst_left))
         self.list.append(getConfigListEntry(_("right"), self.dst_right))
         self.list.append(getConfigListEntry(_("top"), self.dst_top))
         self.list.append(getConfigListEntry(_("bottom"), self.dst_bottom))
         setConfiguredPosition()
     elif self.step == 4:
         self["introduction"].setText(
             _("You did not see all eight arrow heads. This means your TV has overscan enabled "
               "and presents you with a zoomed-in picture, causing you to loose part of a full HD screen. In addition this "
               "you may also miss parts of the user interface, for example volume bars and more.\n\n"
               "Unfortunately, your model of receiver is not capable to adjust the dimensions of the user interface. "
               "If not everything is visible, you should change the installed skin to one that supports the overscan area of your TV.\n\n"
               "When you select a different skin, the user interface of your receiver will restart.\n\n"
               "Note: you can always start the Overscan wizard later,  via\n\nmenu->installation->system->Overscan wizard"
               ))
         self.yes_no.value = False
         self.list.append(
             getConfigListEntry(
                 _("Do you want to select a different skin?"), self.yes_no))
     elif self.step == 5:
         self.Timer.stop()
         self["title"].setText(_("Overscan wizard"))
         self["introduction"].setText(
             _("The overscan wizard has been completed.\n\n"
               "Note: you can always start the Overscan wizard later,  via\n\nMenu->Installation->System->Audio/Video->Overscan wizard"
               ))
         self.yes_no.value = True
         self.list.append(
             getConfigListEntry(
                 _("Do you want to quit the overscan wizard?"),
                 self.yes_no))
     elif self.step == 6:
         config.skin.primary_skin.value = "PLi-HD/skin.xml"
         config.save()
         self["introduction"].setText(
             _("The user interface of the receiver will now restart to select the selected skin"
               ))
         quitMainloop(3)
     self["config"].list = self.list
     self["config"].l.setList(self.list)
     if self["config"].instance:
         self.__layoutFinished()
    def createConfig(self, *args):
        config.pep = ConfigSubsection()
        config.pep.configsteps = NoSave(
            ConfigSelection(choices=[1, 5, 10, 25], default=1))

        if os_path.exists(
                eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_contrast")):

            def setContrast(config):
                myval = int(config.value * 256)
                try:
                    print "--> setting contrast to: %0.8X" % myval
                    open(
                        eEnv.resolve("${sysconfdir}/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(
                eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_saturation")):

            def setSaturation(config):
                myval = int(config.value * 256)
                try:
                    print "--> setting saturation to: %0.8X" % myval
                    open(
                        eEnv.resolve(
                            "${sysconfdir}/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(eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_hue")):

            def setHue(config):
                myval = int(config.value * 256)
                try:
                    print "--> setting hue to: %0.8X" % myval
                    open(eEnv.resolve("${sysconfdir}/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(
                eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_brightness")):

            def setBrightness(config):
                myval = int(config.value * 256)
                try:
                    print "--> setting brightness to: %0.8X" % myval
                    open(
                        eEnv.resolve(
                            "${sysconfdir}/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(
                eEnv.resolve(
                    "${sysconfdir}/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(
                        eEnv.resolve(
                            "${sysconfdir}/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(
                eEnv.resolve(
                    "${sysconfdir}/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(
                        eEnv.resolve(
                            "${sysconfdir}/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(
                eEnv.resolve(
                    "${sysconfdir}/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(
                        eEnv.resolve(
                            "${sysconfdir}/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(eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_split")):

            def setSplitMode(config):
                try:
                    print "--> setting splitmode to:", str(config.value)
                    open(eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_split"),
                         "w").write(str(config.value))
                except IOError:
                    print "couldn't write pep_split."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.split = ConfigSelection(choices={
                "off": _("Off"),
                "left": _("Left"),
                "right": _("Right")
            },
                                               default="off")
            config.pep.split.addNotifier(setSplitMode)
        else:
            config.pep.split = NoSave(ConfigNothing())

        if os_path.exists(
                eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_sharpness")):

            def setSharpness(config):
                myval = int(config.value * 256)
                try:
                    print "--> setting sharpness to: %0.8X" % myval
                    open(
                        eEnv.resolve(
                            "${sysconfdir}/stb/vmpeg/0/pep_sharpness"),
                        "w").write("%0.8X" % myval)
                except IOError:
                    print "couldn't write pep_sharpness."

                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(
                eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_auto_flesh")):

            def setAutoflesh(config):
                myval = int(config.value)
                try:
                    print "--> setting auto_flesh to: %0.8X" % myval
                    open(
                        eEnv.resolve(
                            "${sysconfdir}/stb/vmpeg/0/pep_auto_flesh"),
                        "w").write("%0.8X" % myval)
                except IOError:
                    print "couldn't write pep_auto_flesh."

                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(
                eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_green_boost")):

            def setGreenboost(config):
                myval = int(config.value)
                try:
                    print "--> setting green_boost to: %0.8X" % myval
                    open(
                        eEnv.resolve(
                            "${sysconfdir}/stb/vmpeg/0/pep_green_boost"),
                        "w").write("%0.8X" % myval)
                except IOError:
                    print "couldn't write pep_green_boost."

                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(
                eEnv.resolve("${sysconfdir}/stb/vmpeg/0/pep_blue_boost")):

            def setBlueboost(config):
                myval = int(config.value)
                try:
                    print "--> setting blue_boost to: %0.8X" % myval
                    open(
                        eEnv.resolve(
                            "${sysconfdir}/stb/vmpeg/0/pep_blue_boost"),
                        "w").write("%0.8X" % myval)
                except IOError:
                    print "couldn't write pep_blue_boost."

                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(
                eEnv.resolve(
                    "${sysconfdir}/stb/vmpeg/0/pep_dynamic_contrast")):

            def setDynamic_contrast(config):
                myval = int(config.value)
                try:
                    print "--> setting dynamic_contrast to: %0.8X" % myval
                    open(
                        eEnv.resolve(
                            "${sysconfdir}/stb/vmpeg/0/pep_dynamic_contrast"),
                        "w").write("%0.8X" % myval)
                except IOError:
                    print "couldn't write pep_dynamic_contrast."

                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())

        try:
            x = config.av.scaler_sharpness.value
        except KeyError:
            if os_path.exists(
                    eEnv.resolve(
                        "${sysconfdir}/stb/vmpeg/0/pep_scaler_sharpness")):

                def setScaler_sharpness(config):
                    myval = int(config.value)
                    try:
                        print "--> setting scaler_sharpness to: %0.8X" % myval
                        open(
                            eEnv.resolve(
                                "${sysconfdir}/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.av.scaler_sharpness = ConfigSlider(default=13,
                                                          limits=(0, 26))
                config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
            else:
                config.av.scaler_sharpness = NoSave(ConfigNothing())

        if VideoEnhancement.firstRun:
            self.setConfiguredValues()

        VideoEnhancement.firstRun = False
Exemple #31
0
def InitLcd():
    if model in ("force4", "viperslim", "lunix4k", "vipert2c", "evoslimse",
                 "evoslimt2c", "evoslim", "ultrabox", "i55", "dm520", "hd11",
                 "sf98", "et7000mini", "xpeedc", "beyonwizt2", "gb800se",
                 "gb800solo", "gb800seplus", "gbultrase", "gbipbox",
                 "tmsingle", "tmnano2super", "iqonios300hd", "iqonios300hdv2",
                 "optimussos1plus", "optimussos1", "vusolo", "et4x00",
                 "et5x00", "et6x00", "gbx1", "gbx2", "gbx3", "gbx34k", "gbx3h",
                 "novaip"):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()
    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if fileExists("/proc/stb/lcd/mode"):
        print("[Lcd] Read /proc/stb/lcd/mode")
        can_lcdmodechecking = open("/proc/stb/lcd/mode", "r").read()
    else:
        can_lcdmodechecking = False
    SystemInfo["LCDMiniTV"] = can_lcdmodechecking

    if detected:
        ilcd = LCD()
        if can_lcdmodechecking:

            def setLCDModeMinitTV(configElement):
                try:
                    print('[Lcd] setLCDModeMinitTV', configElement.value)
                    print("[Lcd] Write to /proc/stb/lcd/mode")
                    open("/proc/stb/lcd/mode", "w").write(configElement.value)
                except:
                    print("[Lcd] Write to /proc/stb/lcd/mode failed.")

            def setMiniTVFPS(configElement):
                try:
                    print('[Lcd] setMiniTVFPS', configElement.value)
                    print("[Lcd] Write to /proc/stb/lcd/fps")
                    open("/proc/stb/lcd/fps", "w").write(configElement.value)
                except:
                    print("[Lcd] Write to /proc/stb/lcd/fps failed.")

            def setLCDModePiP(configElement):
                pass

            def setLCDScreenshot(configElement):
                ilcd.setScreenShot(configElement.value)

            config.lcd.modepip = ConfigSelection(choices={
                "0": _("off"),
                "5": _("PIP"),
                "7": _("PIP with OSD")
            },
                                                 default="0")
            config.lcd.modepip.addNotifier(setLCDModePiP)
            config.lcd.screenshot = ConfigYesNo(default=False)
            config.lcd.screenshot.addNotifier(setLCDScreenshot)

            config.lcd.modeminitv = ConfigSelection(choices={
                "0": _("normal"),
                "1": _("MiniTV"),
                "2": _("OSD"),
                "3": _("MiniTV with OSD")
            },
                                                    default="0")
            config.lcd.fpsminitv = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.modeminitv.addNotifier(setLCDModeMinitTV)
            config.lcd.fpsminitv.addNotifier(setMiniTVFPS)
        else:
            config.lcd.modeminitv = ConfigNothing()
            config.lcd.screenshot = ConfigNothing()
            config.lcd.fpsminitv = ConfigNothing()

        config.lcd.scroll_speed = ConfigSelection(default="300",
                                                  choices=[("500", _("slow")),
                                                           ("300",
                                                            _("normal")),
                                                           ("100", _("fast"))])
        config.lcd.scroll_delay = ConfigSelection(
            default="10000",
            choices=[("10000", "10 " + _("seconds")),
                     ("20000", "20 " + _("seconds")),
                     ("30000", "30 " + _("seconds")),
                     ("60000", "1 " + _("minute")),
                     ("300000", "5 " + _("minutes")),
                     ("noscrolling", _("off"))])

        def setLCDbright(configElement):
            ilcd.setBright(configElement.value)

        def setLCDstandbybright(configElement):
            ilcd.setStandbyBright(configElement.value)

        def setLCDdimbright(configElement):
            ilcd.setDimBright(configElement.value)

        def setLCDdimdelay(configElement):
            ilcd.setDimDelay(configElement.value)

        def setLCDcontrast(configElement):
            ilcd.setContrast(configElement.value)

        def setLCDinverted(configElement):
            ilcd.setInverted(configElement.value)

        def setLCDflipped(configElement):
            ilcd.setFlipped(configElement.value)

        def setLCDmode(configElement):
            ilcd.setMode(configElement.value)

        def setLCDpower(configElement):
            ilcd.setPower(configElement.value)

        def setfblcddisplay(configElement):
            ilcd.setfblcddisplay(configElement.value)

        def setLCDshowoutputresolution(configElement):
            ilcd.setShowoutputresolution(configElement.value)

        def setLCDminitvmode(configElement):
            ilcd.setLCDMiniTVMode(configElement.value)

        def setLCDminitvpipmode(configElement):
            ilcd.setLCDMiniTVPIPMode(configElement.value)

        def setLCDminitvfps(configElement):
            ilcd.setLCDMiniTVFPS(configElement.value)

        def setLEDnormalstate(configElement):
            ilcd.setLEDNormalState(configElement.value)

        def setLEDdeepstandby(configElement):
            ilcd.setLEDDeepStandbyState(configElement.value)

        def setLEDblinkingtime(configElement):
            ilcd.setLEDBlinkingTime(configElement.value)

        def setPowerLEDstate(configElement):
            if fileExists("/proc/stb/power/powerled"):
                print("[Lcd] Write to /proc/stb/power/powerled")
                open("/proc/stb/power/powerled",
                     "w").write(configElement.value)

        def setPowerLEDstate2(configElement):
            if fileExists("/proc/stb/power/powerled2"):
                print("[Lcd] Write to /proc/stb/power/powerled2")
                open("/proc/stb/power/powerled2",
                     "w").write(configElement.value)

        def setPowerLEDstanbystate(configElement):
            if fileExists("/proc/stb/power/standbyled"):
                print("[Lcd] Write to /proc/stb/power/standbyled")
                open("/proc/stb/power/standbyled",
                     "w").write(configElement.value)

        def setPowerLEDdeepstanbystate(configElement):
            if fileExists("/proc/stb/power/suspendled"):
                print("[Lcd] Write to /proc/stb/power/suspendled")
                open("/proc/stb/power/suspendled",
                     "w").write(configElement.value)

        def setLedPowerColor(configElement):
            if fileExists("/proc/stb/fp/ledpowercolor"):
                print("[Lcd] Write to /proc/stb/fp/ledpowercolor")
                open("/proc/stb/fp/ledpowercolor",
                     "w").write(configElement.value)

        def setLedStandbyColor(configElement):
            if fileExists("/proc/stb/fp/ledstandbycolor"):
                print("[Lcd] Write to /proc/stb/fp/ledstandbycolor")
                open("/proc/stb/fp/ledstandbycolor",
                     "w").write(configElement.value)

        def setLedSuspendColor(configElement):
            if fileExists("/proc/stb/fp/ledsuspendledcolor"):
                print("[Lcd] Write to /proc/stb/fp/ledsuspendledcolor")
                open("/proc/stb/fp/ledsuspendledcolor",
                     "w").write(configElement.value)

        def setLedBlinkControlColor(configElement):
            if fileExists("/proc/stb/fp/led_blink"):
                print("[Lcd] Write to /proc/stb/fp/led_blink")
                open("/proc/stb/fp/led_blink", "w").write(configElement.value)

        def setLedBrightnessControl(configElement):
            if fileExists("/proc/stb/fp/led_brightness"):
                print("[Lcd] Write to /proc/stb/fp/led_brightness")
                open("/proc/stb/fp/led_brightness",
                     "w").write(configElement.value)

        def setLedColorControlColor(configElement):
            if fileExists("/proc/stb/fp/led_color"):
                print("[Lcd] Write to /proc/stb/fp/led_color")
                open("/proc/stb/fp/led_color", "w").write(configElement.value)

        def setLedFadeControlColor(configElement):
            if fileExists("/proc/stb/fp/led_fade"):
                print("[Lcd] Write to /proc/stb/fp/led_fade")
                open("/proc/stb/fp/led_fade", "w").write(configElement.value)

        def setPower4x7On(configElement):
            if fileExists("/proc/stb/fp/power4x7on"):
                print("[Lcd] Write to /proc/stb/fp/power4x7on")
                open("/proc/stb/fp/power4x7on", "w").write(configElement.value)

        def setPower4x7Standby(configElement):
            if fileExists("/proc/stb/fp/power4x7standby"):
                print("[Lcd] Write to /proc/stb/fp/power4x7standby")
                open("/proc/stb/fp/power4x7standby",
                     "w").write(configElement.value)

        def setPower4x7Suspend(configElement):
            if fileExists("/proc/stb/fp/power4x7suspend"):
                print("[Lcd] Write to /proc/stb/fp/power4x7suspend")
                open("/proc/stb/fp/power4x7suspend",
                     "w").write(configElement.value)

        def setXcoreVFD(configElement):
            if fileExists(
                    "/sys/module/brcmstb_osmega/parameters/pt6302_cgram"):
                print(
                    "[Lcd] Write to /sys/module/brcmstb_osmega/parameters/pt6302_cgram"
                )
                open("/sys/module/brcmstb_osmega/parameters/pt6302_cgram",
                     "w").write(configElement.value)
            if fileExists(
                    "/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram"):
                print(
                    "[Lcd] Write to /sys/module/brcmstb_spycat4k/parameters/pt6302_cgram"
                )
                open("/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram",
                     "w").write(configElement.value)
            if fileExists(
                    "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram"
            ):
                print(
                    "[Lcd] Write to /sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram"
                )
                open(
                    "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram",
                    "w").write(configElement.value)
            if fileExists(
                    "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram"
            ):
                print(
                    "[Lcd] Write to /sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram"
                )
                open(
                    "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram",
                    "w").write(configElement.value)

        config.usage.vfd_xcorevfd = ConfigSelection(default="0",
                                                    choices=[
                                                        ("0",
                                                         _("12 character")),
                                                        ("1", _("8 character"))
                                                    ])
        config.usage.vfd_xcorevfd.addNotifier(setXcoreVFD)

        config.usage.lcd_powerled = ConfigSelection(default="on",
                                                    choices=[("off", _("Off")),
                                                             ("on", _("On"))])
        config.usage.lcd_powerled.addNotifier(setPowerLEDstate)

        config.usage.lcd_powerled2 = ConfigSelection(default="on",
                                                     choices=[("off",
                                                               _("Off")),
                                                              ("on", _("On"))])
        config.usage.lcd_powerled2.addNotifier(setPowerLEDstate2)

        config.usage.lcd_standbypowerled = ConfigSelection(default="on",
                                                           choices=[("off",
                                                                     _("Off")),
                                                                    ("on",
                                                                     _("On"))])
        config.usage.lcd_standbypowerled.addNotifier(setPowerLEDstanbystate)

        config.usage.lcd_deepstandbypowerled = ConfigSelection(
            default="on", choices=[("off", _("Off")), ("on", _("On"))])
        config.usage.lcd_deepstandbypowerled.addNotifier(
            setPowerLEDdeepstanbystate)

        config.lcd.ledpowercolor = ConfigSelection(default="1",
                                                   choices=[("0", _("off")),
                                                            ("1", _("blue")),
                                                            ("2", _("red")),
                                                            ("3", _("violet"))
                                                            ])
        config.lcd.ledpowercolor.addNotifier(setLedPowerColor)

        config.lcd.ledstandbycolor = ConfigSelection(default="3",
                                                     choices=[("0", _("off")),
                                                              ("1", _("blue")),
                                                              ("2", _("red")),
                                                              ("3",
                                                               _("violet"))])
        config.lcd.ledstandbycolor.addNotifier(setLedStandbyColor)

        config.lcd.ledsuspendcolor = ConfigSelection(default="2",
                                                     choices=[("0", _("off")),
                                                              ("1", _("blue")),
                                                              ("2", _("red")),
                                                              ("3",
                                                               _("violet"))])
        config.lcd.ledsuspendcolor.addNotifier(setLedSuspendColor)

        config.lcd.ledblinkcontrolcolor = ConfigSelection(colors,
                                                          default="0xffffff")
        config.lcd.ledblinkcontrolcolor.addNotifier(setLedBlinkControlColor)

        config.lcd.ledbrightnesscontrol = ConfigSlider(default="0xff",
                                                       increment=25,
                                                       limits=(0, 0xff))
        config.lcd.ledbrightnesscontrol.addNotifier(setLedBrightnessControl)

        config.lcd.ledcolorcontrolcolor = ConfigSelection(colors,
                                                          default="0xffffff")
        config.lcd.ledcolorcontrolcolor.addNotifier(setLedColorControlColor)

        config.lcd.ledfadecontrolcolor = ConfigSelection(colors,
                                                         default="0xffffff")
        config.lcd.ledfadecontrolcolor.addNotifier(setLedFadeControlColor)

        config.lcd.power4x7on = ConfigSelection(default="on",
                                                choices=[("off", _("Off")),
                                                         ("on", _("On"))])
        config.lcd.power4x7on.addNotifier(setPower4x7On)

        config.lcd.power4x7standby = ConfigSelection(default="on",
                                                     choices=[("off",
                                                               _("Off")),
                                                              ("on", _("On"))])
        config.lcd.power4x7standby.addNotifier(setPower4x7Standby)

        config.lcd.power4x7suspend = ConfigSelection(default="on",
                                                     choices=[("off",
                                                               _("Off")),
                                                              ("on", _("On"))])
        config.lcd.power4x7suspend.addNotifier(setPower4x7Suspend)

        if platform in ("dm4kgen", "8100s"):
            standby_default = 4
        elif model in ("spycat4kmini", "osmega"):
            standby_default = 10
        else:
            standby_default = 1

        if not ilcd.isOled():
            config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
            config.lcd.contrast.addNotifier(setLCDcontrast)
        else:
            config.lcd.contrast = ConfigNothing()

        if model in ("h3", "ebox5000", "ebox5100", "sh1", "spycat",
                     "novacombo", "novatwin"):
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 4))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 4))
            config.lcd.bright = ConfigSlider(default=4, limits=(0, 4))
        elif model in ("spycat4kmini", "osmega"):
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 10))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 10))
            config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
        else:
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 10))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 10))
            config.lcd.bright = ConfigSlider(
                default=SystemInfo["DefaultDisplayBrightness"], limits=(0, 10))
        config.lcd.dimbright.addNotifier(setLCDdimbright)
        config.lcd.dimbright.apply = lambda: setLCDdimbright(config.lcd.
                                                             dimbright)
        config.lcd.dimdelay = ConfigSelection(default="0",
                                              choices=[
                                                  ("5", "5 " + _("seconds")),
                                                  ("10", "10 " + _("seconds")),
                                                  ("15", "15 " + _("seconds")),
                                                  ("20", "20 " + _("seconds")),
                                                  ("30", "30 " + _("seconds")),
                                                  ("60", "1 " + _("minute")),
                                                  ("120", "2 " + _("minutes")),
                                                  ("300", "5 " + _("minutes")),
                                                  ("0", _("off"))
                                              ])
        config.lcd.dimdelay.addNotifier(setLCDdimdelay)
        config.lcd.standby.addNotifier(setLCDstandbybright)
        config.lcd.standby.apply = lambda: setLCDstandbybright(config.lcd.
                                                               standby)
        config.lcd.bright.addNotifier(setLCDbright)
        config.lcd.bright.apply = lambda: setLCDbright(config.lcd.bright)
        config.lcd.bright.callNotifiersOnSaveAndCancel = True

        config.lcd.invert = ConfigYesNo(default=False)
        config.lcd.invert.addNotifier(setLCDinverted)

        def PiconPackChanged(configElement):
            configElement.save()

        config.lcd.picon_pack = ConfigYesNo(default=False)
        config.lcd.picon_pack.addNotifier(PiconPackChanged)

        config.lcd.flip = ConfigYesNo(default=False)
        config.lcd.flip.addNotifier(setLCDflipped)

        if SystemInfo["LcdLiveTV"]:

            def lcdLiveTvChanged(configElement):
                if "live_enable" in SystemInfo["LcdLiveTV"]:
                    print("[Lcd] Write to /proc/stb/lcd/live_enable")
                    open(SystemInfo["LcdLiveTV"],
                         "w").write(configElement.value and "enable"
                                    or "disable")
                else:
                    print("[Lcd] Write to /proc/stb/fb/sd_detach")
                    open(SystemInfo["LcdLiveTV"],
                         "w").write(configElement.value and "0" or "1")
                try:
                    InfoBarInstance = InfoBar.instance
                    InfoBarInstance and InfoBarInstance.session.open(
                        dummyScreen)
                except:
                    pass

            config.lcd.showTv = ConfigYesNo(default=False)
            config.lcd.showTv.addNotifier(lcdLiveTvChanged)

        if SystemInfo["LCDMiniTV"] and platform not in ("gb7356", "gb7252",
                                                        "gb72604"):
            config.lcd.minitvmode = ConfigSelection(
                [("0", _("normal")), ("1", _("MiniTV")), ("2", _("OSD")),
                 ("3", _("MiniTV with OSD"))], "0")
            config.lcd.minitvmode.addNotifier(setLCDminitvmode)
            config.lcd.minitvpipmode = ConfigSelection(
                [("0", _("off")), ("5", _("PIP")),
                 ("7", _("PIP with OSD"))], "0")
            config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
            config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.minitvfps.addNotifier(setLCDminitvfps)

        if SystemInfo["VFD_scroll_repeats"] and SystemInfo["VFDRepeats"]:

            def scroll_repeats(el):
                print("[Lcd] Write to /proc/stb/lcd/scroll_repeats")
                open(SystemInfo["VFD_scroll_repeats"], "w").write(el.value)

            choicelist = [("0", _("None")), ("1", _("1X")), ("2", _("2X")),
                          ("3", _("3X")), ("4", _("4X")),
                          ("500", _("Continues"))]
            config.usage.vfd_scroll_repeats = ConfigSelection(
                default="3", choices=choicelist)
            config.usage.vfd_scroll_repeats.addNotifier(
                scroll_repeats, immediate_feedback=False)
        else:
            config.usage.vfd_scroll_repeats = ConfigNothing()

        if SystemInfo["VFD_scroll_delay"] and SystemInfo["VFDRepeats"]:

            def scroll_delay(el):
                print("[Lcd] Write to /proc/stb/lcd/scroll_delay")
                # add workaround for Boxes who need hex code
                if SystemInfo["VFDDelay"]:
                    open(SystemInfo["VFD_scroll_delay"],
                         "w").write(hex(int(el.value)))
                else:
                    open(SystemInfo["VFD_scroll_delay"],
                         "w").write(str(el.value))

            config.usage.vfd_scroll_delay = ConfigSlider(default=150,
                                                         increment=10,
                                                         limits=(0, 500))
            config.usage.vfd_scroll_delay.addNotifier(scroll_delay,
                                                      immediate_feedback=False)
            config.lcd.hdd = ConfigSelection([("0", _("No")), ("1", _("Yes"))],
                                             "1")
        else:
            config.lcd.hdd = ConfigNothing()
            config.usage.vfd_scroll_delay = ConfigNothing()

        if SystemInfo["VFD_initial_scroll_delay"] and SystemInfo["VFDRepeats"]:

            def initial_scroll_delay(el):
                print("[Lcd] Write to /proc/stb/lcd/initial_scroll_delay")
                if SystemInfo["VFDDelay"]:
                    # add workaround for Boxes who need hex code
                    open(SystemInfo["VFD_initial_scroll_delay"],
                         "w").write(hex(int(el.value)))
                else:
                    open(SystemInfo["VFD_initial_scroll_delay"],
                         "w").write(el.value)

            choicelist = [("3000", "3 " + _("seconds")),
                          ("5000", "5 " + _("seconds")),
                          ("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_initial_scroll_delay = ConfigSelection(
                default="10000", choices=choicelist)
            config.usage.vfd_initial_scroll_delay.addNotifier(
                initial_scroll_delay, immediate_feedback=False)
        else:
            config.usage.vfd_initial_scroll_delay = ConfigNothing()

        if SystemInfo["VFD_final_scroll_delay"] and SystemInfo["VFDRepeats"]:

            def final_scroll_delay(el):
                print("[Lcd] Write to /proc/stb/lcd/final_scroll_delay")
                if SystemInfo["VFDDelay"]:
                    # add workaround for Boxes who need hex code
                    open(SystemInfo["VFD_final_scroll_delay"],
                         "w").write(hex(int(el.value)))
                else:
                    open(SystemInfo["VFD_final_scroll_delay"],
                         "w").write(el.value)

            choicelist = [("3000", "3 " + _("seconds")),
                          ("5000", "5 " + _("seconds")),
                          ("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_final_scroll_delay = ConfigSelection(
                default="10000", choices=choicelist)
            config.usage.vfd_final_scroll_delay.addNotifier(
                final_scroll_delay, immediate_feedback=False)
        else:
            config.usage.vfd_final_scroll_delay = ConfigNothing()

        if fileExists("/proc/stb/lcd/show_symbols"):
            config.lcd.mode = ConfigSelection([("0", _("No")),
                                               ("1", _("Yes"))], "1")
            config.lcd.mode.addNotifier(setLCDmode)
        else:
            config.lcd.mode = ConfigNothing()

        if fileExists("/proc/stb/power/vfd") or fileExists(
                "/proc/stb/lcd/vfd"):
            config.lcd.power = ConfigSelection([("0", _("No")),
                                                ("1", _("Yes"))], "1")
            config.lcd.power.addNotifier(setLCDpower)
        else:
            config.lcd.power = ConfigNothing()

        if fileExists("/proc/stb/fb/sd_detach"):
            config.lcd.fblcddisplay = ConfigSelection([("1", _("No")),
                                                       ("0", _("Yes"))], "1")
            config.lcd.fblcddisplay.addNotifier(setfblcddisplay)
        else:
            config.lcd.fblcddisplay = ConfigNothing()

        if fileExists("/proc/stb/lcd/show_outputresolution"):
            config.lcd.showoutputresolution = ConfigSelection(
                [("0", _("No")), ("1", _("Yes"))], "1")
            config.lcd.showoutputresolution.addNotifier(
                setLCDshowoutputresolution)
        else:
            config.lcd.showoutputresolution = ConfigNothing()

        if model == "vuultimo":
            config.lcd.ledblinkingtime = ConfigSlider(default=5,
                                                      increment=1,
                                                      limits=(0, 15))
            config.lcd.ledblinkingtime.addNotifier(setLEDblinkingtime)
            config.lcd.ledbrightnessdeepstandby = ConfigSlider(default=1,
                                                               increment=1,
                                                               limits=(0, 15))
            config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDdeepstandby)
            config.lcd.ledbrightnessdeepstandby.apply = lambda: setLEDdeepstandby(
                config.lcd.ledbrightnessdeepstandby)
            config.lcd.ledbrightnessstandby = ConfigSlider(default=1,
                                                           increment=1,
                                                           limits=(0, 15))
            config.lcd.ledbrightnessstandby.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightnessstandby.apply = lambda: setLEDnormalstate(
                config.lcd.ledbrightnessstandby)
            config.lcd.ledbrightness = ConfigSlider(default=3,
                                                    increment=1,
                                                    limits=(0, 15))
            config.lcd.ledbrightness.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightness.apply = lambda: setLEDnormalstate(
                config.lcd.ledbrightness)
            config.lcd.ledbrightness.callNotifiersOnSaveAndCancel = True
        else:

            def doNothing():
                pass

            config.lcd.ledbrightness = ConfigNothing()
            config.lcd.ledbrightness.apply = lambda: doNothing()
            config.lcd.ledbrightnessstandby = ConfigNothing()
            config.lcd.ledbrightnessstandby.apply = lambda: doNothing()
            config.lcd.ledbrightnessdeepstandby = ConfigNothing()
            config.lcd.ledbrightnessdeepstandby.apply = lambda: doNothing()
            config.lcd.ledblinkingtime = ConfigNothing()
    else:

        def doNothing():
            pass

        config.lcd.contrast = ConfigNothing()
        config.lcd.bright = ConfigNothing()
        config.lcd.standby = ConfigNothing()
        config.lcd.bright.apply = lambda: doNothing()
        config.lcd.standby.apply = lambda: doNothing()
        config.lcd.power = ConfigNothing()
        config.lcd.fblcddisplay = ConfigNothing()
        config.lcd.mode = ConfigNothing()
        config.lcd.hdd = ConfigNothing()
        config.lcd.scroll_speed = ConfigSelection(default="300",
                                                  choices=[("500", _("slow")),
                                                           ("300",
                                                            _("normal")),
                                                           ("100", _("fast"))])
        config.lcd.scroll_delay = ConfigSelection(
            default="10000",
            choices=[("10000", "10 " + _("seconds")),
                     ("20000", "20 " + _("seconds")),
                     ("30000", "30 " + _("seconds")),
                     ("60000", "1 " + _("minute")),
                     ("300000", "5 " + _("minutes")),
                     ("noscrolling", _("off"))])
        config.lcd.showoutputresolution = ConfigNothing()
        config.lcd.ledbrightness = ConfigNothing()
        config.lcd.ledbrightness.apply = lambda: doNothing()
        config.lcd.ledbrightnessstandby = ConfigNothing()
        config.lcd.ledbrightnessstandby.apply = lambda: doNothing()
        config.lcd.ledbrightnessdeepstandby = ConfigNothing()
        config.lcd.ledbrightnessdeepstandby.apply = lambda: doNothing()
        config.lcd.ledblinkingtime = ConfigNothing()
        config.lcd.picon_pack = ConfigNothing()

    config.misc.standbyCounter.addNotifier(standbyCounterChanged,
                                           initial_call=False)
def InitAVSwitch():
	if getBoxType() == 'vuduo' or getBoxType().startswith('ixuss'):
		config.av.yuvenabled = ConfigBoolean(default=False)
	else:
		config.av.yuvenabled = ConfigBoolean(default=True)
	config.av.osd_alpha = ConfigSlider(default=255, increment=5, limits=(20, 255)) # Make openNFR compatible with some plugins who still use config.av.osd_alpha
	colorformat_choices = {"cvbs": _("CVBS"), "rgb": _("RGB"), "svideo": _("S-Video")}
	# when YUV is not enabled, don't let the user select it
	if config.av.yuvenabled.value:
		colorformat_choices["yuv"] = _("YPbPr")

	config.av.autores = ConfigSelection(choices={"disabled": _("Disabled"), "simple": _("Simple"), "native": _("Native"), "all": _("All resolutions"), "hd": _("only HD")}, default="disabled")
	config.av.autores_preview = NoSave(ConfigYesNo(default=False))
	config.av.autores_1080i_deinterlace = ConfigYesNo(default=False)
	choicelist = {
			"24,24": _("24p/24p"),
			"24,25": _("24p/25p"),
			"24,30": _("24p/30p"),
			"24,50": _("24p/50p"),
			"24,60": _("24p/60p"),
			"25,24": _("25p/24p"),
			"30,24": _("30p/24p"),
			"50,24": _("50p/24p"),
			"60,24": _("60p/24p"),
			"25,25": _("25p/25p"),
			"25,30": _("25p/30p"),
			"25,50": _("25p/50p"),
			"25,60": _("25p/60p"),
			"30,25": _("30p/25p"),
			"50,25": _("50p/25p"),
			"60,25": _("60p/25p"),
			"30,30": _("30p/30p"),
			"30,50": _("30p/50p"),
			"30,60": _("30p/60p"),
			"50,30": _("50p/30p"),
			"60,30": _("60p/30p"),
			"50,50": _("50p/50p"),
			"50,60": _("50p/60p"),
			"60,50": _("60p/50p"),
			"60,60": _("60p/60p")
				}  # first value <=720p , second value > 720p
	config.av.autores_24p = ConfigSelection(choices=choicelist, default="50,24")
	config.av.autores_25p = ConfigSelection(choices=choicelist, default="50,25")
	config.av.autores_30p = ConfigSelection(choices=choicelist, default="60,30")
	config.av.autores_unknownres = ConfigSelection(choices={"next": _("next higher Resolution"), "highest": _("highest Resolution")}, default="next")
	choicelist = []
	for i in list(range(5, 16)):
		choicelist.append(("%d" % i, ngettext("%d second", "%d seconds", i) % i))
	config.av.autores_label_timeout = ConfigSelection(default="5", choices=[("0", _("Not Shown"))] + choicelist)
	config.av.autores_delay = ConfigSelectionNumber(min=0, max=3000, stepwidth=50, default=400, wraparound=True)
	config.av.autores_deinterlace = ConfigYesNo(default=False)
	config.av.autores_sd = ConfigSelection(choices={"720p50": _("720p50"), "720p": _("720p"), "1080i50": _("1080i50"), "1080i": _("1080i")}, default="720p50")
	config.av.autores_480p24 = ConfigSelection(choices={"480p24": _("480p 24Hz"), "720p24": _("720p 24Hz"), "1080p24": _("1080p 24Hz")}, default="1080p24")
	config.av.autores_720p24 = ConfigSelection(choices={"720p24": _("720p 24Hz"), "1080p24": _("1080p 24Hz"), "1080i50": _("1080i 50Hz"), "1080i": _("1080i 60Hz")}, default="720p24")
	config.av.autores_1080p24 = ConfigSelection(choices={"1080p24": _("1080p 24Hz"), "1080p25": _("1080p 25Hz"), "1080i50": _("1080p 50Hz"), "1080i": _("1080i 60Hz")}, default="1080p24")
	config.av.autores_1080p25 = ConfigSelection(choices={"1080p25": _("1080p 25Hz"), "1080p50": _("1080p 50Hz"), "1080i50": _("1080i 50Hz")}, default="1080p25")
	config.av.autores_1080p30 = ConfigSelection(choices={"1080p30": _("1080p 30Hz"), "1080p60": _("1080p 60Hz"), "1080i": _("1080i 60Hz")}, default="1080p30")
	config.av.autores_2160p24 = ConfigSelection(choices={"2160p24": _("2160p 24Hz"), "2160p25": _("2160p 25Hz"), "2160p30": _("2160p 30Hz")}, default="2160p24")
	config.av.autores_2160p25 = ConfigSelection(choices={"2160p25": _("2160p 25Hz"), "2160p50": _("2160p 50Hz")}, default="2160p25")
	config.av.autores_2160p30 = ConfigSelection(choices={"2160p30": _("2160p 30Hz"), "2160p60": _("2160p 60Hz")}, default="2160p30")
	config.av.smart1080p = ConfigSelection(choices={"false": _("off"), "true": _("1080p50: 24p/50p/60p"), "2160p50": _("2160p50: 24p/50p/60p"), "1080i50": _("1080i50: 24p/50i/60i"), "720p50": _("720p50: 24p/50p/60p")}, default="false")
	config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="rgb")
	config.av.aspectratio = ConfigSelection(choices={
			"4_3_letterbox": _("4:3 Letterbox"),
			"4_3_panscan": _("4:3 PanScan"),
			"16_9": _("16:9"),
			"16_9_always": _("16:9 always"),
			"16_10_letterbox": _("16:10 Letterbox"),
			"16_10_panscan": _("16:10 PanScan"),
			"16_9_letterbox": _("16:9 Letterbox")},
			default="16_9")
	config.av.aspect = ConfigSelection(choices={
			"4:3": _("4:3"),
			"16:9": _("16:9"),
			"16:10": _("16:10"),
			"auto": _("Automatic")},
			default="16:9")

	# Some boxes have a redundant proc entry for policy2 choices, but some don't (The choices are from a 16:9 point of view anyways)
	if os.path.exists("/proc/stb/video/policy2_choices"):
		policy2_choices_proc = "/proc/stb/video/policy2_choices"
	else:
		policy2_choices_proc = "/proc/stb/video/policy_choices"

	try:
		policy2_choices_raw = open(policy2_choices_proc, "r").read()
	except:
		policy2_choices_raw = "letterbox"

	policy2_choices = {}

	if "letterbox" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: black bars on top/bottom) in doubt, keep english term.
		policy2_choices.update({"letterbox": _("Letterbox")})

	if "panscan" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
		policy2_choices.update({"panscan": _("Pan&scan")})

	if "nonliner" in policy2_choices_raw and not "nonlinear" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the top/bottom (Center of picture maintains aspect, top/bottom lose aspect heaver than on linear stretch))
		policy2_choices.update({"nonliner": _("Stretch nonlinear")})
	if "nonlinear" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the top/bottom (Center of picture maintains aspect, top/bottom lose aspect heaver than on linear stretch))
		policy2_choices.update({"nonlinear": _("Stretch nonlinear")})

	if "scale" in policy2_choices_raw and not "auto" in policy2_choices_raw and not "bestfit" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy2_choices.update({"scale": _("Stretch linear")})
	if "full" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (force aspect))
		policy2_choices.update({"full": _("Stretch full")})
	if "auto" in policy2_choices_raw and not "bestfit" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy2_choices.update({"auto": _("Stretch linear")})
	if "bestfit" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy2_choices.update({"bestfit": _("Stretch linear")})

	config.av.policy_169 = ConfigSelection(choices=policy2_choices, default="letterbox")

	policy_choices_proc = "/proc/stb/video/policy_choices"
	try:
		policy_choices_raw = open(policy_choices_proc, "r").read()
	except:
		policy_choices_raw = "panscan"

	policy_choices = {}

	if "pillarbox" in policy_choices_raw and not "panscan" in policy_choices_raw:
		# Very few boxes support "pillarbox" as an alias for "panscan" (Which in fact does pillarbox)
		# So only add "pillarbox" if "panscan" is not listed in choices

		# TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
		policy_choices.update({"pillarbox": _("Pillarbox")})

	if "panscan" in policy_choices_raw:
		# DRIVER BUG:	"panscan" in /proc actually does "pillarbox" (That's probably why an alias to it named "pillarbox" existed)!
		#		Interpret "panscan" setting with a "Pillarbox" text in order to show the correct value in GUI

		# TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
		policy_choices.update({"panscan": _("Pillarbox")})

	if "letterbox" in policy_choices_raw:
		# DRIVER BUG:	"letterbox" in /proc actually does pan&scan
		#		"letterbox" and 4:3 content on 16:9 TVs is mutually exclusive, as "letterbox" is the method to show wide content on narrow TVs
		#		Probably the bug arose as the driver actually does the same here as it would for wide content on narrow TVs (It stretches the picture to fit width)

		# TRANSLATORS: (aspect ratio policy: Fit width, cut/crop top and bottom (Maintain aspect ratio))
		policy_choices.update({"letterbox": _("Pan&scan")})

	if "nonliner" in policy_choices_raw and not "nonlinear" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right (Center 50% of picture maintain aspect, left/right 25% lose aspect heaver than on linear stretch))
		policy_choices.update({"nonliner": _("Stretch nonlinear")})
	if "nonlinear" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right (Center 50% of picture maintain aspect, left/right 25% lose aspect heaver than on linear stretch))
		policy_choices.update({"nonlinear": _("Stretch nonlinear")})

	# "auto", "bestfit" and "scale" are aliasses for the same: Stretch linear
	if "scale" in policy_choices_raw and not "auto" in policy_choices_raw and not "bestfit" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy_choices.update({"scale": _("Stretch linear")})
	if "full" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (force aspect))
		policy_choices.update({"full": _("Stretch full")})
	if "auto" in policy_choices_raw and not "bestfit" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy_choices.update({"auto": _("Stretch linear")})
	if "bestfit" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy_choices.update({"bestfit": _("Stretch linear")})

	config.av.policy_43 = ConfigSelection(choices=policy_choices, default="panscan")
	config.av.tvsystem = ConfigSelection(choices={"pal": _("PAL"), "ntsc": _("NTSC"), "multinorm": _("multinorm")}, default="pal")
	config.av.wss = ConfigEnableDisable(default=True)
	config.av.generalAC3delay = ConfigSelectionNumber(-1000, 1000, 5, default=0)
	config.av.generalPCMdelay = ConfigSelectionNumber(-1000, 1000, 5, default=0)
	config.av.vcrswitch = ConfigEnableDisable(default=False)

	#config.av.aspect.setValue('16:9')
	config.av.aspect.addNotifier(iAVSwitch.setAspect)
	config.av.wss.addNotifier(iAVSwitch.setWss)
	config.av.policy_43.addNotifier(iAVSwitch.setPolicy43)
	config.av.policy_169.addNotifier(iAVSwitch.setPolicy169)

	def setColorFormat(configElement):
		if config.av.videoport and config.av.videoport.value in ("YPbPr", "Scart-YPbPr"):
			iAVSwitch.setColorFormat(3)
		elif config.av.videoport and config.av.videoport.value in ("RCA"):
			iAVSwitch.setColorFormat(0)
		else:
			if getBoxType() == 'et6x00':
				map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}
			elif getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus' or getBoxType().startswith('et'):
				map = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3}
			else:
				map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
			iAVSwitch.setColorFormat(map[configElement.value])
	config.av.colorformat.addNotifier(setColorFormat)

	def setAspectRatio(configElement):
		map = {"4_3_letterbox": 0, "4_3_panscan": 1, "16_9": 2, "16_9_always": 3, "16_10_letterbox": 4, "16_10_panscan": 5, "16_9_letterbox": 6}
		iAVSwitch.setAspectRatio(map[configElement.value])

	iAVSwitch.setInput("ENCODER") # init on startup
	if (getBoxType() in ('gbquad', 'gbquadplus', 'et5x00', 'ixussone', 'ixusszero', 'axodin', 'axodinc', 'starsatlx', 'galaxym6', 'geniuse3hd', 'evoe3hd', 'axase3', 'axase3c', 'omtimussos1', 'omtimussos2', 'gb800seplus', 'gb800ueplus', 'gbultrase', 'gbultraue', 'gbultraueh', 'twinboxlcd')) or about.getModelString() == 'et6000':
		detected = False
	else:
		detected = eAVSwitch.getInstance().haveScartSwitch()

	SystemInfo["ScartSwitch"] = detected

	if os.path.exists("/proc/stb/hdmi/bypass_edid_checking"):
		f = open("/proc/stb/hdmi/bypass_edid_checking", "r")
		can_edidchecking = f.read().strip().split(" ")
		f.close()
	else:
		can_edidchecking = False

	SystemInfo["Canedidchecking"] = can_edidchecking

	if can_edidchecking:
		def setEDIDBypass(configElement):
			try:
				f = open("/proc/stb/hdmi/bypass_edid_checking", "w")
				if configElement.value:
					f.write("00000001")
				else:
					f.write("00000000")
				f.close()
			except:
				pass
		config.av.bypass_edid_checking = ConfigYesNo(default=True)
		config.av.bypass_edid_checking.addNotifier(setEDIDBypass)
	else:
		config.av.bypass_edid_checking = ConfigNothing()

	def setUnsupportModes(configElement):
		iAVSwitch.readPreferredModes()
		iAVSwitch.createConfig()

	config.av.edid_override.addNotifier(setUnsupportModes)

	if os.path.exists("/proc/stb/video/hdmi_colorspace"):
		f = open("/proc/stb/video/hdmi_colorspace", "r")
		have_colorspace = f.read().strip().split(" ")
		f.close()
	else:
		have_colorspace = False

	SystemInfo["havecolorspace"] = have_colorspace

	if have_colorspace:
		def setHDMIColorspace(configElement):
			try:
				f = open("/proc/stb/video/hdmi_colorspace", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		if getBoxType() in ('vusolo4k', 'vuuno4k', 'vuuno4kse', 'vuultimo4k', 'vuduo4k', 'vuduo4kse'):
			config.av.hdmicolorspace = ConfigSelection(choices={
					"Edid(Auto)": _("Auto"),
					"Hdmi_Rgb": _("RGB"),
					"444": _("YCbCr444"),
					"422": _("YCbCr422"),
					"420": _("YCbCr420")},
					default="Edid(Auto)")
		elif getBoxType() in ('dm900', 'dm920', 'vuzero4k'):
			config.av.hdmicolorspace = ConfigSelection(choices={
					"Edid(Auto)": _("Auto"),
					"Hdmi_Rgb": _("RGB"),
					"Itu_R_BT_709": _("BT709"),
					"DVI_Full_Range_RGB": _("Full Range RGB"),
					"FCC": _("FCC 1953"),
					"Itu_R_BT_470_2_BG": _("BT470 BG"),
					"Smpte_170M": _("Smpte 170M"),
					"Smpte_240M": _("Smpte 240M"),
					"Itu_R_BT_2020_NCL": _("BT2020 NCL"),
					"Itu_R_BT_2020_CL": _("BT2020 CL"),
					"XvYCC_709": _("BT709 XvYCC"),
					"XvYCC_601": _("BT601 XvYCC")},
					default="Edid(Auto)")
		else:
			config.av.hdmicolorspace = ConfigSelection(choices={
					"auto": _("auto"),
					"rgb": _("rgb"),
					"420": _("420"),
					"422": _("422"),
					"444": _("444")},
					default="auto")
		config.av.hdmicolorspace.addNotifier(setHDMIColorspace)
	else:
		config.av.hdmicolorspace = ConfigNothing()

	if os.path.exists("/proc/stb/video/hdmi_colorimetry"):
		f = open("/proc/stb/video/hdmi_colorimetry", "r")
		have_colorimetry = f.read().strip().split(" ")
		f.close()
	else:
		have_colorimetry = False

	SystemInfo["havecolorimetry"] = have_colorimetry

	if have_colorimetry:
		def setHDMIColorimetry(configElement):
			sleep(0.1)
			try:
				f = open("/proc/stb/video/hdmi_colorimetry", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.hdmicolorimetry = ConfigSelection(choices={
				"auto": _("auto"),
				"bt2020ncl": _("BT 2020 NCL"),
				"bt2020cl": _("BT 2020 CL"),
				"bt709": _("BT 709")},
				default="auto")
		config.av.hdmicolorimetry.addNotifier(setHDMIColorimetry)
	else:
		config.av.hdmicolorimetry = ConfigNothing()

	if os.path.exists("/proc/stb/info/boxmode"):
		f = open("/proc/stb/info/boxmode", "r")
		have_boxmode = f.read().strip().split(" ")
		f.close()
	else:
		have_boxmode = False

	SystemInfo["haveboxmode"] = have_boxmode

	if have_boxmode:
		def setBoxmode(configElement):
			try:
				f = open("/proc/stb/info/boxmode", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.boxmode = ConfigSelection(choices={
				"12": _("enable PIP no HDR"),
				"1": _("12bit 4:2:0/4:2:2 no PIP")},
				default="12")
		config.av.boxmode.addNotifier(setBoxmode)
	else:
		config.av.boxmode = ConfigNothing()

	if os.path.exists("/proc/stb/video/hdmi_colordepth"):
		f = open("/proc/stb/video/hdmi_colordepth", "r")
		have_HdmiColordepth = f.read().strip().split(" ")
		f.close()
	else:
		have_HdmiColordepth = False

	SystemInfo["havehdmicolordepth"] = have_HdmiColordepth

	if have_HdmiColordepth:
		def setHdmiColordepth(configElement):
			try:
				f = open("/proc/stb/video/hdmi_colordepth", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.hdmicolordepth = ConfigSelection(choices={
				"auto": _("Auto"),
				"8bit": _("8bit"),
				"10bit": _("10bit"),
				"12bit": _("12bit")},
				default="auto")
		config.av.hdmicolordepth.addNotifier(setHdmiColordepth)
	else:
		config.av.hdmicolordepth = ConfigNothing()

	if os.path.exists("/proc/stb/video/hdmi_hdrtype"):
		f = open("/proc/stb/video/hdmi_hdrtype", "r")
		have_HdmiHdrType = f.read().strip().split(" ")
		f.close()
	else:
		have_HdmiHdrType = False

	SystemInfo["havehdmihdrtype"] = have_HdmiHdrType

	if have_HdmiHdrType:
		def setHdmiHdrType(configElement):
			try:
				f = open("/proc/stb/video/hdmi_hdrtype", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.hdmihdrtype = ConfigSelection(choices={
				"auto": _("Auto"),
				"dolby": _("dolby"),
				"none": _("sdr"),
				"hdr10": _("hdr10"),
				"hlg": _("hlg")},
				default="auto")
		config.av.hdmihdrtype.addNotifier(setHdmiHdrType)
	else:
		config.av.hdmihdrtype = ConfigNothing()

	if os.path.exists("/proc/stb/hdmi/hlg_support_choices"):
		f = open("/proc/stb/hdmi/hlg_support_choices", "r")
		have_HDRSupport = f.read().strip().split(" ")
		f.close()
	else:
		have_HDRSupport = False

	SystemInfo["HDRSupport"] = have_HDRSupport

	if have_HDRSupport:
		def setHlgSupport(configElement):
			open("/proc/stb/hdmi/hlg_support", "w").write(configElement.value)
		config.av.hlg_support = ConfigSelection(default="auto(EDID)",
			choices=[("auto(EDID)", _("controlled by HDMI")), ("yes", _("force enabled")), ("no", _("force disabled"))])
		config.av.hlg_support.addNotifier(setHlgSupport)

		def setHdr10Support(configElement):
			open("/proc/stb/hdmi/hdr10_support", "w").write(configElement.value)
		config.av.hdr10_support = ConfigSelection(default="auto(EDID)",
			choices=[("auto(EDID)", _("controlled by HDMI")), ("yes", _("force enabled")), ("no", _("force disabled"))])
		config.av.hdr10_support.addNotifier(setHdr10Support)

		def setDisable12Bit(configElement):
			open("/proc/stb/video/disable_12bit", "w").write(configElement.value)
		config.av.allow_12bit = ConfigSelection(default="0", choices=[("0", _("yes")), ("1", _("no"))])
		config.av.allow_12bit.addNotifier(setDisable12Bit)

		def setDisable10Bit(configElement):
			open("/proc/stb/video/disable_10bit", "w").write(configElement.value)
		config.av.allow_10bit = ConfigSelection(default="0", choices=[("0", _("yes")), ("1", _("no"))])
		config.av.allow_10bit.addNotifier(setDisable10Bit)

	if os.path.exists("/proc/stb/hdmi/audio_source"):
		f = open("/proc/stb/hdmi/audio_source", "r")
		can_audiosource = f.read().strip().split(" ")
		f.close()
	else:
		can_audiosource = False

	SystemInfo["Canaudiosource"] = can_audiosource

	if can_audiosource:
		def setAudioSource(configElement):
			try:
				f = open("/proc/stb/hdmi/audio_source", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.audio_source = ConfigSelection(choices={
				"pcm": _("PCM"),
				"spdif": _("SPDIF")},
				default="pcm")
		config.av.audio_source.addNotifier(setAudioSource)
	else:
		config.av.audio_source = ConfigNothing()

	if os.path.exists("/proc/stb/audio/3d_surround_choices"):
		f = open("/proc/stb/audio/3d_surround_choices", "r")
		can_3dsurround = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround = False

	SystemInfo["Can3DSurround"] = can_3dsurround

	if can_3dsurround:
		def set3DSurround(configElement):
			f = open("/proc/stb/audio/3d_surround", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))]
		config.av.surround_3d = ConfigSelection(choices=choice_list, default="none")
		config.av.surround_3d.addNotifier(set3DSurround)
	else:
		config.av.surround_3d = ConfigNothing()

	if os.path.exists("/proc/stb/audio/3d_surround_speaker_position_choices"):
		f = open("/proc/stb/audio/3d_surround_speaker_position_choices", "r")
		can_3dsurround_speaker = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround_speaker = False

	SystemInfo["Can3DSpeaker"] = can_3dsurround_speaker

	if can_3dsurround_speaker:
		def set3DSurroundSpeaker(configElement):
			try:
				f = open("/proc/stb/audio/3d_surround_speaker_position", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		choice_list = [("center", _("center")), ("wide", _("wide")), ("extrawide", _("extra wide"))]
		config.av.surround_3d_speaker = ConfigSelection(choices=choice_list, default="center")
		config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)
	else:
		config.av.surround_3d_speaker = ConfigNothing()

	if os.path.exists("/proc/stb/audio/avl_choices"):
		f = open("/proc/stb/audio/avl_choices", "r")
		can_autovolume = f.read().strip().split(" ")
		f.close()
	else:
		can_autovolume = False

	SystemInfo["CanAutoVolume"] = can_autovolume

	if can_autovolume:
		def setAutoVolume(configElement):
			f = open("/proc/stb/audio/avl", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))]
		config.av.autovolume = ConfigSelection(choices=choice_list, default="none")
		config.av.autovolume.addNotifier(setAutoVolume)
	else:
		config.av.autovolume = ConfigNothing()

	try:
		can_pcm_multichannel = os.access("/proc/stb/audio/multichannel_pcm", os.W_OK)
	except:
		can_pcm_multichannel = False

	SystemInfo["supportPcmMultichannel"] = can_pcm_multichannel
	if can_pcm_multichannel:
		def setPCMMultichannel(configElement):
			open("/proc/stb/audio/multichannel_pcm", "w").write(configElement.value and "enable" or "disable")
		config.av.pcm_multichannel = ConfigYesNo(default=False)
		config.av.pcm_multichannel.addNotifier(setPCMMultichannel)

	def setVolumeStepsize(configElement):
		eDVBVolumecontrol.getInstance().setVolumeSteps(int(configElement.value))
	config.av.volume_stepsize = ConfigSelectionNumber(1, 10, 1, default=5)
	config.av.volume_stepsize_fastmode = ConfigSelectionNumber(1, 10, 1, default=5)
	config.av.volume_hide_mute = ConfigYesNo(default=True)
	config.av.volume_stepsize.addNotifier(setVolumeStepsize)

	try:
		f = open("/proc/stb/audio/ac3_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_ac3 = "downmix" in file
	except:
		can_downmix_ac3 = False
		SystemInfo["CanPcmMultichannel"] = False

	SystemInfo["CanDownmixAC3"] = can_downmix_ac3
	if can_downmix_ac3:
		def setAC3Downmix(configElement):
			f = open("/proc/stb/audio/ac3", "w")
			if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
				f.write(configElement.value)
			else:
				f.write(configElement.value and "downmix" or "passthrough")
			f.close()
			if SystemInfo.get("supportPcmMultichannel", False) and not configElement.value:
				SystemInfo["CanPcmMultichannel"] = True
			else:
				SystemInfo["CanPcmMultichannel"] = False
				if can_pcm_multichannel:
					config.av.pcm_multichannel.setValue(False)
		if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
			choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI"))]
			config.av.downmix_ac3 = ConfigSelection(choices=choice_list, default="downmix")
		else:
			config.av.downmix_ac3 = ConfigYesNo(default=True)
		config.av.downmix_ac3.addNotifier(setAC3Downmix)

	if os.path.exists("/proc/stb/audio/ac3plus_choices"):
		f = open("/proc/stb/audio/ac3plus_choices", "r")
		can_ac3plustranscode = f.read().strip().split(" ")
		f.close()
	else:
		can_ac3plustranscode = False

	SystemInfo["CanAC3plusTranscode"] = can_ac3plustranscode

	if can_ac3plustranscode:
		def setAC3plusTranscode(configElement):
			f = open("/proc/stb/audio/ac3plus", "w")
			f.write(configElement.value)
			f.close()
		if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
			choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_ac3", _("convert to AC3")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI")), ("force_ddp", _("force AC3plus"))]
			config.av.transcodeac3plus = ConfigSelection(choices=choice_list, default="force_ac3")
		elif getBoxType() in ('gbquad4k', 'gbue4k', 'gbx34k'):
			choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("force_ac3", _("convert to AC3")), ("multichannel", _("convert to multi-channel PCM")), ("force_dts", _("convert to DTS"))]
			config.av.transcodeac3plus = ConfigSelection(choices=choice_list, default="force_ac3")
		else:
			choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_ac3", _("convert to AC3"))]
			config.av.transcodeac3plus = ConfigSelection(choices=choice_list, default="force_ac3")
		config.av.transcodeac3plus.addNotifier(setAC3plusTranscode)

	try:
		f = open("/proc/stb/audio/dtshd_choices", "r")
		file = f.read()[:-1]
		can_dtshd = f.read().strip().split(" ")
		f.close()
	except:
		can_dtshd = False

	SystemInfo["CanDTSHD"] = can_dtshd
	if can_dtshd:
		def setDTSHD(configElement):
			f = open("/proc/stb/audio/dtshd", "w")
			f.write(configElement.value)
			f.close()
		if getBoxType() in ("dm7080", "dm820"):
			choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_dts", _("convert to DTS"))]
			config.av.dtshd = ConfigSelection(choices=choice_list, default="use_hdmi_caps")
		else:
			choice_list = [("downmix", _("Downmix")), ("force_dts", _("convert to DTS")), ("use_hdmi_caps", _("controlled by HDMI")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI"))]
			config.av.dtshd = ConfigSelection(choices=choice_list, default="downmix")
		config.av.dtshd.addNotifier(setDTSHD)

	try:
		f = open("/proc/stb/audio/wmapro_choices", "r")
		file = f.read()[:-1]
		can_wmapro = f.read().strip().split(" ")
		f.close()
	except:
		can_wmapro = False

	SystemInfo["CanWMAPRO"] = can_wmapro
	if can_wmapro:
		def setWMAPRO(configElement):
			f = open("/proc/stb/audio/wmapro", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI"))]
		config.av.wmapro = ConfigSelection(choices=choice_list, default="downmix")
		config.av.wmapro.addNotifier(setWMAPRO)

	try:
		f = open("/proc/stb/audio/dts_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_dts = "downmix" in file
	except:
		can_downmix_dts = False

	SystemInfo["CanDownmixDTS"] = can_downmix_dts
	if can_downmix_dts:
		def setDTSDownmix(configElement):
			f = open("/proc/stb/audio/dts", "w")
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		config.av.downmix_dts = ConfigYesNo(default=True)
		config.av.downmix_dts.addNotifier(setDTSDownmix)

	try:
		f = open("/proc/stb/audio/aac_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_aac = "downmix" in file
	except:
		can_downmix_aac = False

	SystemInfo["CanDownmixAAC"] = can_downmix_aac
	if can_downmix_aac:
		def setAACDownmix(configElement):
			f = open("/proc/stb/audio/aac", "w")
			if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800', 'gbquad4k', 'gbue4k', 'gbx34k'):
				f.write(configElement.value)
			else:
				f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
			choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI"))]
			config.av.downmix_aac = ConfigSelection(choices=choice_list, default="downmix")
		elif getBoxType() in ('gbquad4k', 'gbue4k', 'gbx34k'):
			choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("force_ac3", _("convert to AC3")), ("force_dts", _("convert to DTS")), ("use_hdmi_cacenter", _("use_hdmi_cacenter")), ("wide", _("wide")), ("extrawide", _("extrawide"))]
			config.av.downmix_aac = ConfigSelection(choices=choice_list, default="downmix")
		else:
			config.av.downmix_aac = ConfigYesNo(default=True)
		config.av.downmix_aac.addNotifier(setAACDownmix)

	try:
		f = open("/proc/stb/audio/aacplus_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_aacplus = "downmix" in file
	except:
		can_downmix_aacplus = False

	SystemInfo["CanDownmixAACPlus"] = can_downmix_aacplus
	if can_downmix_aacplus:
		def setAACDownmixPlus(configElement):
			f = open("/proc/stb/audio/aacplus", "w")
			f.write(configElement.value)
			f.close()

		choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("force_ac3", _("convert to AC3")), ("force_dts", _("convert to DTS")), ("use_hdmi_cacenter", _("use_hdmi_cacenter")), ("wide", _("wide")), ("extrawide", _("extrawide"))]
		config.av.downmix_aacplus = ConfigSelection(choices=choice_list, default="downmix")
		config.av.downmix_aacplus.addNotifier(setAACDownmixPlus)

	if os.path.exists("/proc/stb/audio/aac_transcode_choices"):
		f = open("/proc/stb/audio/aac_transcode_choices", "r")
		can_aactranscode = f.read().strip().split(" ")
		f.close()
	else:
		can_aactranscode = False

	SystemInfo["CanAACTranscode"] = can_aactranscode

	if can_aactranscode:
		def setAACTranscode(configElement):
			f = open("/proc/stb/audio/aac_transcode", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]
		config.av.transcodeaac = ConfigSelection(choices=choice_list, default="off")
		config.av.transcodeaac.addNotifier(setAACTranscode)
	else:
		config.av.transcodeaac = ConfigNothing()

	if os.path.exists("/proc/stb/audio/btaudio"):
		f = open("/proc/stb/audio/btaudio", "r")
		can_btaudio = f.read().strip().split(" ")
		f.close()
	else:
		can_btaudio = False

	SystemInfo["CanBTAudio"] = can_btaudio

	if can_btaudio:
		def setBTAudio(configElement):
			f = open("/proc/stb/audio/btaudio", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("off", _("off")), ("on", _("on"))]
		config.av.btaudio = ConfigSelection(choices=choice_list, default="off")
		config.av.btaudio.addNotifier(setBTAudio)
	else:
		config.av.btaudio = ConfigNothing()

	if os.path.exists("/proc/stb/audio/btaudio_delay"):
		f = open("/proc/stb/audio/btaudio_delay", "r")
		can_btaudio_delay = f.read().strip().split(" ")
		f.close()
	else:
		can_btaudio_delay = False

	SystemInfo["CanBTAudioDelay"] = can_btaudio_delay

	if can_btaudio_delay:
		def setBTAudioDelay(configElement):
			f = open("/proc/stb/audio/btaudio_delay", "w")
			f.write(format(configElement.value * 90, "x"))
			f.close()
		config.av.btaudiodelay = ConfigSelectionNumber(-1000, 1000, 5, default=0)
		config.av.btaudiodelay.addNotifier(setBTAudioDelay)
	else:
		config.av.btaudiodelay = ConfigNothing()

	if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):
		def setScaler_sharpness(config):
			myval = int(config.value)
			try:
				print("[AVSwitch] setting scaler_sharpness to: %0.8X" % myval)
				f = open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w")
				f.write("%0.8X\n" % myval)
				f.close()
				f = open("/proc/stb/vmpeg/0/pep_apply", "w")
				f.write("1")
				f.close()
			except IOError:
				print("[AVSwitch] couldn't write pep_scaler_sharpness")

		if getBoxType() in ('gbquad', 'gbquadplus'):
			config.av.scaler_sharpness = ConfigSlider(default=5, limits=(0, 26))
		else:
			config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0, 26))
		config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
	else:
		config.av.scaler_sharpness = NoSave(ConfigNothing())

	iAVSwitch.setConfiguredMode()
Exemple #33
0
class OSD3DSetupScreen(Screen, ConfigListScreen):
	skin = """
	<screen position="c-200,c-100" size="400,200" title="OSD 3D setup">
		<widget name="config" position="c-175,c-75" size="350,150" />
		<ePixmap pixmap="skin_default/buttons/green.png" position="c-145,e-45" zPosition="0" size="140,40" alphatest="on" />
		<ePixmap pixmap="skin_default/buttons/red.png" position="c+5,e-45" zPosition="0" size="140,40" alphatest="on" />
		<widget name="ok" position="c-145,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="green" />
		<widget name="cancel" position="c+5,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="red" />
	</screen>"""

	def __init__(self, session):
		self.skin = OSD3DSetupScreen.skin
		Screen.__init__(self, session)

		from Components.ActionMap import ActionMap
		from Components.Button import Button

		self["ok"] = Button(_("OK"))
		self["cancel"] = Button(_("Cancel"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"green": self.keyGo,
			"red": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session)

		mode = config.plugins.OSD3DSetup.mode.getValue()
		znorm = config.plugins.OSD3DSetup.znorm.getValue()

		self.mode = ConfigSelection(choices = modelist, default = mode)
		self.znorm = ConfigSlider(default = znorm + 50, increment = 1, limits = (0, 100))
		self.list.append(getConfigListEntry(_("3d mode"), self.mode))
		self.list.append(getConfigListEntry(_("Depth"), self.znorm))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.setPreviewSettings()

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.setPreviewSettings()

	def setPreviewSettings(self):
		applySettings(self.mode.getValue(), int(self.znorm.getValue()) - 50)

	def keyGo(self):
		config.plugins.OSD3DSetup.mode.value = self.mode.getValue()
		config.plugins.OSD3DSetup.znorm.value = int(self.znorm.getValue()) - 50
		config.plugins.OSD3DSetup.save()
		self.close()

	def keyCancel(self):
		setConfiguredSettings()
		self.close()
    def createConfig(self, *args):
        config.psi = ConfigSubsection()
        config.psi.configsteps = NoSave(
            ConfigSelection(choices=[1, 5, 10, 25], default=1))

        if os_path.exists("/proc/stb/video/plane/psi_contrast"):

            def setContrast(config):
                myval = int(config.value)
                try:
                    print "--> setting contrast to: %d" % myval
                    #open("/proc/stb/video/plane/psi_contrast", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_contrast) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_contrast."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.contrast = ConfigSlider(default=128, limits=(0, 256))
            config.psi.contrast.addNotifier(setContrast)
        else:
            config.psi.contrast = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_saturation"):

            def setSaturation(config):
                myval = int(config.value)
                try:
                    print "--> setting saturation to: %d" % myval
                    #open("/proc/stb/video/plane/psi_saturation", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_saturation) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_saturaion."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.saturation = ConfigSlider(default=128, limits=(0, 256))
            config.psi.saturation.addNotifier(setSaturation)
        else:
            config.psi.saturation = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_tint"):

            def setHue(config):
                myval = int(config.value)
                try:
                    print "--> setting tint to: %d" % myval
                    #open("/proc/stb/video/plane/psi_hue", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_tint) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_tint."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.hue = ConfigSlider(default=128, limits=(0, 256))
            config.psi.hue.addNotifier(setHue)
        else:
            config.psi.hue = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_brightness"):

            def setBrightness(config):
                myval = int(config.value)
                try:
                    print "--> setting brightness to: %d" % myval
                    #open("/proc/stb/video/plane/psi_brightness", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_brightness) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_brightness."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.brightness = ConfigSlider(default=128, limits=(0, 256))
            config.psi.brightness.addNotifier(setBrightness)
        else:
            config.psi.brightness = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_block_noise_reduction"):

            def setBlock_noise_reduction(config):
                myval = int(config.value)
                try:
                    print "--> setting block_noise_reduction to: %d" % myval
                    #open("/proc/stb/video/plane/psi_block_noise_reduction", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_block_noise_reduction) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_block_noise_reduction."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.block_noise_reduction = ConfigSlider(default=0,
                                                            limits=(0, 5))
            config.psi.block_noise_reduction.addNotifier(
                setBlock_noise_reduction)
        else:
            config.psi.block_noise_reduction = NoSave(ConfigNothing())

        if os_path.exists(
                "/proc/stb/video/plane/psi_mosquito_noise_reduction"):

            def setMosquito_noise_reduction(config):
                myval = int(config.value)
                try:
                    print "--> setting mosquito_noise_reduction to: %d" % myval
                    #open("/proc/stb/video/plane/psi_mosquito_noise_reduction", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_mosquito_noise_reduction) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_mosquito_noise_reduction."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.mosquito_noise_reduction = ConfigSlider(default=0,
                                                               limits=(0, 5))
            config.psi.mosquito_noise_reduction.addNotifier(
                setMosquito_noise_reduction)
        else:
            config.psi.mosquito_noise_reduction = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_digital_contour_removal"):

            def setDigital_contour_removal(config):
                myval = int(config.value)
                try:
                    print "--> setting digital_contour_removal to: %d" % myval
                    #open("/proc/stb/video/plane/psi_digital_contour_removal", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_digital_contour_removal) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_digital_contour_removal."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.digital_contour_removal = ConfigSlider(default=0,
                                                              limits=(0, 5))
            config.psi.digital_contour_removal.addNotifier(
                setDigital_contour_removal)
        else:
            config.psi.digital_contour_removal = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_split"):

            def setSplitMode(config):
                try:
                    print "--> setting splitmode to:", str(config.value)
                    #open("/proc/stb/video/plane/psi_split", "w").write(str(config.value))
                except IOError:
                    print "couldn't write psi_split."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.split = ConfigSelection(choices={
                "off": _("Off"),
                "left": _("Left"),
                "right": _("Right")
            },
                                               default="off")
            config.psi.split.addNotifier(setSplitMode)
        else:
            config.psi.split = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_sharpness"):

            def setSharpness(config):
                myval = int(config.value)
                try:
                    print "--> setting sharpness to: %d" % myval
                    #open("/proc/stb/video/plane/psi_sharpness", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_sharpness) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_sharpness."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.sharpness = ConfigSlider(default=0, limits=(0, 256))
            config.psi.sharpness.addNotifier(setSharpness)
        else:
            config.psi.sharpness = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_auto_flesh"):

            def setAutoflesh(config):
                myval = int(config.value)
                try:
                    print "--> setting auto_flesh to: %d" % myval
                    #open("/proc/stb/video/plane/psi_auto_flesh", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_auto_flesh) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_auto_flesh."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.auto_flesh = ConfigSlider(default=0, limits=(0, 4))
            config.psi.auto_flesh.addNotifier(setAutoflesh)
        else:
            config.psi.auto_flesh = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_green_boost"):

            def setGreenboost(config):
                myval = int(config.value)
                try:
                    print "--> setting green_boost to: %d" % myval
                    #open("/proc/stb/video/plane/psi_green_boost", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_green_boost) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_green_boost."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.green_boost = ConfigSlider(default=0, limits=(0, 4))
            config.psi.green_boost.addNotifier(setGreenboost)
        else:
            config.psi.green_boost = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_blue_boost"):

            def setBlueboost(config):
                myval = int(config.value)
                try:
                    print "--> setting blue_boost to: %d" % myval
                    #open("/proc/stb/video/plane/psi_blue_boost", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_blue_boost) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_blue_boost."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.blue_boost = ConfigSlider(default=0, limits=(0, 4))
            config.psi.blue_boost.addNotifier(setBlueboost)
        else:
            config.psi.blue_boost = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/video/plane/psi_dynamic_contrast"):

            def setDynamic_contrast(config):
                myval = int(config.value)
                try:
                    print "--> setting dynamic_contrast to: %d" % myval
                    #open("/proc/stb/video/plane/psi_dynamic_contrast", "w").write("%d" % myval)
                    cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_dynamic_contrast) &" % myval
                    system(cmd)
                except IOError:
                    print "couldn't write psi_dynamic_contrast."

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.psi.dynamic_contrast = ConfigSlider(default=0,
                                                       limits=(0, 256))
            config.psi.dynamic_contrast.addNotifier(setDynamic_contrast)
        else:
            config.psi.dynamic_contrast = NoSave(ConfigNothing())

        try:
            x = config.av.scaler_sharpness.value
        except KeyError:
            if os_path.exists("/proc/stb/video/plane/psi_scaler_sharpness"):

                def setScaler_sharpness(config):
                    myval = int(config.value)
                    try:
                        print "--> setting scaler_sharpness to: %d" % myval
                        #open("/proc/stb/video/plane/psi_scaler_sharpness", "w").write("%d" % myval)
                        cmd = "(sleep 2;echo %d > /proc/stb/video/plane/psi_scaler_sharpness) &" % myval
                        system(cmd)
                    except IOError:
                        print "couldn't write psi_scaler_sharpness."

                    if not VideoEnhancement.firstRun:
                        self.setConfiguredValues()

                config.av.scaler_sharpness = ConfigSlider(default=13,
                                                          limits=(0, 26))
                config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
            else:
                config.av.scaler_sharpness = NoSave(ConfigNothing())

        if VideoEnhancement.firstRun:
            self.setConfiguredValues()

        VideoEnhancement.firstRun = False
Exemple #35
0
class OSD3DSetupScreen(Screen, ConfigListScreen):
	#class for configure 3D default settings
	skin = """
	<screen position="c-200,c-100" size="400,200" title="OSD 3D setup">
		<widget name="config" position="c-175,c-75" size="350,150" />
		<ePixmap pixmap="buttons/green.png" position="c-145,e-45" zPosition="0" size="140,40" alphatest="on" />
		<ePixmap pixmap="buttons/red.png" position="c+5,e-45" zPosition="0" size="140,40" alphatest="on" />
		<widget name="ok" position="c-145,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="green" />
		<widget name="cancel" position="c+5,e-45" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="red" />
	</screen>"""

	def __init__(self, session):
		self.skin = OSD3DSetupScreen.skin
		Screen.__init__(self, session)

		from Components.ActionMap import ActionMap
		from Components.Button import Button

		self["ok"] = Button(_("OK"))
		self["cancel"] = Button(_("Cancel"))
		self["help"] = StaticText()

		self["actions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"green": self.keyGo,
			"red": self.keyCancel,
			"0": self.keyZero,
		}, -2)

		# preparing setting items
		mode = config.plugins.OSD3DSetup.mode.value
		znorm = config.plugins.OSD3DSetup.znorm.value
		menuext = config.plugins.OSD3DSetup.menuext.value
		auto = config.plugins.OSD3DSetup.auto.value
		toggle = config.plugins.OSD3DSetup.toggle.value
		prompt = config.plugins.OSD3DSetup.prompt.value

		self.mode = ConfigSelection(choices = modelist, default = nz(mode, val_auto))
		self.znorm = ConfigSlider(default = znorm + 50, increment = 1, limits = (0, 100))
		self.menuext = ConfigSelection(choices = menulist, default = nz(menuext, "none"))
		self.auto = ConfigYesNo(default = nz(auto, False))
		self.toggle = ConfigSelection(choices = togglelist, default = nz(toggle, val_sidebyside))
		self.prompt = ConfigInteger(nz(prompt,10), limits=(0, 30))
		# adding notifiers to immediatelly preview changed 3D settings
		self.mode.addNotifier(self.setPreviewSettings, initial_call = False)
		self.znorm.addNotifier(self.setPreviewSettings, initial_call = False)

		self.refresh()
		self.initHelpTexts()
		ConfigListScreen.__init__(self, self.list, session = self.session)
		self["config"].onSelectionChanged.append(self.updateHelp)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.reloadList()

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.reloadList()

	def keyZero(self):
		cur = self["config"].getCurrent()
		if cur == getConfigListEntry(_("Depth"), self.znorm):
			self.znorm.value = 50
			self.reloadList()
		else:
			ConfigListScreen.keyNumberGlobal(self, 0)

	def reloadList(self):
		self.refresh()
		self["config"].setList(self.list)

	def refresh(self):
		list = []
		list.extend((
			getConfigListEntry(_("3d mode"), self.mode),
			getConfigListEntry(_("Depth"), self.znorm),
			getConfigListEntry(_("Show in menu"), self.menuext),
			getConfigListEntry(_("Turn on automatically"), self.auto)
		))

		# Only allow editing toggle mode when the 3d switch command is supposed to apear in menu or 3d should be turned on automatically
		if self.menuext.value is not "none" or self.auto.value:
			list.append(getConfigListEntry(_("Toggle mode"), self.toggle))

		# Only allow editing user prompt when the 3d auto toggle is activated
		if self.auto.value:
			list.append(getConfigListEntry(_("Display 3D confirmation"), self.prompt))

		self.list = list

	def initHelpTexts(self):
		self.helpDict = {
			self.mode: _("Choose 3D mode (Side by Side, Top And Bottom, Auto, Off)."),
			self.znorm: _("Set the depth of 3D effect. Press [0] for standard value."),
			self.menuext: _("Should quick toggle command be present in menu / extensions list?"),
			self.auto: _("Should the plugin turn on 3D mode automatically judging on the playing media title (3D in service or file name)?"),
			self.toggle: _("Define the mode to turn on 3D automatically or by quick toggle menu command [Side By Side] or [Top And Bottom]."),
			self.prompt: _("How long should 3D mode on confirmation be displayed (seconds). 0 for none."),
		}

	def updateHelp(self):
		cur = self["config"].getCurrent()
		if cur:
			self["help"].text = self.helpDict.get(cur[1], "")
	#channging mode or znorm is immediatelly previewed
	def setPreviewSettings(self, value):
		applySettings(self.mode.value, int(self.znorm.value) - 50)
	#setting are stored in enigma configuration file
	def keyGo(self):
		config.plugins.OSD3DSetup.mode.value = self.mode.value
		config.plugins.OSD3DSetup.znorm.value = int(self.znorm.value) - 50
		config.plugins.OSD3DSetup.menuext.value = self.menuext.value
		config.plugins.OSD3DSetup.auto.value = self.auto.value
		config.plugins.OSD3DSetup.toggle.value = self.toggle.value
		config.plugins.OSD3DSetup.prompt.value = self.prompt.value
		config.plugins.OSD3DSetup.save()
		#refresh menus to reflect current settings
		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
	#roll-back changes - read settings from configuration
	def keyCancel(self):
		setConfiguredSettings()
		self.close()
Exemple #36
0
def InitLcd():
    # FIXME remove getBoxType
    if getBoxType() in ('gbx34k', 'force4', 'alien5', 'viperslim', 'lunix',
                        'lunix4k', 'purehdse', 'vipert2c', 'evoslimse',
                        'evoslimt2c', 'valalinux', 'tmtwin4k', 'tmnanom3',
                        'mbmicrov2', 'revo4k', 'force3uhd', 'force2nano',
                        'evoslim', 'wetekplay', 'wetekplay2', 'wetekhub',
                        'ultrabox', 'novaip', 'dm520', 'dm525', 'purehd',
                        'mutant11', 'xpeedlxpro', 'zgemmai55', 'sf98',
                        'et7x00mini', 'xpeedlxcs2', 'xpeedlxcc', 'e4hd',
                        'e4hdhybrid', 'mbmicro', 'beyonwizt2', 'amikomini',
                        'dynaspark', 'amiko8900', 'sognorevolution',
                        'arguspingulux', 'arguspinguluxmini',
                        'arguspinguluxplus', 'sparkreloaded', 'sabsolo',
                        'sparklx', 'gis8120', 'gb800se', 'gb800solo',
                        'gb800seplus', 'gbultrase', 'gbipbox', 'tmsingle',
                        'tmnano2super', 'iqonios300hd', 'iqonios300hdv2',
                        'optimussos1plus', 'optimussos1', 'vusolo', 'et4x00',
                        'et5x00', 'et6x00', 'et7000', 'et7100', 'mixosf7',
                        'mixoslumi', 'gbx1', 'gbx2', 'gbx3', 'gbx3h'):
        detected = False
    elif getBoxType() in ('pulse4kmini', ):
        detected = True
    else:
        detected = eDBoxLCD.getInstance().detected()
    BoxInfo.setItem("Display", detected)
    config.lcd = ConfigSubsection()

    if exists("/proc/stb/lcd/mode"):
        can_lcdmodechecking = fileReadLine("/proc/stb/lcd/mode")
    else:
        can_lcdmodechecking = False
    BoxInfo.setItem("LCDMiniTV", can_lcdmodechecking)

    if detected:
        ilcd = LCD()
        if can_lcdmodechecking:

            def setLCDModeMinitTV(configElement):
                print("[Lcd] setLCDModeMinitTV='%s'." % configElement.value)
                fileWriteLine("/proc/stb/lcd/mode", configElement.value)

            def setMiniTVFPS(configElement):
                print("[Lcd] setMiniTVFPS='%s'." % configElement.value)
                fileWriteLine("/proc/stb/lcd/fps", configElement.value)

            def setLCDModePiP(configElement):
                pass  # DEBUG: Should this be doing something?

            def setLCDScreenshot(configElement):
                ilcd.setScreenShot(configElement.value)

            config.lcd.modepip = ConfigSelection(choices={
                "0": _("Off"),
                "5": _("PIP"),
                "7": _("PIP with OSD")
            },
                                                 default="0")
            config.lcd.modepip.addNotifier(setLCDModePiP)
            config.lcd.screenshot = ConfigYesNo(default=False)
            config.lcd.screenshot.addNotifier(setLCDScreenshot)
            config.lcd.modeminitv = ConfigSelection(choices={
                "0": _("normal"),
                "1": _("MiniTV"),
                "2": _("OSD"),
                "3": _("MiniTV with OSD")
            },
                                                    default="0")
            config.lcd.fpsminitv = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.modeminitv.addNotifier(setLCDModeMinitTV)
            config.lcd.fpsminitv.addNotifier(setMiniTVFPS)
        else:
            config.lcd.modeminitv = ConfigNothing()
            config.lcd.screenshot = ConfigNothing()
            config.lcd.fpsminitv = ConfigNothing()
        config.lcd.scroll_speed = ConfigSelection(choices=[("500", _("slow")),
                                                           ("300",
                                                            _("normal")),
                                                           ("100", _("fast"))],
                                                  default="300")
        config.lcd.scroll_delay = ConfigSelection(choices=[
            ("10000", "10 %s" % _("seconds")), ("20000",
                                                "20 %s" % _("seconds")),
            ("30000", "30 %s" % _("seconds")), ("60000", "1 %s" % _("minute")),
            ("300000", "5 %s" % _("minutes")), ("noscrolling", _("Off"))
        ],
                                                  default="10000")

        def setLCDbright(configElement):
            ilcd.setBright(configElement.value)

        def setLCDstandbybright(configElement):
            ilcd.setStandbyBright(configElement.value)

        def setLCDdimbright(configElement):
            ilcd.setDimBright(configElement.value)

        def setLCDdimdelay(configElement):
            ilcd.setDimDelay(configElement.value)

        def setLCDcontrast(configElement):
            ilcd.setContrast(configElement.value)

        def setLCDinverted(configElement):
            ilcd.setInverted(configElement.value)

        def setLCDflipped(configElement):
            ilcd.setFlipped(configElement.value)

        def setLCDminitvmode(configElement):
            ilcd.setLCDMiniTVMode(configElement.value)

        def setLCDminitvpipmode(configElement):
            ilcd.setLCDMiniTVPIPMode(configElement.value)

        def setLCDminitvfps(configElement):
            ilcd.setLCDMiniTVFPS(configElement.value)

        def setLEDnormalstate(configElement):
            ilcd.setLEDNormalState(configElement.value)

        def setLEDdeepstandby(configElement):
            ilcd.setLEDDeepStandbyState(configElement.value)

        def setLEDblinkingtime(configElement):
            ilcd.setLEDBlinkingTime(configElement.value)

        def setPowerLEDstate(configElement):
            if exists("/proc/stb/power/powerled"):
                fileWriteLine("/proc/stb/power/powerled",
                              "on" if configElement.value else "off")

        def setPowerLEDstate2(configElement):
            if exists("/proc/stb/power/powerled2"):
                fileWriteLine("/proc/stb/power/powerled2",
                              "on" if configElement.value else "off")

        def setPowerLEDstanbystate(configElement):
            if exists("/proc/stb/power/standbyled"):
                fileWriteLine("/proc/stb/power/standbyled",
                              "on" if configElement.value else "off")

        def setPowerLEDdeepstanbystate(configElement):
            if exists("/proc/stb/power/suspendled"):
                fileWriteLine("/proc/stb/power/suspendled",
                              "on" if configElement.value else "off")

        def setLedPowerColor(configElement):
            if exists("/proc/stb/fp/ledpowercolor"):
                fileWriteLine("/proc/stb/fp/ledpowercolor",
                              configElement.value)

        def setLedStandbyColor(configElement):
            if exists("/proc/stb/fp/ledstandbycolor"):
                fileWriteLine("/proc/stb/fp/ledstandbycolor",
                              configElement.value)

        def setLedSuspendColor(configElement):
            if exists("/proc/stb/fp/ledsuspendledcolor"):
                fileWriteLine("/proc/stb/fp/ledsuspendledcolor",
                              configElement.value)

        def setLedBlinkControlColor(configElement):
            if exists("/proc/stb/fp/led_blink"):
                fileWriteLine("/proc/stb/fp/led_blink", configElement.value)

        def setLedBrightnessControl(configElement):
            if exists("/proc/stb/fp/led_brightness"):
                fileWriteLine("/proc/stb/fp/led_brightness",
                              configElement.value)

        def setLedColorControlColor(configElement):
            if exists("/proc/stb/fp/led_color"):
                fileWriteLine("/proc/stb/fp/led_color", configElement.value)

        def setLedFadeControlColor(configElement):
            if exists("/proc/stb/fp/led_fade"):
                fileWriteLine("/proc/stb/fp/led_fade", configElement.value)

        def setPower4x7On(configElement):
            if exists("/proc/stb/fp/power4x7on"):
                fileWriteLine("/proc/stb/fp/power4x7on",
                              "on" if configElement.value else "off")

        def setPower4x7Standby(configElement):
            if exists("/proc/stb/fp/power4x7standby"):
                fileWriteLine("/proc/stb/fp/power4x7standby",
                              "on" if configElement.value else "off")

        def setPower4x7Suspend(configElement):
            if exists("/proc/stb/fp/power4x7suspend"):
                fileWriteLine("/proc/stb/fp/power4x7suspend",
                              "on" if configElement.value else "off")

        def setXcoreVFD(configElement):
            if exists("/sys/module/brcmstb_osmega/parameters/pt6302_cgram"):
                fileWriteLine(
                    "/sys/module/brcmstb_osmega/parameters/pt6302_cgram",
                    configElement.value)
            if exists("/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram"):
                fileWriteLine(
                    "/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram",
                    configElement.value)
            if exists(
                    "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram"
            ):
                fileWriteLine(
                    "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram",
                    configElement.value)
            if exists(
                    "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram"
            ):
                fileWriteLine(
                    "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram",
                    configElement.value)

        config.usage.vfd_xcorevfd = ConfigSelection(choices=[
            ("0", _("12 character")), ("1", _("8 character"))
        ],
                                                    default="0")
        config.usage.vfd_xcorevfd.addNotifier(setXcoreVFD)
        config.usage.lcd_powerled = ConfigOnOff(default=True)
        config.usage.lcd_powerled.addNotifier(setPowerLEDstate)
        config.usage.lcd_powerled2 = ConfigOnOff(default=True)
        config.usage.lcd_powerled2.addNotifier(setPowerLEDstate2)
        config.usage.lcd_standbypowerled = ConfigOnOff(default=True)
        config.usage.lcd_standbypowerled.addNotifier(setPowerLEDstanbystate)
        config.usage.lcd_deepstandbypowerled = ConfigOnOff(default=True)
        config.usage.lcd_deepstandbypowerled.addNotifier(
            setPowerLEDdeepstanbystate)

        if getBoxType() in ('dual', ):
            config.usage.lcd_ledpowercolor = ConfigSelection(
                default="1", choices=[("0", _("off")), ("1", _("blue"))])
            config.usage.lcd_ledpowercolor.addNotifier(setLedPowerColor)

            config.usage.lcd_ledstandbycolor = ConfigSelection(
                default="1", choices=[("0", _("off")), ("1", _("blue"))])
            config.usage.lcd_ledstandbycolor.addNotifier(setLedStandbyColor)

            config.usage.lcd_ledsuspendcolor = ConfigSelection(
                default="1", choices=[("0", _("off")), ("1", _("blue"))])
            config.usage.lcd_ledsuspendcolor.addNotifier(setLedSuspendColor)
        else:
            config.usage.lcd_ledpowercolor = ConfigSelection(
                default="1",
                choices=[("0", _("Off")), ("1", _("blue")), ("2", _("red")),
                         ("3", _("violet"))])
            config.usage.lcd_ledpowercolor.addNotifier(setLedPowerColor)

            config.usage.lcd_ledstandbycolor = ConfigSelection(
                default="3",
                choices=[("0", _("Off")), ("1", _("blue")), ("2", _("red")),
                         ("3", _("violet"))])
            config.usage.lcd_ledstandbycolor.addNotifier(setLedStandbyColor)

            config.usage.lcd_ledsuspendcolor = ConfigSelection(
                default="2",
                choices=[("0", _("Off")), ("1", _("blue")), ("2", _("red")),
                         ("3", _("violet"))])
            config.usage.lcd_ledsuspendcolor.addNotifier(setLedSuspendColor)

        config.usage.lcd_power4x7on = ConfigOnOff(default=True)
        config.usage.lcd_power4x7on.addNotifier(setPower4x7On)

        config.usage.lcd_power4x7standby = ConfigOnOff(default=True)
        config.usage.lcd_power4x7standby.addNotifier(setPower4x7Standby)

        config.usage.lcd_power4x7suspend = ConfigOnOff(default=True)
        config.usage.lcd_power4x7suspend.addNotifier(setPower4x7Suspend)

        if model in ('dm900', 'dm920', 'e4hdultra', 'protek4k'):
            standby_default = 4
        elif model in ("spycat4kmini", "osmega"):
            standby_default = 10
        else:
            standby_default = 1
        if not ilcd.isOled():
            config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
            config.lcd.contrast.addNotifier(setLCDcontrast)
        else:
            config.lcd.contrast = ConfigNothing()

        if model in ('novatwin', 'novacombo', 'mixosf5', 'mixosf5mini',
                     'gi9196m', 'gi9196lite', 'zgemmas2s', 'zgemmash1',
                     'zgemmash2', 'zgemmass', 'zgemmahs', 'zgemmah2s',
                     'zgemmah2h', 'spycat'):
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 4))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 4))
            config.lcd.bright = ConfigSlider(default=4, limits=(0, 4))
        elif model in ("spycat4kmini", "osmega"):
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 10))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 10))
            config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
        else:
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 10))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 10))
            config.lcd.bright = ConfigSlider(
                default=BoxInfo.getItem("DefaultDisplayBrightness"),
                limits=(0, 10))
        config.lcd.dimbright.addNotifier(setLCDdimbright)
        config.lcd.dimbright.apply = lambda: setLCDdimbright(config.lcd.
                                                             dimbright)
        config.lcd.dimdelay = ConfigSelection(choices=[
            ("5", "5 %s" % _("seconds")), ("10", "10 %s" % _("seconds")),
            ("15", "15 %s" % _("seconds")), ("20", "20 %s" % _("seconds")),
            ("30", "30 %s" % _("seconds")), ("60", "1 %s" % _("minute")),
            ("120", "2 %s" % _("minutes")), ("300", "5 %s" % _("minutes")),
            ("0", _("Off"))
        ],
                                              default="0")
        config.lcd.dimdelay.addNotifier(setLCDdimdelay)
        config.lcd.standby.addNotifier(setLCDstandbybright)
        config.lcd.standby.apply = lambda: setLCDstandbybright(config.lcd.
                                                               standby)
        config.lcd.bright.addNotifier(setLCDbright)
        config.lcd.bright.apply = lambda: setLCDbright(config.lcd.bright)
        config.lcd.bright.callNotifiersOnSaveAndCancel = True
        config.lcd.invert = ConfigYesNo(default=False)
        config.lcd.invert.addNotifier(setLCDinverted)

        config.lcd.flip = ConfigYesNo(default=False)
        config.lcd.flip.addNotifier(setLCDflipped)

        if BoxInfo.getItem("LcdLiveTV"):

            def lcdLiveTvChanged(configElement):
                open(BoxInfo.getItem("LcdLiveTV"),
                     "w").write(configElement.value and "0" or "1")
                try:
                    InfoBarInstance = InfoBar.instance
                    InfoBarInstance and InfoBarInstance.session.open(
                        dummyScreen)
                except:
                    pass

            config.lcd.showTv = ConfigYesNo(default=False)
            config.lcd.showTv.addNotifier(lcdLiveTvChanged)

        if BoxInfo.getItem("LCDMiniTV") and config.misc.boxtype.value not in (
                'gbquad', 'gbquadplus', 'gbquad4k', 'gbue4k'):
            config.lcd.minitvmode = ConfigSelection(
                [("0", _("normal")), ("1", _("MiniTV")), ("2", _("OSD")),
                 ("3", _("MiniTV with OSD"))], "0")
            config.lcd.minitvmode.addNotifier(setLCDminitvmode)
            config.lcd.minitvpipmode = ConfigSelection(
                [("0", _("Off")), ("5", _("PIP")),
                 ("7", _("PIP with OSD"))], "0")
            config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
            config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.minitvfps.addNotifier(setLCDminitvfps)

        if BoxInfo.getItem("VFD_scroll_repeats") and model not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment', ):

            def scroll_repeats(el):
                open(BoxInfo.getItem("VFD_scroll_repeats"),
                     "w").write(el.value)

            choicelist = [("0", _("None")), ("1", _("1X")), ("2", _("2X")),
                          ("3", _("3X")), ("4", _("4X")),
                          ("500", _("Continues"))]
            config.usage.vfd_scroll_repeats = ConfigSelection(
                default="3", choices=choicelist)
            config.usage.vfd_scroll_repeats.addNotifier(
                scroll_repeats, immediate_feedback=False)
        else:
            config.usage.vfd_scroll_repeats = ConfigNothing()

        if BoxInfo.getItem("VFD_scroll_delay") and model not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment', ):

            def scroll_delay(el):
                # add workaround for Boxes who need hex code
                if model in ('sf4008', 'beyonwizu4'):
                    open(BoxInfo.getItem("VFD_scroll_delay"),
                         "w").write(hex(int(el.value)))
                else:
                    open(BoxInfo.getItem("VFD_scroll_delay"),
                         "w").write(str(el.value))

            config.usage.vfd_scroll_delay = ConfigSlider(default=150,
                                                         increment=10,
                                                         limits=(0, 500))
            config.usage.vfd_scroll_delay.addNotifier(scroll_delay,
                                                      immediate_feedback=False)
            config.lcd.hdd = ConfigYesNo(default=True)
        else:
            config.lcd.hdd = ConfigNothing()
            config.usage.vfd_scroll_delay = ConfigNothing()

        if BoxInfo.getItem("VFD_initial_scroll_delay") and model not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment', ):

            def initial_scroll_delay(el):
                if model in ('sf4008', 'beyonwizu4'):
                    # add workaround for Boxes who need hex code
                    open(BoxInfo.getItem("VFD_initial_scroll_delay"),
                         "w").write(hex(int(el.value)))
                else:
                    open(BoxInfo.getItem("VFD_initial_scroll_delay"),
                         "w").write(el.value)

            config.usage.vfd_initial_scroll_delay = ConfigSelection(
                choices=[("3000", "3 %s" % _("seconds")),
                         ("5000", "5 %s" % _("seconds")),
                         ("10000", "10 %s" % _("seconds")),
                         ("20000", "20 %s" % _("seconds")),
                         ("30000", "30 %s" % _("seconds")),
                         ("0", _("no delay"))],
                default="10000")
            config.usage.vfd_initial_scroll_delay.addNotifier(
                initial_scroll_delay, immediate_feedback=False)
        else:
            config.usage.vfd_initial_scroll_delay = ConfigNothing()

        if BoxInfo.getItem("VFD_final_scroll_delay") and model not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment', ):

            def final_scroll_delay(el):
                if model in ('sf4008', 'beyonwizu4'):
                    # add workaround for Boxes who need hex code
                    open(BoxInfo.getItem("VFD_final_scroll_delay"),
                         "w").write(hex(int(el.value)))
                else:
                    open(BoxInfo.getItem("VFD_final_scroll_delay"),
                         "w").write(el.value)

            config.usage.vfd_final_scroll_delay = ConfigSelection(
                choices=[("3000", "3 %s" % _("seconds")),
                         ("5000", "5 %s" % _("seconds")),
                         ("10000", "10 %s" % _("seconds")),
                         ("20000", "20 %s" % _("seconds")),
                         ("30000", "30 %s" % _("seconds")),
                         ("0", _("no delay"))],
                default="10000")
            config.usage.vfd_final_scroll_delay.addNotifier(
                final_scroll_delay, immediate_feedback=False)
        else:
            config.usage.vfd_final_scroll_delay = ConfigNothing()
        if exists("/proc/stb/lcd/show_symbols"):

            def setLCDmode(configElement):
                ilcd.setMode("1" if configElement.value else "0")

            config.lcd.mode = ConfigYesNo(default=True)
            config.lcd.mode.addNotifier(setLCDmode)
        else:
            config.lcd.mode = ConfigNothing()
        if exists("/proc/stb/power/vfd") or exists("/proc/stb/lcd/vfd"):

            def setLCDpower(configElement):
                ilcd.setPower("1" if configElement.value else "0")

            config.lcd.power = ConfigYesNo(default=True)
            config.lcd.power.addNotifier(setLCDpower)
        else:
            config.lcd.power = ConfigNothing()
        if exists("/proc/stb/fb/sd_detach"):

            def setfblcddisplay(configElement):
                ilcd.setfblcddisplay("1" if configElement.value else "0")

            config.lcd.fblcddisplay = ConfigYesNo(default=True)
            config.lcd.fblcddisplay.addNotifier(setfblcddisplay)
        else:
            config.lcd.fblcddisplay = ConfigNothing()
        if exists("/proc/stb/lcd/show_outputresolution"):

            def setLCDshowoutputresolution(configElement):
                ilcd.setShowoutputresolution(
                    "1" if configElement.value else "0")

            config.lcd.showoutputresolution = ConfigYesNo(default=True)
            config.lcd.showoutputresolution.addNotifier(
                setLCDshowoutputresolution)
        else:
            config.lcd.showoutputresolution = ConfigNothing()
        if model == "vuultimo":
            config.lcd.ledblinkingtime = ConfigSlider(default=5,
                                                      increment=1,
                                                      limits=(0, 15))
            config.lcd.ledblinkingtime.addNotifier(setLEDblinkingtime)
            config.lcd.ledbrightnessdeepstandby = ConfigSlider(default=1,
                                                               increment=1,
                                                               limits=(0, 15))
            config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDdeepstandby)
            config.lcd.ledbrightnessdeepstandby.apply = lambda: setLEDdeepstandby(
                config.lcd.ledbrightnessdeepstandby)
            config.lcd.ledbrightnessstandby = ConfigSlider(default=1,
                                                           increment=1,
                                                           limits=(0, 15))
            config.lcd.ledbrightnessstandby.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightnessstandby.apply = lambda: setLEDnormalstate(
                config.lcd.ledbrightnessstandby)
            config.lcd.ledbrightness = ConfigSlider(default=3,
                                                    increment=1,
                                                    limits=(0, 15))
            config.lcd.ledbrightness.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightness.apply = lambda: setLEDnormalstate(
                config.lcd.ledbrightness)
            config.lcd.ledbrightness.callNotifiersOnSaveAndCancel = True
        else:

            def doNothing():
                pass

            config.lcd.ledbrightness = ConfigNothing()
            config.lcd.ledbrightness.apply = lambda: doNothing()
            config.lcd.ledbrightnessstandby = ConfigNothing()
            config.lcd.ledbrightnessstandby.apply = lambda: doNothing()
            config.lcd.ledbrightnessdeepstandby = ConfigNothing()
            config.lcd.ledbrightnessdeepstandby.apply = lambda: doNothing()
            config.lcd.ledblinkingtime = ConfigNothing()
    else:

        def doNothing():
            pass

        config.lcd.contrast = ConfigNothing()
        config.lcd.bright = ConfigNothing()
        config.lcd.standby = ConfigNothing()
        config.lcd.bright.apply = lambda: doNothing()
        config.lcd.standby.apply = lambda: doNothing()
        config.lcd.power = ConfigNothing()
        config.lcd.fblcddisplay = ConfigNothing()
        config.lcd.mode = ConfigNothing()
        config.lcd.hdd = ConfigNothing()
        config.lcd.scroll_speed = ConfigSelection(choices=[("500", _("slow")),
                                                           ("300",
                                                            _("normal")),
                                                           ("100", _("fast"))],
                                                  default="300")
        config.lcd.scroll_delay = ConfigSelection(choices=[
            ("10000", "10 %s" % _("seconds")), ("20000",
                                                "20 %s" % _("seconds")),
            ("30000", "30 %s" % _("seconds")), ("60000", "1 %s" % _("minute")),
            ("300000", "5 %s" % _("minutes")), ("noscrolling", _("Off"))
        ],
                                                  default="10000")
        config.lcd.showoutputresolution = ConfigNothing()
        config.lcd.ledbrightness = ConfigNothing()
        config.lcd.ledbrightness.apply = lambda: doNothing()
        config.lcd.ledbrightnessstandby = ConfigNothing()
        config.lcd.ledbrightnessstandby.apply = lambda: doNothing()
        config.lcd.ledbrightnessdeepstandby = ConfigNothing()
        config.lcd.ledbrightnessdeepstandby.apply = lambda: doNothing()
        config.lcd.ledblinkingtime = ConfigNothing()

    config.misc.standbyCounter.addNotifier(standbyCounterChanged,
                                           initial_call=False)
Exemple #37
0
class BrowserPositionWindow(Screen, ConfigListScreen):
	skin = 	"""
		<screen position="0,0" size="%d,%d" title="Browser Position Setup" backgroundColor="#27d8dee2" >
			<ePixmap pixmap="skin_default/buttons/red.png" position="%d,%d" size="140,40" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="%d,%d" size="140,40" alphatest="on" />"

			<widget source="key_red" render="Label" position="%d,%d" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
			<widget source="key_green" render="Label" position="%d,%d" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />

			<widget name="config" zPosition="2" position="%d,%d" size="500,200" scrollbarMode="showOnDemand" foregroundColor="#1c1c1c" transparent="1" />
		</screen>
		"""
	def __init__(self, session):
		w,h   = session.desktop.size().width(), session.desktop.size().height()
		cw,ch = w/2, h/2
		#                             btn_red        btn_green     lb_red         lb_green      config
		self.skin = self.skin % (w,h, cw-190,ch-110, cw+50,ch-110, cw-190,ch-110, cw+50,ch-110, cw-250,ch-50)

		Screen.__init__(self,session)
		self.session = session
		self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions" ],
		{
			"ok": self.keyOk,
			"cancel": self.keyCancel,
			"red": self.keyCancel,
			"green": self.keyOk,
		}, -2)
		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session)

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Save"))
		self["current"] = StaticText(_(" "))
		vbcfg.g_position = vbcfg.getPosition()
		self.createSetup()

	def createSetup(self):
		self.list = []

		params = BrowserPositionSetting().getPosition()
		vbcfg.setPosition(params)

		left   = params[0]
		width  = params[1]
		top    = params[2]
		height = params[3]

		self.dst_left   = ConfigSlider(default = left, increment = 5, limits = (0, 720))
		self.dst_width  = ConfigSlider(default = width, increment = 5, limits = (0, 720))
		self.dst_top    = ConfigSlider(default = top, increment = 5, limits = (0, 576))
		self.dst_height = ConfigSlider(default = height, increment = 5, limits = (0, 576))

		self.dst_left_entry   = getConfigListEntry(_("left"), self.dst_left)
		self.dst_width_entry  = getConfigListEntry(_("width"), self.dst_width)
		self.dst_top_entry    = getConfigListEntry(_("top"), self.dst_top)
		self.dst_height_entry = getConfigListEntry(_("height"), self.dst_height)

		self.list.append(self.dst_left_entry)
		self.list.append(self.dst_width_entry)
		self.list.append(self.dst_top_entry)
		self.list.append(self.dst_height_entry)

		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def resetDisplay(self):
		for entry in self["config"].getList():
			self["config"].l.invalidateEntry(self["config"].getList().index(entry))

	def adjustBorder(self):
		if self["config"].getCurrent() == self.dst_left_entry:
			if self.dst_left.value + self.dst_width.value >720:
				self.dst_width.setValue(720-self.dst_left.value)
				self.resetDisplay()
		elif self["config"].getCurrent() == self.dst_width_entry:
			if self.dst_left.value + self.dst_width.value >720:
				self.dst_left.setValue(720-self.dst_width.value)
				self.resetDisplay()
		elif self["config"].getCurrent() == self.dst_top_entry:
			if self.dst_top.value + self.dst_height.value >576:
				self.dst_height.setValue(576-self.dst_top.value)
				self.resetDisplay()
		elif self["config"].getCurrent() == self.dst_height_entry:
			if self.dst_top.value + self.dst_height.value >576:
				self.dst_top.setValue(576-self.dst_height.value)
				self.resetDisplay()

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.adjustBorder()
		params = (int(self.dst_left.value), int(self.dst_width.value), int(self.dst_top.value), int(self.dst_height.value))
		vbcfg.setPosition(params)

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.adjustBorder()
		params = (int(self.dst_left.value), int(self.dst_width.value), int(self.dst_top.value), int(self.dst_height.value))
		vbcfg.setPosition(params)

	def keyOk(self):
		params = (int(self.dst_left.value), int(self.dst_width.value), int(self.dst_top.value), int(self.dst_height.value))
		BrowserPositionSetting().setPosition(params)
		vbcfg.setPosition(vbcfg.g_position)
		self.close()

	def keyCancel(self):
		if self["config"].isChanged():
			self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
		else:
			vbcfg.setPosition(vbcfg.g_position)
			self.close()

	def cancelConfirm(self,ret):
		if ret:
			vbcfg.setPosition(vbcfg.g_position)
			self.close()
	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()
Exemple #39
0
class OSDScreenPosition(Screen, ConfigListScreen):
	skin = """
	<screen position="0,0" size="e,e" title="OSD position setup" backgroundColor="blue">
		<widget name="config" position="c-175,c-75" size="350,150" foregroundColor="black" backgroundColor="blue" />
		<ePixmap pixmap="buttons/green.png" position="c-145,e-100" zPosition="0" size="140,40" alphatest="on" />
		<ePixmap pixmap="buttons/red.png" position="c+5,e-100" zPosition="0" size="140,40" alphatest="on" />
		<widget name="ok" position="c-145,e-100" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="green" />
		<widget name="cancel" position="c+5,e-100" size="140,40" valign="center" halign="center" zPosition="1" font="Regular;20" transparent="1" backgroundColor="red" />
	</screen>"""

	def __init__(self, session):
		self.skin = OSDScreenPosition.skin
		Screen.__init__(self, session)

		from Components.ActionMap import ActionMap
		from Components.Button import Button

		self["ok"] = Button(_("OK"))
		self["cancel"] = Button(_("Cancel"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"green": self.keyGo,
			"red": self.keyCancel,
			"menu": self.closeRecursive,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session)

		left = config.plugins.OSDPositionSetup.dst_left.getValue()
		width = config.plugins.OSDPositionSetup.dst_width.getValue()
		top = config.plugins.OSDPositionSetup.dst_top.getValue()
		height = config.plugins.OSDPositionSetup.dst_height.getValue()

		self.dst_left = ConfigSlider(default = left, increment = 1, limits = (0, 720))
		self.dst_width = ConfigSlider(default = width, increment = 1, limits = (0, 720))
		self.dst_top = ConfigSlider(default = top, increment = 1, limits = (0, 576))
		self.dst_height = ConfigSlider(default = height, increment = 1, limits = (0, 576))
		self.list.append(getConfigListEntry(_("left"), self.dst_left))
		self.list.append(getConfigListEntry(_("width"), self.dst_width))
		self.list.append(getConfigListEntry(_("top"), self.dst_top))
		self.list.append(getConfigListEntry(_("height"), self.dst_height))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		self.setPreviewPosition()

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		self.setPreviewPosition()

	def setPreviewPosition(self):
		setPosition(int(self.dst_left.getValue()), int(self.dst_width.getValue()), int(self.dst_top.getValue()), int(self.dst_height.getValue()))

	def keyGo(self):
		config.plugins.OSDPositionSetup.dst_left.value = self.dst_left.getValue()
		config.plugins.OSDPositionSetup.dst_width.value = self.dst_width.getValue()
		config.plugins.OSDPositionSetup.dst_top.value = self.dst_top.getValue()
		config.plugins.OSDPositionSetup.dst_height.value = self.dst_height.getValue()
		config.plugins.OSDPositionSetup.save()
		self.close()

	def keyCancel(self):
		setConfiguredPosition()
		self.close()
 def __init__(self, item, sub_page, increment=5):
     SitemapWidget.__init__(self, item, sub_page)
     ConfigSlider.__init__(self, default=int(item["state"]), increment=increment, limits=(SliderWidget.MIN_VAL, SliderWidget.MAX_VAL))