Exemplo n.º 1
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    config.av.yuvenabled = ConfigBoolean(default=False)
    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.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="4_3_letterbox")

    config.av.aspect = ConfigSelection(choices={
        "4_3": _("4:3"),
        "16_9": _("16:9"),
        "16_10": _("16:10"),
        "auto": _("Automatic")
    },
                                       default="auto")
    config.av.policy_169 = ConfigSelection(
        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: display as fullscreen, even if this breaks the aspect)
            "scale": _("Just Scale")
        },
        default="letterbox")
    config.av.policy_43 = ConfigSelection(
        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: display as fullscreen, with stretching the left/right)
            "nonlinear": _("Nonlinear"),
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
            "scale": _("Just Scale")
        },
        default="pillarbox")
    config.av.tvsystem = ConfigSelection(choices={
        "pal": _("PAL"),
        "ntsc": _("NTSC"),
        "multinorm": _("multinorm")
    },
                                         default="pal")
    config.av.wss = ConfigEnableDisable(default=True)
    config.av.defaultac3 = ConfigYesNo(default=False)
    config.av.generalAC3delay = ConfigNumber(default=0)
    config.av.generalPCMdelay = ConfigNumber(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()

    try:
        can_downmix = open("/proc/stb/audio/ac3_choices",
                           "r").read()[:-1].find("downmix") != -1
    except:
        can_downmix = False

    SystemInfo["CanDownmixAC3"] = can_downmix
    if can_downmix:

        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)

    try:
        can_osd_alpha = open("/proc/stb/video/alpha", "r") and True or False
    except:
        can_osd_alpha = False

    SystemInfo["CanChangeOsdAlpha"] = can_osd_alpha

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

    if can_osd_alpha:
        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)
Exemplo n.º 2
0
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, limits=(0,255)) # Make openATV 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.getValue():
		colorformat_choices["yuv"] = _("YPbPr")

	config.av.autores = ConfigSelection(choices={"disabled": _("Disabled"), "all": _("All resolutions"), "hd": _("only HD")}, default="disabled")
	choicelist = []
	for i in 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 = 50, max = 3000, stepwidth = 50, default = 400, wraparound = True)
	config.av.autores_deinterlace = ConfigYesNo(default=False)
	config.av.autores_sd = ConfigSelection(choices={"720p": _("720p"), "1080i": _("1080i")}, default="720p")
	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.smart1080p = ConfigEnableDisable(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")
	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: display as fullscreen, even if this breaks the aspect)
	"scale": _("Just scale")}
	if os.path.exists("/proc/stb/video/policy2_choices"):
		f = open("/proc/stb/video/policy2_choices")
		if "auto" in f.readline():
			# TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
			policy2_choices.update({"auto": _("Auto")})
		f.close()	
	config.av.policy_169 = ConfigSelection(choices=policy2_choices, default = "letterbox")
	policy_choices = {
	# TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
	"panscan": _("Pillarbox"),
	# TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
	"letterbox": _("Pan&scan"),
	# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
	# "nonlinear": _("Nonlinear"),
	# TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
	"bestfit": _("Just scale")}
	if os.path.exists("/proc/stb/video/policy_choices"):
		f = open("/proc/stb/video/policy_choices")
		if "auto" in f.readline():
			# TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
			policy_choices.update({"auto": _("Auto")})
		f.close()
	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.getValue() == "Scart-YPbPr":
			iAVSwitch.setColorFormat(3)
		elif config.av.videoport and config.av.videoport.getValue() == "YPbPr" or getMachineBuild() == 'inihdx':
			iAVSwitch.setColorFormat(3)
		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.getValue()])

	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.getValue()])
	
	config.av.colorformat.addNotifier(setColorFormat)
	
	iAVSwitch.setInput("ENCODER") # init on startup
	if (getBoxType() in ('gbquad', 'gbquadplus', 'et5x00', 'ixussone', 'ixusszero', 'e3hd', 'odinm6', 'omtimussos1', 'omtimussos2', 'gb800seplus', 'gb800ueplus' )) 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")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.bypass_edid_checking = ConfigSelection(choices={
				"00000000": _("off"),
				"00000001": _("on")},
				default = "00000000")
		config.av.bypass_edid_checking.addNotifier(setEDIDBypass)
	else:
		config.av.bypass_edid_checking = 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/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 setAutoVulume(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(setAutoVulume)
	else:
		config.av.autovolume = ConfigNothing()		

	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["CanDownmixAC3"] = can_downmix_ac3
	if can_downmix_ac3:
		def setAC3Downmix(configElement):
			f = open("/proc/stb/audio/ac3", "w")
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		config.av.downmix_ac3 = ConfigYesNo(default = True)
		config.av.downmix_ac3.addNotifier(setAC3Downmix)

	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")
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		config.av.downmix_aac = ConfigYesNo(default = True)
		config.av.downmix_aac.addNotifier(setAACDownmix)

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

		if getBoxType() == 'gbquad' or getBoxType() == '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())

	config.av.edid_override = ConfigYesNo(default = False)

	iAVSwitch.setConfiguredMode()
Exemplo n.º 3
0
	}

config.hdmicec = ConfigSubsection()
config.hdmicec.enabled = ConfigYesNo(default = False)
config.hdmicec.control_tv_standby = ConfigYesNo(default = True)
config.hdmicec.control_tv_wakeup = ConfigYesNo(default = True)
config.hdmicec.report_active_source = ConfigYesNo(default = True)
config.hdmicec.report_active_menu = ConfigYesNo(default = True)
config.hdmicec.handle_tv_standby = ConfigYesNo(default = True)
config.hdmicec.handle_tv_wakeup = ConfigYesNo(default = True)
config.hdmicec.tv_wakeup_detection = ConfigSelection(
	choices = {
	"wakeup": _("Wakeup"),
	"requestphysicaladdress": _("Request for physical address report"),
	"tvreportphysicaladdress": _("TV physical address report"),
	"sourcerequest": _("Source request"),
	"streamrequest": _("Stream request"),
	"requestvendor":  _("Request for vendor report"),
	"osdnamerequest": _("OSD name request"),
	"activity": _("Any activity"),
	},
	default = "streamrequest")
config.hdmicec.fixed_physical_address = ConfigText(default = "0.0.0.0")
config.hdmicec.volume_forwarding = ConfigYesNo(default = False)
config.hdmicec.control_receiver_wakeup = ConfigYesNo(default = False)
config.hdmicec.control_receiver_standby = ConfigYesNo(default = False)
config.hdmicec.handle_deepstandby_events = ConfigYesNo(default = False)
choicelist = []
for i in (10, 50, 100, 150, 250, 500, 750, 1000):
	choicelist.append(("%d" % i, _("%d ms") % i))
config.hdmicec.minimum_send_interval = ConfigSelection(default = "0", choices = [("0", _("Disabled"))] + choicelist)
choicelist = []
Exemplo n.º 4
0
def InitLcd():
	if HardwareInfo().get_device_name() in ('gb800se', 'gb800solo', 'gb800seplus', 'gbipbox', 'gbultra', 'gbultrase', 'tomcat', 'quadbox2400', 'gbx1'):
		detected = False
	else:
		detected = eDBoxLCD.getInstance().detected()
	SystemInfo["Display"] = detected
	config.lcd = ConfigSubsection();

	if fileExists("/proc/stb/lcd/mode"):
		f = open("/proc/stb/lcd/mode", "r")
		can_lcdmodechecking = f.read().strip().split(" ")
		f.close()
	else:
		can_lcdmodechecking = False
	
	SystemInfo["LCDMiniTV"] = can_lcdmodechecking

	if detected:
		if can_lcdmodechecking:
			def setLCDModeMinitTV(configElement):
				try:
					f = open("/proc/stb/lcd/mode", "w")
					f.write(configElement.value)
					f.close()
				except:
					pass
			def setMiniTVFPS(configElement):
				try:
					f = open("/proc/stb/lcd/fps", "w")
					f.write("%d \n" % configElement.value)
					f.close()
				except:
					pass
			def setLCDModePiP(configElement):
				pass

			config.lcd.modepip = ConfigSelection(choices={
					"0": _("off"),
					"5": _("PIP"),
					"7": _("PIP with OSD")},
					default = "0")
			if HardwareInfo().get_device_name() in ('gbquad', 'gbquadplus'):
				config.lcd.modepip.addNotifier(setLCDModePiP)
			else:
				config.lcd.modepip = ConfigNothing()

			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.modepip = 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 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["LcdLiveTV"]:
			def lcdLiveTvChanged(configElement):
				open(SystemInfo["LcdLiveTV"], "w").write(configElement.value and "0" or "1")
				InfoBarInstance = InfoBar.instance
				InfoBarInstance and InfoBarInstance.session.open(dummyScreen)
			config.lcd.showTv = ConfigYesNo(default = False)
			config.lcd.showTv.addNotifier(lcdLiveTvChanged)
	else:
		def doNothing():
			pass
		config.lcd.contrast = ConfigNothing()
		config.lcd.bright = ConfigNothing()
		config.lcd.standby = ConfigNothing()
		config.lcd.scroll_speed = ConfigSelection(choices = [("300", _("normal"))])
		config.lcd.scroll_delay = ConfigSelection(choices = [("noscrolling", _("off"))])
		config.lcd.bright.apply = lambda : doNothing()
		config.lcd.standby.apply = lambda : doNothing()

	config.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False)
Exemplo n.º 5
0
from Tools.Directories import fileExists


config.hdmicec = ConfigSubsection()
config.hdmicec.enabled = ConfigYesNo(default = False)
config.hdmicec.control_tv_standby = ConfigYesNo(default = True)
config.hdmicec.control_tv_wakeup = ConfigYesNo(default = True)
config.hdmicec.report_active_source = ConfigYesNo(default = True)
config.hdmicec.report_active_menu = ConfigYesNo(default = True)
config.hdmicec.handle_tv_standby = ConfigYesNo(default = True)
config.hdmicec.handle_tv_wakeup = ConfigYesNo(default = True)
config.hdmicec.tv_wakeup_detection = ConfigSelection(
	choices = {
	"wakeup": _("Wakeup"),
	"tvreportphysicaladdress": _("TV physical address report"),
	"sourcerequest": _("Source request"),
	"streamrequest": _("Stream request"),
	"osdnamerequest": _("OSD name request"),
	"activity": _("Any activity"),
	},
	default = "streamrequest")
config.hdmicec.fixed_physical_address = ConfigText(default = "0.0.0.0")
config.hdmicec.volume_forwarding = ConfigYesNo(default = False)
config.hdmicec.control_receiver_wakeup = ConfigYesNo(default = False)
config.hdmicec.control_receiver_standby = ConfigYesNo(default = False)
config.hdmicec.handle_deepstandby_events = ConfigYesNo(default = False)
config.hdmicec.preemphasis = ConfigYesNo(default = False)	
choicelist = []
for i in (10, 50, 100, 150, 250):
	choicelist.append(("%d" % i, "%d ms" % i))
config.hdmicec.minimum_send_interval = ConfigSelection(default = "0", choices = [("0", _("Disabled"))] + choicelist)
Exemplo n.º 6
0
	def createConfig(self, *args):
		hw_type = HardwareInfo().get_device_name()
		has_hdmi = HardwareInfo().has_hdmi()
		lst = []

		config.av.videomode = ConfigSubDict()
		config.av.autores_mode_sd = ConfigSubDict()
		config.av.autores_mode_hd = ConfigSubDict()
		config.av.autores_mode_fhd = ConfigSubDict()
		config.av.autores_mode_uhd = ConfigSubDict()
		config.av.videorate = ConfigSubDict()
		config.av.autores_rate_sd = ConfigSubDict()
		config.av.autores_rate_hd = ConfigSubDict()
		config.av.autores_rate_fhd = ConfigSubDict()
		config.av.autores_rate_uhd = ConfigSubDict()

		# create list of output ports
		portlist = self.getPortList()
		for port in portlist:
			descr = port
			if 'HDMI' in port:
				lst.insert(0, (port, descr))
			else:
				lst.append((port, descr))

			modes = self.getModeList(port)
			if len(modes):
				config.av.videomode[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_sd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_hd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_fhd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_uhd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
			for (mode, rates) in modes:
				ratelist = []
				for rate in rates:
					if rate in ("auto") and not SystemInfo["have24hz"]:
						continue
					ratelist.append((rate, rate))
				config.av.videorate[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_sd[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_hd[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_fhd[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_uhd[mode] = ConfigSelection(choices = ratelist)
		config.av.videoport = ConfigSelection(choices = lst)
Exemplo n.º 7
0
def InitAVSwitch():
	config.av = ConfigSubsection()
	config.av.yuvenabled = ConfigBoolean(default=True)
	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.getValue():
		colorformat_choices["yuv"] = _("YPbPr")

	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 = "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: display as fullscreen, even if this breaks the aspect)
	"scale": _("Just Scale")}
	if os.path.exists("/proc/stb/video/policy2_choices") and "auto" in open("/proc/stb/video/policy2_choices").readline():
		# TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
		policy2_choices.update({"auto": _("Auto")})
	config.av.policy_169 = ConfigSelection(choices=policy2_choices, default = "letterbox")
	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: display as fullscreen, with stretching the left/right)
	"nonlinear": _("Nonlinear"),
	# TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
	"scale": _("Just Scale")}
	if os.path.exists("/proc/stb/video/policy_choices") and "auto" in open("/proc/stb/video/policy_choices").readline():
		# TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
		policy_choices.update({"auto": _("Auto")})
	config.av.policy_43 = ConfigSelection(choices=policy_choices, default = "pillarbox")
	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()

	try:
		can_downmix = open("/proc/stb/audio/ac3_choices", "r").read()[:-1].find("downmix") != -1
	except:
		can_downmix = False

	SystemInfo["CanDownmixAC3"] = can_downmix
	if can_downmix:
		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 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
				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 "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())
Exemplo n.º 8
0
def InitLcd():
    if SystemInfo["FirstCheckModel"] or getBoxType() in (
            "force4", "viperslim", "lunix4k", "vipert2c", "evoslimse",
            "evoslimt2c", "tmtwin4k", "evoslim", "ultrabox", "i55", "dm520",
            "hd11", "sf98", "et7000mini", "xpeedc", "beyonwizt2", "gb800se",
            "gb800solo", "gb800seplus", "gbultrase", "gbipbox", "tmsingle",
            "tmnano2super", "iqonios300hd", "iqonios300hdv2",
            "optimussos1plus", "optimussos1", "vusolo", "et4x00", "et5x00",
            "et6x00", "et7x00", "ebox7358", "eboxlumi", "gbx1", "gbx2", "gbx3",
            "gbx3h"):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()
    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if fileExists("/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 'setLCDModeMinitTV', configElement.value
                    open("/proc/stb/lcd/mode", "w").write(configElement.value)
                except:
                    pass

            def setMiniTVFPS(configElement):
                try:
                    print 'setMiniTVFPS', configElement.value
                    open("/proc/stb/lcd/fps", "w").write(configElement.value)
                except:
                    pass

            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")
            if SystemInfo["GigaBlueQuad"]:
                config.lcd.modepip.addNotifier(setLCDModePiP)
            else:
                config.lcd.modepip = ConfigNothing()
            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"):
                open("/proc/stb/power/powerled",
                     "w").write(configElement.value)

        def setPowerLEDstanbystate(configElement):
            if fileExists("/proc/stb/power/standbyled"):
                open("/proc/stb/power/standbyled",
                     "w").write(configElement.value)

        def setPowerLEDdeepstanbystate(configElement):
            if fileExists("/proc/stb/power/suspendled"):
                open("/proc/stb/power/suspendled",
                     "w").write(configElement.value)

        def setLedPowerColor(configElement):
            if fileExists("/proc/stb/fp/ledpowercolor"):
                open("/proc/stb/fp/ledpowercolor",
                     "w").write(configElement.value)

        def setLedStandbyColor(configElement):
            if fileExists("/proc/stb/fp/ledstandbycolor"):
                open("/proc/stb/fp/ledstandbycolor",
                     "w").write(configElement.value)

        def setLedSuspendColor(configElement):
            if fileExists("/proc/stb/fp/ledsuspendledcolor"):
                open("/proc/stb/fp/ledsuspendledcolor",
                     "w").write(configElement.value)

        def setPower4x7On(configElement):
            if fileExists("/proc/stb/fp/power4x7on"):
                open("/proc/stb/fp/power4x7on", "w").write(configElement.value)

        def setPower4x7Standby(configElement):
            if fileExists("/proc/stb/fp/power4x7standby"):
                open("/proc/stb/fp/power4x7standby",
                     "w").write(configElement.value)

        def setPower4x7Suspend(configElement):
            if fileExists("/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"):
                open("/sys/module/brcmstb_osmega/parameters/pt6302_cgram",
                     "w").write(configElement.value)
            if fileExists(
                    "/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"
            ):
                open(
                    "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram",
                    "w").write(configElement.value)
            if fileExists(
                    "/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_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.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 = ConfigSelection(default="on",
                                                      choices=[
                                                          ("off", _("Off")),
                                                          ("on", _("On"))
                                                      ])
        config.usage.lcd_power4x7on.addNotifier(setPower4x7On)

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

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

        if getBoxType() in ("dm900", "dm920", "e4hdultra", "protek4k"):
            standby_default = 4
        elif SystemInfo["DifferentLCDSettings"]:
            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 getBoxType() in ("h3", "ebox5000", "ebox5100", "sh1", "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 SystemInfo["DifferentLCDSettings"]:
            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"]:
                    open(SystemInfo["LcdLiveTV"],
                         "w").write(configElement.value and "enable"
                                    or "disable")
                else:
                    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 not SystemInfo[
                "GigaBlueQuad"] and not SystemInfo["GigaBlueAudio"]:
            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):
                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):
                # 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):
                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):
                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 getBoxType() == "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)
Exemplo n.º 9
0
config.hdmicec = ConfigSubsection()
config.hdmicec.enabled = ConfigYesNo(default=False)
config.hdmicec.control_tv_standby = ConfigYesNo(default=True)
config.hdmicec.control_tv_wakeup = ConfigYesNo(default=True)
config.hdmicec.report_active_source = ConfigYesNo(default=True)
config.hdmicec.report_active_menu = ConfigYesNo(default=True)
config.hdmicec.handle_tv_standby = ConfigYesNo(default=True)
config.hdmicec.handle_tv_wakeup = ConfigYesNo(default=True)
config.hdmicec.tv_wakeup_detection = ConfigSelection(choices={
    "wakeup":
    _("Wakeup"),
    "tvreportphysicaladdress":
    _("TV physical address report"),
    "sourcerequest":
    _("Source request"),
    "streamrequest":
    _("Stream request"),
    "osdnamerequest":
    _("OSD name request"),
    "activity":
    _("Any activity"),
},
                                                     default="streamrequest")
config.hdmicec.fixed_physical_address = ConfigText(default="0.0.0.0")
config.hdmicec.volume_forwarding = ConfigYesNo(default=False)
config.hdmicec.control_receiver_wakeup = ConfigYesNo(default=False)
config.hdmicec.control_receiver_standby = ConfigYesNo(default=False)
config.hdmicec.handle_deepstandby_events = ConfigYesNo(default=False)


class HdmiCec:
Exemplo n.º 10
0
class LCD:
	def __init__(self):
		eActionMap.getInstance().bindAction('', -maxint -1, self.DimUpEvent)
		self.autoDimDownLCDTimer = eTimer()
		self.autoDimDownLCDTimer.callback.append(self.autoDimDownLCD)
		self.autoDimUpLCDTimer = eTimer()
		self.autoDimUpLCDTimer.callback.append(self.autoDimUpLCD)
		self.currBrightness = self.dimBrightness = self.Brightness = None
		self.dimDelay = 0
		config.misc.standbyCounter.addNotifier(self.standbyCounterChanged, initial_call = False)

	def standbyCounterChanged(self, configElement):
		Screens.Standby.inStandby.onClose.append(self.leaveStandby)
		self.autoDimDownLCDTimer.stop()
		self.autoDimUpLCDTimer.stop()
		eActionMap.getInstance().unbindAction('', self.DimUpEvent)

	def leaveStandby(self):
		eActionMap.getInstance().bindAction('', -maxint -1, self.DimUpEvent)

	def DimUpEvent(self, key, flag):
		self.autoDimDownLCDTimer.stop()
		if not Screens.Standby.inTryQuitMainloop:
			if self.Brightness is not None and not self.autoDimUpLCDTimer.isActive():
				self.autoDimUpLCDTimer.start(10, True)

	def autoDimDownLCD(self):
		if not Screens.Standby.inTryQuitMainloop:
			if self.dimBrightness is not None and  self.currBrightness > self.dimBrightness:
				self.currBrightness = self.currBrightness - 1
				eDBoxLCD.getInstance().setLCDBrightness(self.currBrightness)
				self.autoDimDownLCDTimer.start(10, True)

	def autoDimUpLCD(self):
		if not Screens.Standby.inTryQuitMainloop:
			self.autoDimDownLCDTimer.stop()
			if self.currBrightness < self.Brightness:
				self.currBrightness = self.currBrightness + 5
				if self.currBrightness >= self.Brightness:
					self.currBrightness = self.Brightness
				eDBoxLCD.getInstance().setLCDBrightness(self.currBrightness)
				self.autoDimUpLCDTimer.start(10, True)
			else:
				if self.dimBrightness is not None and self.currBrightness > self.dimBrightness and self.dimDelay is not None and self.dimDelay > 0:
					self.autoDimDownLCDTimer.startLongTimer(self.dimDelay)

	def setBright(self, value):
		value *= 255
		value /= 10
		if value > 255:
			value = 255
		self.autoDimDownLCDTimer.stop()
		self.autoDimUpLCDTimer.stop()
		self.currBrightness = self.Brightness = value
		eDBoxLCD.getInstance().setLCDBrightness(self.currBrightness)
		if self.dimBrightness is not None and  self.currBrightness > self.dimBrightness:
			if self.dimDelay is not None and self.dimDelay > 0:
				self.autoDimDownLCDTimer.startLongTimer(self.dimDelay)

	def setStandbyBright(self, value):
		value *= 255
		value /= 10
		if value > 255:
			value = 255
		self.autoDimDownLCDTimer.stop()
		self.autoDimUpLCDTimer.stop()
		self.Brightness = value
		if self.dimBrightness is None:
			self.dimBrightness = value
		if self.currBrightness is None:
			self.currBrightness = value
		eDBoxLCD.getInstance().setLCDBrightness(self.Brightness)

	def setDimBright(self, value):
		value *= 255
		value /= 10
		if value > 255:
			value = 255
		self.dimBrightness = value

	def setDimDelay(self, value):
		self.dimDelay = int(value)

	def setContrast(self, value):
		value *= 63
		value /= 20
		if value > 63:
			value = 63
		eDBoxLCD.getInstance().setLCDContrast(value)

	def setInverted(self, value):
		if value:
			value = 255
		eDBoxLCD.getInstance().setInverted(value)

	def setFlipped(self, value):
		eDBoxLCD.getInstance().setFlipped(value)

	def setScreenShot(self, value):
 		eDBoxLCD.getInstance().setDump(value)

	def isOled(self):
		return eDBoxLCD.getInstance().isOled()

	def setMode(self, value):
		if fileExists("/proc/stb/lcd/show_symbols"):
			print 'setLCDMode',value
			f = open("/proc/stb/lcd/show_symbols", "w")
			f.write(value)
			f.close()
		if config.lcd.mode.value == "0":
			SystemInfo["SeekStatePlay"] = False
			SystemInfo["StatePlayPause"] = False
			if fileExists("/proc/stb/lcd/symbol_hdd"):
				f = open("/proc/stb/lcd/symbol_hdd", "w")
				f.write("0")
				f.close()
			if fileExists("/proc/stb/lcd/symbol_hddprogress"):
				f = open("/proc/stb/lcd/symbol_hddprogress", "w")
				f.write("0")
				f.close()
			if fileExists("/proc/stb/lcd/symbol_network"):
				f = open("/proc/stb/lcd/symbol_network", "w")
				f.write("0")
				f.close()
			if fileExists("/proc/stb/lcd/symbol_signal"):
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write("0")
				f.close()
			if fileExists("/proc/stb/lcd/symbol_timeshift"):
				f = open("/proc/stb/lcd/symbol_timeshift", "w")
				f.write("0")
				f.close()
			if fileExists("/proc/stb/lcd/symbol_tv"):
				f = open("/proc/stb/lcd/symbol_tv", "w")
				f.write("0")
				f.close()
			if fileExists("/proc/stb/lcd/symbol_usb"):
				f = open("/proc/stb/lcd/symbol_usb", "w")
				f.write("0")
				f.close()

	def setPower(self, value):
		if fileExists("/proc/stb/power/vfd"):
			print 'setLCDPower',value
			f = open("/proc/stb/power/vfd", "w")
			f.write(value)
			f.close()
		elif fileExists("/proc/stb/lcd/vfd"):
			print 'setLCDPower',value
			f = open("/proc/stb/lcd/vfd", "w")
			f.write(value)
			f.close()

	def setShowoutputresolution(self, value):
		if fileExists("/proc/stb/lcd/show_outputresolution"):
			print 'setLCDShowoutputresolution',value
			f = open("/proc/stb/lcd/show_outputresolution", "w")
			f.write(value)
			f.close()

	def setfblcddisplay(self, value):
		print 'setfblcddisplay',value
		f = open("/proc/stb/fb/sd_detach", "w")
		f.write(value)
		f.close()

	def setRepeat(self, value):
		if fileExists("/proc/stb/lcd/scroll_repeats"):
			print 'setLCDRepeat',value
			f = open("/proc/stb/lcd/scroll_repeats", "w")
			f.write(value)
			f.close()

	def setScrollspeed(self, value):
		if fileExists("/proc/stb/lcd/scroll_delay"):
			print 'setLCDScrollspeed',value
			f = open("/proc/stb/lcd/scroll_delay", "w")
			f.write(str(value))
			f.close()

	def setLEDNormalState(self, value):
		eDBoxLCD.getInstance().setLED(value, 0)

	def setLEDDeepStandbyState(self, value):
		eDBoxLCD.getInstance().setLED(value, 1)

	def setLEDBlinkingTime(self, value):
		eDBoxLCD.getInstance().setLED(value, 2)

	def setPowerLEDstanbystate(configElement):
		if fileExists("/proc/stb/power/standbyled"):
			f = open("/proc/stb/power/standbyled", "w")
			f.write(configElement.value)
			f.close()

	def setPowerLEDstate(configElement):
		if fileExists("/proc/stb/power/powerled"):
			f = open("/proc/stb/power/powerled", "w")
			f.write(configElement.value)
			f.close()

	def setPowerLEDstate2(configElement):
		if fileExists("/proc/stb/power/powerled2"):
			f = open("/proc/stb/power/powerled2", "w")
			f.write(configElement.value)
			f.close()

	def setPowerLEDdeepstanbystate(configElement):
		if fileExists("/proc/stb/power/suspendled"):
			f = open("/proc/stb/power/suspendled", "w")
			f.write(configElement.value)
			f.close()

	def setLedPowerColor(configElement):
		if fileExists("/proc/stb/fp/ledpowercolor"):
			f = open("/proc/stb/fp/ledpowercolor", "w")
			f.write(configElement.value)
			f.close()

	def setLedStandbyColor(configElement):
		if fileExists("/proc/stb/fp/ledstandbycolor"):
			f = open("/proc/stb/fp/ledstandbycolor", "w")
			f.write(configElement.value)
			f.close()

	def setLedSuspendColor(configElement):
		if fileExists("/proc/stb/fp/ledsuspendledcolor"):
			f = open("/proc/stb/fp/ledsuspendledcolor", "w")
			f.write(configElement.value)
			f.close()

	def setPower4x7On(configElement):
		if fileExists("/proc/stb/fp/power4x7on"):
			f = open("/proc/stb/fp/power4x7on", "w")
			f.write(configElement.value)
			f.close()

	def setPower4x7Standby(configElement):
		if fileExists("/proc/stb/fp/power4x7standby"):
			f = open("/proc/stb/fp/power4x7standby", "w")
			f.write(configElement.value)
			f.close()

	def setPower4x7Suspend(configElement):
		if fileExists("/proc/stb/fp/power4x7suspend"):
			f = open("/proc/stb/fp/power4x7suspend", "w")
			f.write(configElement.value)
			f.close()

	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.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 = ConfigSelection(default = "on", choices = [("off", _("Off")), ("on", _("On"))])
	config.usage.lcd_power4x7on.addNotifier(setPower4x7On)

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

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

	def setLCDMiniTVMode(self, value):
		print 'setLCDMiniTVMode',value
		f = open('/proc/stb/lcd/mode', "w")
		f.write(value)
		f.close()

	def setLCDMiniTVPIPMode(self, value):
		print 'setLCDMiniTVPIPMode',value

	def setLCDMiniTVFPS(self, value):
		print 'setLCDMiniTVFPS',value
		f = open('/proc/stb/lcd/fps', "w")
		f.write("%d \n" % value)
		f.close()
Exemplo n.º 11
0
config.hdmicec = ConfigSubsection()
config.hdmicec.enabled = ConfigYesNo(default=True)
config.hdmicec.control_tv_standby = ConfigYesNo(default=True)
config.hdmicec.control_tv_wakeup = ConfigYesNo(default=True)
config.hdmicec.report_active_source = ConfigYesNo(default=True)
config.hdmicec.report_active_menu = ConfigYesNo(default=True)
config.hdmicec.handle_tv_standby = ConfigYesNo(default=True)
config.hdmicec.handle_tv_wakeup = ConfigYesNo(default=True)
config.hdmicec.tv_wakeup_detection = ConfigSelection(choices={
    'wakeup':
    _('Wakeup'),
    'tvreportphysicaladdress':
    _('TV physical address report'),
    'sourcerequest':
    _('Source request'),
    'streamrequest':
    _('Stream request'),
    'osdnamerequest':
    _('OSD name request'),
    'activity':
    _('Any activity')
},
                                                     default='streamrequest')
config.hdmicec.fixed_physical_address = ConfigText(default='0.0.0.0')
config.hdmicec.volume_forwarding = ConfigYesNo(default=False)
config.hdmicec.control_receiver_wakeup = ConfigYesNo(default=False)
config.hdmicec.control_receiver_standby = ConfigYesNo(default=False)
config.hdmicec.handle_deepstandby_events = ConfigYesNo(default=False)
config.hdmicec.preemphasis = ConfigYesNo(default=False)
choicelist = []
for i in (10, 50, 100, 150, 250, 500, 750, 1000, 1500, 2000):
Exemplo n.º 12
0
def InitUsageConfig():
    config.usage = ConfigSubsection()
    config.usage.showdish = ConfigYesNo(default=True)
    config.usage.multibouquet = ConfigYesNo(default=True)
    config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)

    config.usage.quickzap_bouquet_change = ConfigYesNo(default=True)
    config.usage.e1like_radio_mode = ConfigYesNo(default=True)
    config.usage.infobar_timeout = ConfigSelection(
        default="5",
        choices=[("0", _("no timeout")), ("1", "1 " + _("second")),
                 ("2", "2 " + _("seconds")), ("3", "3 " + _("seconds")),
                 ("4", "4 " + _("seconds")), ("5", "5 " + _("seconds")),
                 ("6", "6 " + _("seconds")), ("7", "7 " + _("seconds")),
                 ("8", "8 " + _("seconds")), ("9", "9 " + _("seconds")),
                 ("10", "10 " + _("seconds"))])
    config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
    config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
    config.usage.show_infobar_on_event_change = ConfigYesNo(default=True)
    config.usage.hdd_standby = ConfigSelection(
        default="60",
        choices=[("0", _("no standby")), ("10", "10 " + _("seconds")),
                 ("30", "30 " + _("seconds")), ("60", "1 " + _("minute")),
                 ("120", "2 " + _("minutes")), ("300", "5 " + _("minutes")),
                 ("600", "10 " + _("minutes")), ("1200", "20 " + _("minutes")),
                 ("1800", "30 " + _("minutes")), ("3600", "1 " + _("hour")),
                 ("7200", "2 " + _("hours")), ("14400", "4 " + _("hours"))])
    config.usage.output_12V = ConfigSelection(default="do not change",
                                              choices=[("do not change",
                                                        _("do not change")),
                                                       ("off", _("off")),
                                                       ("on", _("on"))])

    zero_button_choices = [("standard", _("standard")),
                           ("swap", _("swap PiP and main picture")),
                           ("swapstop", _("move PiP to main picture")),
                           ("stop", _("stop PiP")),
                           ("zap_focus", _("toggle zap focus"))]
    config.usage.pip_zero_button = ConfigSelection(default="swap",
                                                   choices=zero_button_choices)
    config.usage.pip_zero_button_doubleclick = ConfigSelection(
        default="zap_focus", choices=zero_button_choices)

    config.usage.default_path = ConfigText(default=resolveFilename(SCOPE_HDD))
    config.usage.timer_path = ConfigText(default="<default>")
    config.usage.instantrec_path = ConfigText(default="<default>")
    config.usage.timeshift_path = ConfigText(default="/media/hdd/")
    config.usage.allowed_timeshift_paths = ConfigLocations(
        default=["/media/hdd/"])

    config.usage.on_movie_start = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("resume", _("Resume from last position")),
                 ("beginning", _("Start from the beginning"))])
    config.usage.on_movie_stop = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service"))])
    config.usage.on_movie_eof = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service")),
                 ("pause", _("Pause movie at end")),
                 ("restart", _("Start from the beginning")),
                 ("playnext", _("Start next media file"))])

    config.usage.setup_level = ConfigSelection(default="expert",
                                               choices=[
                                                   ("simple", _("Simple")),
                                                   ("intermediate",
                                                    _("Intermediate")),
                                                   ("expert", _("Expert"))
                                               ])

    config.usage.on_long_powerpress = ConfigSelection(
        default="show_menu",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby")), ("restart", _("Restart")),
                 ("restart_gui", _("Restart GUI")),
                 ("nothing", _("do nothing"))])

    config.usage.on_short_powerpress = ConfigSelection(
        default="standby",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby")), ("restart", _("Restart")),
                 ("restart_gui", _("Restart GUI")),
                 ("nothing", _("do nothing"))])

    config.usage.alternatives_priority = ConfigSelection(
        default="0",
        choices=[("0", "DVB-S/-C/-T"), ("1", "DVB-S/-T/-C"),
                 ("2", "DVB-C/-S/-T"), ("3", "DVB-C/-T/-S"),
                 ("4", "DVB-T/-C/-S"), ("5", "DVB-T/-S/-C")])

    nims = [("-1", _("auto"))]
    for x in nimmanager.nim_slots:
        nims.append((str(x.slot), x.getSlotName()))
    config.usage.tuner_priority = ConfigSelection(default="-1", choices=nims)

    config.usage.show_event_progress_in_servicelist = ConfigYesNo(
        default=False)

    config.usage.blinking_display_clock_during_recording = ConfigYesNo(
        default=False)

    config.usage.show_message_when_recording_starts = ConfigYesNo(default=True)

    config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(
        default=True)

    def TunerTypePriorityOrderChanged(configElement):
        setTunerTypePriorityOrder(int(configElement.value))

    config.usage.alternatives_priority.addNotifier(
        TunerTypePriorityOrderChanged, immediate_feedback=False)

    def PreferredTunerChanged(configElement):
        setPreferredTuner(int(configElement.value))

    config.usage.tuner_priority.addNotifier(PreferredTunerChanged)

    def setHDDStandby(configElement):
        for hdd in harddiskmanager.HDDList():
            hdd[1].setIdleTime(int(configElement.value))

    config.usage.hdd_standby.addNotifier(setHDDStandby,
                                         immediate_feedback=False)

    def set12VOutput(configElement):
        if configElement.value == "on":
            Misc_Options.getInstance().set_12V_output(1)
        elif configElement.value == "off":
            Misc_Options.getInstance().set_12V_output(0)

    config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)

    SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()

    config.usage.keymap = ConfigText(
        default=eEnv.resolve("${datadir}/enigma2/keymap.xml"))

    config.seek = ConfigSubsection()
    config.seek.selfdefined_13 = ConfigNumber(default=15)
    config.seek.selfdefined_46 = ConfigNumber(default=60)
    config.seek.selfdefined_79 = ConfigNumber(default=300)

    config.seek.speeds_forward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_backward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8],
                                              choices=[2, 4, 6, 8, 12, 16, 25])

    config.seek.enter_forward = ConfigSelection(default="2",
                                                choices=[
                                                    "2", "4", "6", "8", "12",
                                                    "16", "24", "32", "48",
                                                    "64", "96", "128"
                                                ])
    config.seek.enter_backward = ConfigSelection(default="1",
                                                 choices=[
                                                     "1", "2", "4", "6", "8",
                                                     "12", "16", "24", "32",
                                                     "48", "64", "96", "128"
                                                 ])

    config.seek.on_pause = ConfigSelection(default="play",
                                           choices=[("play", _("Play")),
                                                    ("step",
                                                     _("Singlestep (GOP)")),
                                                    ("last", _("Last speed"))])

    config.usage.timerlist_finished_timer_position = ConfigSelection(
        default="beginning",
        choices=[("beginning", _("at beginning")), ("end", _("at end"))])

    def updateEnterForward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_forward, configElement.value)

    config.seek.speeds_forward.addNotifier(updateEnterForward,
                                           immediate_feedback=False)

    def updateEnterBackward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_backward, configElement.value)

    config.seek.speeds_backward.addNotifier(updateEnterBackward,
                                            immediate_feedback=False)

    # VTI Settings start
    config.misc.placeholder = NoSave(
        ConfigSelection(default="1", choices=[("1", " ")]))
    config.misc.disable_auto_channel_list = ConfigYesNo(default=False)
    config.misc.allow_service_delete = ConfigYesNo(default=False)
    config.misc.ecm_info = ConfigYesNo(default=True)
    config.misc.enable_custom_mainmenu = ConfigYesNo(default=False)
    config.usage.enable_zaphistory = ConfigYesNo(default=True)
    config.usage.show_epg_progress_percent = ConfigYesNo(default=False)
    config.usage.servicelist_show_picon = ConfigSelection(
        default="0",
        choices=[
            ("0", _("off")),
            ("100", "100x60 px"),
            ("50", "50x30 px"),
            ("1", _("user defined")),
        ])
    config.usage.servicelist_picon_dir = ConfigDirectory(
        default="/usr/share/enigma2/picon")
    config.usage.servicelist_two_lines = ConfigYesNo(default=False)
    config.usage.servicelist_show_event_time = ConfigYesNo(default=False)
    config.usage.servicelist_mark_rec_service = ConfigYesNo(default=True)
    config.usage.servicelist_show_rec_service_symbol = ConfigYesNo(
        default=True)
    config.usage.servicelist_show_servicenumber = ConfigYesNo(default=True)
    config.usage.servicelist_name_width = ConfigInteger(default=200,
                                                        limits=(1, 1920))
    config.usage.servicelist_use_matrix = ConfigYesNo(default=False)
    config.usage.servicelist_show_next_event = ConfigYesNo(default=False)
    config.usage.servicelist_show_service_type_icon = ConfigYesNo(
        default=False)
    config.usage.servicelist_preview_mode = ConfigYesNo(default=False)
    config.usage.servicelist_hide_service_name = ConfigYesNo(default=False)

    rec_button_choices = \
     [
      ("record_menu", _("show record menu")),
      ("running_record", _("show running records")),
      ("timer_list", _("show timer list")),
      ("event_record", _("add recording (stop after current event)")),
      ("indefinitely_record", _("add recording (indefinitely)")),
      ("manualduration_record", _("add recording (enter recording duration)")),
      ("manualendtime_record", _("add recording (enter recording endtime)"))
     ]

    config.usage.rec_button = ConfigSelection(default="record_menu",
                                              choices=rec_button_choices)
    config.usage.rec_button_long = ConfigSelection(default="running_record",
                                                   choices=rec_button_choices)

    config.usage.remove_finished_timers = ConfigYesNo(default=True)
    config.usage.enable_eit_epg = ConfigYesNo(default=True)

    def setEITepg(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEITenabled(
            int(config.usage.enable_eit_epg.getValue()))

    config.usage.enable_eit_epg.addNotifier(setEITepg)
    config.usage.show_nownext_eit = ConfigYesNo(default=True)
    config.usage.show_old_epg = ConfigSelection(default="0",
                                                choices=[
                                                    ("0", _("off")),
                                                    ("3600", "1 h"),
                                                    ("21600", "6 h"),
                                                    ("43200", "12 h"),
                                                    ("86400", "24 h"),
                                                ])

    def setOldEPGBuffer(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setOldEPG(
            int(config.usage.show_old_epg.getValue()))

    config.usage.show_old_epg.addNotifier(setOldEPGBuffer)

    config.usage.epg_buffer = ConfigInteger(default=14, limits=(1, 28))

    def setEPGBufferDays(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEPGBuffer(
            config.usage.epg_buffer.getValue())

    config.usage.epg_buffer.addNotifier(setEPGBufferDays)
    epg_choices = [("eventview", _("Event Description")),
                   ("singleepg", _("Single Service EPG")),
                   ("multiepg", _("Multi EPG")),
                   ("epgbar", _("Service EPGBar"))]
    if os.path.exists(
            '/usr/lib/enigma2/python/Plugins/Extensions/GraphMultiEPG/plugin.py'
    ):
        epg_choices.append(("graphicalmultiepg", _("Graphical Multi EPG")))
    config.usage.epg_default_view = ConfigSelection(default="eventview",
                                                    choices=epg_choices)

    config.usage.enable_tt_caching = ConfigYesNo(default=True)

    def EnableTtCachingChanged(configElement):
        setEnableTtCachingOnOff(int(configElement.value))

    config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

    config.usage.stop_seek_eof = ConfigSelection(
        default="20",
        choices=[("0", _("off")), ("10", "10 " + _("seconds")),
                 ("20", "20 " + _("seconds")), ("30", "30 " + _("seconds")),
                 ("60", "60 " + _("seconds"))])

    def updateVideoDirChoice(configElement):
        tmp = configElement.value
        tmp.append(_("off"))
        tmp.append(_("last video"))
        if config.movielist.start_videodir.value in tmp:
            default = config.movielist.start_videodir.value
        else:
            default = _("last video")
        config.movielist.start_videodir.setChoices(tmp, default)

    tmp = config.movielist.videodirs.value
    tmp.append(_("off"))
    tmp.append(_("last video"))
    config.movielist.start_videodir = ConfigSelection(default=_("last video"),
                                                      choices=tmp)
    config.movielist.videodirs.addNotifier(updateVideoDirChoice)
    config.usage.movielist_folder_based_config = ConfigYesNo(default=True)
    config.usage.movielist_support_pig = ConfigYesNo(default=True)
    config.usage.movielist_last_played_movie = ConfigText(default="")
    config.usage.movielist_select_last_movie = ConfigYesNo(default=True)
    config.usage.movielist_resume_at_eof = ConfigYesNo(default=True)
    config.usage.movielist_show_cover = ConfigYesNo(default=True)
    config.usage.movielist_show_dir = ConfigYesNo(default=True)
    config.usage.movielist_show_trash_dir = ConfigYesNo(default=False)
    config.usage.movielist_use_trash_dir = ConfigYesNo(default=False)
    config.usage.movielist_show_icon = ConfigYesNo(default=True)
    config.usage.movielist_show_color = ConfigYesNo(default=True)
    config.usage.movielist_show_picon = ConfigYesNo(default=False)
    config.usage.movielist_show_channel_info = ConfigYesNo(default=True)
    config.usage.movielist_show_recording_date = ConfigYesNo(default=True)
    config.usage.movielist_show_file_size = ConfigYesNo(default=True)
    config.usage.movielist_only_day = ConfigYesNo(default=True)
    config.usage.movielist_show_last_stop_time = ConfigYesNo(default=False)
    config.usage.movielist_show_duration = ConfigYesNo(default=True)
    config.usage.movielist_duration_in_min = ConfigYesNo(default=True)
    config.usage.movielist_progress_seen = ConfigInteger(default=80,
                                                         limits=(40, 99))
    config.usage.movielist_leave_exit = ConfigYesNo(default=True)
    config.usage.movielist_ask_movie_del = ConfigYesNo(default=False)
    config.usage.movielist_show_progress = ConfigSelection(
        default="progress_bar",
        choices=[("progress_bar", _("progress bar")),
                 ("progress_percent", _("percent")),
                 ("progress_calculate", _("only calculate")),
                 ("progress_off", _("off"))])
    config.usage.timerlist_show_icon = ConfigYesNo(default=True)
    config.usage.timerlist_show_epg = ConfigYesNo(default=True)
    config.usage.timerlist_style = ConfigSelection(
        default="0",
        choices=[
            ("0", _("Default")),
            ("1", _("Style") + " 1"),
            ("2", _("Style") + " 2"),
            ("3", _("Style") + " 3"),
            ("4", _("Style") + " 4"),
            ("5", _("Style") + " 5"),
        ])
    config.usage.show_favourites_bouquetup = ConfigYesNo(default=False)
    config.usage.show_servicelist_at_modeswitch = ConfigYesNo(default=False)
    config.usage.use_pig = ConfigYesNo(default=False)
    config.usage.use_extended_pig = ConfigYesNo(default=False)
    config.usage.use_extended_pig_channelselection = ConfigYesNo(default=False)
    config.usage.show_infobar_on_splitscreen = ConfigYesNo(default=False)
    pip_modes = [("splitscreen", _("Split Screen")),
                 ("audiozap", _("Audio Zap")),
                 ("pip", _("Picture in Picture"))]
    config.usage.default_pip_mode = ConfigSelection(default="splitscreen",
                                                    choices=pip_modes)
    config.usage.default_zero_double_click_mode = ConfigSelection(
        default="pip", choices=pip_modes)
    default_timeout = SystemInfo["CanPiP"] and 500 or 50
    config.usage.zero_doubleclick_timeout = ConfigInteger(
        default=default_timeout, limits=(50, 5000))
    config.usage.zap_pip = ConfigYesNo(default=True)
    config.usage.zap_before_record = ConfigYesNo(default=False)
    config.usage.zap_notification_record = ConfigYesNo(default=True)
    if SystemInfo["CanPiP"]:
        config.usage.pip_in_EPGBar = ConfigYesNo(default=True)
    else:
        config.usage.pip_in_EPGBar = ConfigYesNo(default=False)
    config.usage.picon_dir = ConfigDirectory(
        default="/usr/share/enigma2/picon")
    config.usage.picon_scale = ConfigYesNo(default=True)
    config.usage.sort_menu_byname = ConfigYesNo(default=False)
    config.usage.sort_plugins_byname = ConfigYesNo(default=True)
    config.usage.numberzap_timeout = ConfigInteger(default=3000,
                                                   limits=(100, 20000))
    config.usage.numberzap_show_servicename = ConfigYesNo(default=True)
    config.usage.numberzap_show_picon = ConfigYesNo(default=True)
    config.usage.startup_service_leavestandby = ConfigYesNo(default=False)
    config.usage.overzap_notplayable = ConfigYesNo(default=False)
    config.usage.disable_tuner_error_popup = ConfigYesNo(default=False)
    config.usage.disable_infobar_timeout_okbutton = ConfigYesNo(default=False)
    config.usage.ask_timer_file_del = ConfigYesNo(default=True)
    config.usage.record_file_name_date_at_end = ConfigYesNo(default=False)
    config.usage.silent_rec_mode = ConfigYesNo(default=True)
    config.usage.vfd_scroll_delay = ConfigSelection(
        default="10000",
        choices=[("10000", "10 " + _("seconds")),
                 ("20000", "20 " + _("seconds")),
                 ("30000", "30 " + _("seconds")),
                 ("60000", "1 " + _("minute")),
                 ("300000", "5 " + _("minutes")), ("noscrolling", _("off"))])
    config.usage.vfd_scroll_speed = ConfigSelection(default="300",
                                                    choices=[
                                                        ("500", _("slow")),
                                                        ("300", _("normal")),
                                                        ("100", _("fast"))
                                                    ])

    def get_default_RC():
        device = HardwareInfoVu().get_device_name()
        if device == "duo2":
            return "2"
        elif device == "ultimo":
            return "1"
        return "0"

    config.usage.rc_style = ConfigSelection(
        default=get_default_RC(),
        choices=[("0", "Vu+ 1 (Duo, Solo, Uno, Solo2)"),
                 ("1", "Vu+ 2 (Ultimo)"), ("2", "Vu+ 3 (Duo2)")])
    config.usage.use_force_overwrite = ConfigYesNo(default=True)
    config.usage.use_package_conffile = ConfigYesNo(default=True)
    config.usage.use_rm_force_depends = ConfigYesNo(default=False)
    config.usage.use_rm_autoremove = ConfigYesNo(default=True)
    config.usage.check_for_updates = ConfigInteger(default=8, limits=(0, 24))
    config.usage.show_notification_for_updates = ConfigYesNo(default=True)
    config.usage.update_available = NoSave(ConfigYesNo(default=False))
    config.usage.blinking_rec_symbol_during_recording = ConfigYesNo(
        default=True)
    config.usage.enable_hbbtv_autostart = ConfigYesNo(default=True)
    config.subtitle = ConfigSubsection()
    config.subtitle.subtitlecolor = ConfigSelection(default="0",
                                                    choices=[
                                                        ("0", _("original")),
                                                        ("1", _("white")),
                                                        ("2", _("yellow")),
                                                        ("3",
                                                         _("dark yellow")),
                                                        ("4", _("red")),
                                                        ("5", _("green")),
                                                        ("6", _("cyan")),
                                                        ("7", _("grey")),
                                                    ])
    config.subtitle.subtitlefontsize = ConfigSelection(choices=[
        "16", "18", "20", "22", "24", "26", "28", "30", "32", "34", "36", "38",
        "40", "42", "44", "46", "48", "50", "54", "58", "60"
    ],
                                                       default="30")
    config.subtitle.subtitlehalignment = ConfigSelection(
        choices=["left", "center", "right"], default="center")
    config.subtitle.dvbsubtitleyellow = ConfigYesNo(default=False)
    config.subtitle.dvbsubtitlecentered = ConfigYesNo(default=False)
    config.subtitle.dvbsubtitlebacktrans = ConfigSelection(
        default="0",
        choices=[("0", _("no transparency")), ("25", "10%"), ("50", "20%"),
                 ("75", "30%"), ("100", "40%"), ("125", "50%"), ("150", "60%"),
                 ("175", "70%"), ("200", "80%"), ("225", "90%"),
                 ("255", _("full transparency"))])
Exemplo n.º 13
0
def InitUsageConfig():
    config.usage = ConfigSubsection()
    config.usage.showdish = ConfigYesNo(default=True)
    config.usage.multibouquet = ConfigYesNo(default=True)
    config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)

    config.usage.quickzap_bouquet_change = ConfigYesNo(default=True)
    config.usage.e1like_radio_mode = ConfigYesNo(default=True)
    config.usage.infobar_timeout = ConfigSelection(
        default="5",
        choices=[("0", _("no timeout")), ("1", "1 " + _("second")),
                 ("2", "2 " + _("seconds")), ("3", "3 " + _("seconds")),
                 ("4", "4 " + _("seconds")), ("5", "5 " + _("seconds")),
                 ("6", "6 " + _("seconds")), ("7", "7 " + _("seconds")),
                 ("8", "8 " + _("seconds")), ("9", "9 " + _("seconds")),
                 ("10", "10 " + _("seconds"))])
    config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
    config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
    config.usage.show_infobar_on_event_change = ConfigYesNo(default=True)
    config.usage.hdd_standby = ConfigSelection(
        default="1200",
        choices=[("0", _("no standby")), ("10", "10 " + _("seconds")),
                 ("30", "30 " + _("seconds")), ("60", "1 " + _("minute")),
                 ("120", "2 " + _("minutes")), ("300", "5 " + _("minutes")),
                 ("600", "10 " + _("minutes")), ("1200", "20 " + _("minutes")),
                 ("1800", "30 " + _("minutes")), ("3600", "1 " + _("hour")),
                 ("7200", "2 " + _("hours")), ("14400", "4 " + _("hours"))])
    config.usage.output_12V = ConfigSelection(default="do not change",
                                              choices=[("do not change",
                                                        _("do not change")),
                                                       ("off", _("off")),
                                                       ("on", _("on"))])

    zero_button_choices = [("standard", _("standard")),
                           ("swap", _("swap PiP and main picture")),
                           ("swapstop", _("move PiP to main picture")),
                           ("stop", _("stop PiP")),
                           ("zap_focus", _("toggle zap focus"))]
    config.usage.pip_zero_button = ConfigSelection(default="swap",
                                                   choices=zero_button_choices)
    config.usage.pip_zero_button_doubleclick = ConfigSelection(
        default="zap_focus", choices=zero_button_choices)

    config.usage.default_path = ConfigText(default=resolveFilename(SCOPE_HDD))
    config.usage.timer_path = ConfigText(default="<default>")
    config.usage.instantrec_path = ConfigText(default="<default>")
    config.usage.timeshift_path = ConfigText(default="/media/hdd/")
    config.usage.allowed_timeshift_paths = ConfigLocations(
        default=["/media/hdd/"])
    config.usage.vdir_info_path = ConfigText(default="<default>")
    config.usage.days_mark_as_new = ConfigInteger(default=3, limits=(0, 31))
    config.usage.only_unseen_mark_as_new = ConfigYesNo(default=False)

    config.usage.on_movie_start = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("resume", _("Resume from last position")),
                 ("beginning", _("Start from the beginning"))])
    config.usage.on_movie_stop = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service"))])
    config.usage.on_movie_eof = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service")),
                 ("pause", _("Pause movie at end")),
                 ("restart", _("Start from the beginning")),
                 ("playnext", _("Start next media file"))])

    config.usage.setup_level = ConfigSelection(default="expert",
                                               choices=[
                                                   ("simple", _("Simple")),
                                                   ("intermediate",
                                                    _("Intermediate")),
                                                   ("expert", _("Expert"))
                                               ])

    config.usage.on_long_powerpress = ConfigSelection(
        default="show_menu",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby")), ("restart", _("Restart")),
                 ("restart_gui", _("Restart GUI")),
                 ("nothing", _("do nothing"))])

    config.usage.on_short_powerpress = ConfigSelection(
        default="standby",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby")), ("restart", _("Restart")),
                 ("restart_gui", _("Restart GUI")),
                 ("nothing", _("do nothing"))])

    config.usage.alternatives_priority = ConfigSelection(
        default="0",
        choices=[("0", "DVB-S/-C/-T"), ("1", "DVB-S/-T/-C"),
                 ("2", "DVB-C/-S/-T"), ("3", "DVB-C/-T/-S"),
                 ("4", "DVB-T/-C/-S"), ("5", "DVB-T/-S/-C")])

    nims = [("-1", _("auto"))]
    for x in nimmanager.nim_slots:
        nims.append((str(x.slot), x.getSlotName()))
    config.usage.tuner_priority = ConfigSelection(default="-1", choices=nims)

    config.usage.show_event_progress_in_servicelist = ConfigYesNo(
        default=False)

    config.usage.blinking_display_clock_during_recording = ConfigYesNo(
        default=False)

    config.usage.show_message_when_recording_starts = ConfigYesNo(default=True)

    config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(
        default=True)

    def TunerTypePriorityOrderChanged(configElement):
        setTunerTypePriorityOrder(int(configElement.value))

    config.usage.alternatives_priority.addNotifier(
        TunerTypePriorityOrderChanged, immediate_feedback=False)

    def PreferredTunerChanged(configElement):
        setPreferredTuner(int(configElement.value))

    config.usage.tuner_priority.addNotifier(PreferredTunerChanged)

    def setHDDStandby(configElement):
        for hdd in harddiskmanager.HDDList():
            hdd[1].setIdleTime(int(configElement.value))

    config.usage.hdd_standby.addNotifier(setHDDStandby,
                                         immediate_feedback=False)

    def set12VOutput(configElement):
        if configElement.value == "on":
            Misc_Options.getInstance().set_12V_output(1)
        elif configElement.value == "off":
            Misc_Options.getInstance().set_12V_output(0)

    config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)

    SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()

    config.usage.keymap = ConfigText(
        default=eEnv.resolve("${datadir}/enigma2/keymap.xml"))

    config.seek = ConfigSubsection()
    config.seek.selfdefined_13 = ConfigNumber(default=15)
    config.seek.selfdefined_46 = ConfigNumber(default=60)
    config.seek.selfdefined_79 = ConfigNumber(default=300)

    config.seek.speeds_forward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_backward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8],
                                              choices=[2, 4, 6, 8, 12, 16, 25])

    config.seek.enter_forward = ConfigSelection(default="2",
                                                choices=[
                                                    "2", "4", "6", "8", "12",
                                                    "16", "24", "32", "48",
                                                    "64", "96", "128"
                                                ])
    config.seek.enter_backward = ConfigSelection(default="1",
                                                 choices=[
                                                     "1", "2", "4", "6", "8",
                                                     "12", "16", "24", "32",
                                                     "48", "64", "96", "128"
                                                 ])

    config.seek.on_pause = ConfigSelection(default="play",
                                           choices=[("play", _("Play")),
                                                    ("step",
                                                     _("Singlestep (GOP)")),
                                                    ("last", _("Last speed"))])

    config.usage.timerlist_finished_timer_position = ConfigSelection(
        default="beginning",
        choices=[("beginning", _("at beginning")), ("end", _("at end"))])
    config.usage.timer_avoid_simultaneous_start = ConfigYesNo(default=False)

    config.seek.smartseek_enable = ConfigYesNo(default=True)
    config.seek.smartseek_marker = ConfigYesNo(default=False)
    config.seek.smartseek_time = ConfigInteger(default=300, limits=(60, 999))
    config.seek.smartseek_constant_time = ConfigInteger(default=15,
                                                        limits=(5, 600))
    config.seek.smartseek_remap_skip_fw_rw = ConfigYesNo(default=False)
    config.seek.smartseek_timeout = ConfigInteger(default=8, limits=(5, 30))
    config.seek.smartseek_min_time = ConfigInteger(default=10, limits=(2, 120))

    def updateEnterForward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_forward, configElement.value)

    config.seek.speeds_forward.addNotifier(updateEnterForward,
                                           immediate_feedback=False)

    def updateEnterBackward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_backward, configElement.value)

    config.seek.speeds_backward.addNotifier(updateEnterBackward,
                                            immediate_feedback=False)

    # VTI Settings start
    config.usage.show_bsod = ConfigYesNo(default=False)
    config.misc.placeholder = NoSave(
        ConfigSelection(default="1", choices=[("1", " ")]))
    config.misc.use_ci_assignment = ConfigYesNo(default=True)
    config.misc.disable_auto_channel_list = ConfigYesNo(default=False)
    config.misc.allow_service_delete = ConfigYesNo(default=False)
    config.misc.ecm_info = ConfigYesNo(default=True)
    config.misc.enable_custom_mainmenu = ConfigYesNo(default=False)
    config.usage.ts_min_duration = ConfigSelection(default="0",
                                                   choices=[
                                                       ("0", _("off")),
                                                       ("1", _("1 minute")),
                                                       ("2", _("2 minutes")),
                                                       ("5", _("5 minutes")),
                                                       ("10", _("10 minutes")),
                                                   ])
    config.usage.ts_show_old_ts = ConfigYesNo(default=False)
    config.usage.ts_use_history_keys = ConfigYesNo(default=False)
    config.usage.ts_clean_intervall = ConfigSelection(
        default="0", choices=["0", "1", "2", "3", "4", "5", "6", "12", "24"])
    config.usage.ts_clean_ts_older_than = ConfigSelection(default="1",
                                                          choices=[
                                                              ("0.25", "1/4"),
                                                              ("0.5", "1/2"),
                                                              ("1.0", "1"),
                                                              ("2.0", "2"),
                                                              ("3.0", "3"),
                                                              ("4.0", "4"),
                                                              ("5.0", "5")
                                                          ])
    config.usage.ts_ask_before_service_changed = ConfigSelection(
        default="delete",
        choices=[
            ("ask", _("Ask user")),
            ("delete", _("delete timeshift file")),
            ("keep_ts", _("keep timeshift file")),
        ])
    config.usage.ts_auto_start = ConfigSelection(default="0",
                                                 choices=[
                                                     ("0", _("off")),
                                                     ("1", _("1 second")),
                                                     ("2", _("2 seconds")),
                                                     ("3", _("3 seconds")),
                                                     ("4", _("4 seconds")),
                                                     ("5", _("5 seconds")),
                                                     ("10", _("10 seconds")),
                                                     ("20", _("20 seconds")),
                                                     ("30", _("30 seconds")),
                                                     ("60", _("1 minute")),
                                                     ("120", _("2 minutes")),
                                                     ("300", _("5 minutes")),
                                                 ])
    config.usage.ts_event_change = ConfigSelection(
        default="split_and_keep",
        choices=[
            ("ask", _("Ask user")),
            ("continue", _("continue timeshift")),
            ("split_and_keep", _("split & keep")),
            ("split_and_delete", _("split & delete")),
            ("stop_and_keep", _("stop & keep")),
            ("stop_and_delete", _("stop & delete")),
        ])
    config.usage.infobar_dimm = ConfigSelection(default="off",
                                                choices=[
                                                    ("fade_in", _("fade in")),
                                                    ("fade_in_out",
                                                     _("fade in/out")),
                                                    ("fade_out",
                                                     _("fade out")),
                                                    ("off", _("off")),
                                                ])
    config.usage.infobar_dimm_speed = ConfigSelection(default="30",
                                                      choices=[
                                                          ("15", _("fast")),
                                                          ("30", _("default")),
                                                          ("50", _("slow")),
                                                      ])

    config.usage.enable_zaphistory = ConfigYesNo(default=True)
    config.usage.show_epg_progress_percent = ConfigYesNo(default=False)
    config.usage.servicelist_show_picon = ConfigSelection(
        default="0",
        choices=[
            ("0", _("off")),
            ("100", "100x60 px"),
            ("50", "50x30 px"),
            ("1", _("user defined")),
        ])
    config.usage.servicelist_picon_dir = ConfigDirectory(
        default="/usr/share/enigma2/picon")
    config.usage.servicelist_two_lines = ConfigYesNo(default=False)
    config.usage.servicelist_show_event_time = ConfigYesNo(default=False)
    config.usage.servicelist_mark_rec_service = ConfigYesNo(default=True)
    config.usage.servicelist_show_rec_service_symbol = ConfigYesNo(
        default=True)
    config.usage.servicelist_show_servicenumber = ConfigYesNo(default=True)
    config.usage.servicelist_name_width = ConfigInteger(default=200,
                                                        limits=(1, 1920))
    config.usage.servicelist_use_matrix = ConfigYesNo(default=False)
    config.usage.servicelist_show_next_event = ConfigYesNo(default=False)
    config.usage.servicelist_show_service_type_icon = ConfigYesNo(
        default=False)
    config.usage.servicelist_preview_mode = ConfigYesNo(default=False)
    config.usage.servicelist_hide_service_name = ConfigYesNo(default=False)

    rec_button_choices = \
     [
      ("record_menu", _("show record menu")),
      ("running_record", _("show running records")),
      ("timer_list", _("show timer list")),
      ("event_record", _("add recording (stop after current event)")),
      ("indefinitely_record", _("add recording (indefinitely)")),
      ("manualduration_record", _("add recording (enter recording duration)")),
      ("manualendtime_record", _("add recording (enter recording endtime)")),
      ("timeshift_to_record", _("Transform Timeshift into recording"))
     ]

    config.usage.rec_button = ConfigSelection(default="record_menu",
                                              choices=rec_button_choices)
    config.usage.rec_button_long = ConfigSelection(default="running_record",
                                                   choices=rec_button_choices)

    config.usage.remove_finished_timers = ConfigYesNo(default=True)
    config.usage.enable_eit_epg = ConfigYesNo(default=True)

    def setEITepg(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEITenabled(
            int(config.usage.enable_eit_epg.getValue()))

    config.usage.enable_eit_epg.addNotifier(setEITepg)
    config.usage.show_nownext_eit = ConfigYesNo(default=True)
    config.usage.show_old_epg = ConfigSelection(default="21600",
                                                choices=[
                                                    ("0", _("off")),
                                                    ("3600", "1 h"),
                                                    ("21600", "6 h"),
                                                    ("43200", "12 h"),
                                                    ("86400", "24 h"),
                                                ])

    def setOldEPGBuffer(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setOldEPG(
            int(config.usage.show_old_epg.getValue()))

    config.usage.show_old_epg.addNotifier(setOldEPGBuffer)

    config.usage.epg_buffer = ConfigInteger(default=14, limits=(1, 28))

    def setEPGBufferDays(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEPGBuffer(
            config.usage.epg_buffer.getValue())

    config.usage.epg_buffer.addNotifier(setEPGBufferDays)
    epg_choices = [("eventview", _("Event Description")),
                   ("singleepg", _("Single Service EPG")),
                   ("multiepg", _("Multi EPG")),
                   ("epgbar", _("Service EPGBar"))]
    if os.path.exists(
            '/usr/lib/enigma2/python/Plugins/Extensions/GraphMultiEPG/plugin.py'
    ):
        epg_choices.append(("graphicalmultiepg", _("Graphical Multi EPG")))
    config.usage.epg_default_view = ConfigSelection(default="eventview",
                                                    choices=epg_choices)

    config.usage.enable_tt_caching = ConfigYesNo(default=True)

    def EnableTtCachingChanged(configElement):
        setEnableTtCachingOnOff(int(configElement.value))

    config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

    config.usage.stop_seek_eof = ConfigSelection(
        default="20",
        choices=[("0", _("off")), ("10", "10 " + _("seconds")),
                 ("20", "20 " + _("seconds")), ("30", "30 " + _("seconds")),
                 ("60", "60 " + _("seconds"))])

    def updateVideoDirChoice(configElement):
        tmp = configElement.value
        tmp.append(("off", _("off")))
        tmp.append(("last_video", _("last video")))
        tmp.append(("latest_movies", _("latest movies")))
        tmp.append(("all_movies", _("All movies")))
        if (config.movielist.start_videodir.value,
                config.movielist.start_videodir.value) in tmp:
            default = config.movielist.start_videodir.value
        else:
            default = "last_video"
        config.movielist.start_videodir.setChoices(tmp, default)

    tmp = []
    for x in config.movielist.videodirs.value:
        tmp.append((x, x))
    tmp.append(("off", _("off")))
    tmp.append(("last_video", _("last video")))
    tmp.append(("latest_movies", _("latest movies")))
    tmp.append(("all_movies", _("All movies")))
    config.movielist.start_videodir = ConfigSelection(default="last_video",
                                                      choices=tmp)
    config.movielist.videodirs.addNotifier(updateVideoDirChoice)
    config.usage.movielist_folder_based_config = ConfigYesNo(default=True)
    config.usage.movielist_support_pig = ConfigYesNo(default=True)
    config.usage.movielist_last_played_movie = ConfigText(default="")
    config.usage.movielist_select_last_movie = ConfigYesNo(default=True)
    config.usage.movielist_resume_at_eof = ConfigYesNo(default=True)
    config.usage.movielist_show_cover = ConfigYesNo(default=True)
    config.usage.movielist_show_dir = ConfigYesNo(default=True)
    config.usage.movielist_show_trash_dir = ConfigYesNo(default=False)
    config.usage.movielist_use_trash_dir = ConfigYesNo(default=False)
    config.usage.movielist_show_icon = ConfigYesNo(default=True)
    config.usage.movielist_show_color = ConfigYesNo(default=True)
    config.usage.movielist_show_picon = ConfigYesNo(default=False)
    config.usage.movielist_show_channel_info = ConfigYesNo(default=True)
    config.usage.movielist_show_recording_date = ConfigYesNo(default=True)
    config.usage.movielist_show_file_size = ConfigYesNo(default=True)
    config.usage.movielist_show_folder_info = ConfigYesNo(default=True)
    config.usage.movielist_show_folder_info_new = ConfigYesNo(default=True)
    config.usage.movielist_show_folder_info_only_new = ConfigYesNo(
        default=True)
    config.usage.movielist_show_folder_info_sort_by_new = ConfigYesNo(
        default=True)
    config.usage.movielist_show_folder_info_dirs = ConfigYesNo(default=False)
    config.usage.movielist_show_folder_info_left = ConfigYesNo(default=False)
    config.usage.movielist_hide_timeshift_files = ConfigYesNo(default=False)
    config.usage.movielist_only_day = ConfigYesNo(default=True)
    config.usage.movielist_show_last_stop_time = ConfigYesNo(default=False)
    config.usage.movielist_show_duration = ConfigYesNo(default=True)
    config.usage.movielist_duration_in_min = ConfigYesNo(default=True)
    config.usage.movielist_progress_seen = ConfigInteger(default=80,
                                                         limits=(40, 99))
    config.usage.movielist_leave_exit = ConfigYesNo(default=True)
    config.usage.movielist_ask_movie_del = ConfigYesNo(default=False)
    config.usage.movielist_show_progress = ConfigSelection(
        default="progress_bar",
        choices=[("progress_bar", _("progress bar")),
                 ("progress_percent", _("percent")),
                 ("progress_calculate", _("only calculate")),
                 ("progress_off", _("off"))])
    config.usage.timerlist_show_icon = ConfigYesNo(default=True)
    config.usage.timerlist_show_epg = ConfigYesNo(default=True)
    config.usage.timerlist_style = ConfigSelection(
        default="0",
        choices=[
            ("0", _("Default")),
            ("1", _("Style") + " 1"),
            ("2", _("Style") + " 2"),
            ("3", _("Style") + " 3"),
            ("4", _("Style") + " 4"),
            ("5", _("Style") + " 5"),
        ])
    config.usage.channelzap_w_bouquet = ConfigYesNo(default=False)
    config.usage.show_favourites_w_bouquet = ConfigSelection(
        default="down",
        choices=[("down", _("Channel -")), ("up", _("Channel +")),
                 ("off", _("off"))])
    config.usage.show_servicelist_at_modeswitch = ConfigYesNo(default=False)
    config.usage.use_pig = ConfigYesNo(default=False)
    config.usage.use_extended_pig = ConfigYesNo(default=False)
    config.usage.use_extended_pig_channelselection = ConfigYesNo(default=False)
    config.usage.show_infobar_on_splitscreen = ConfigYesNo(default=False)
    pip_modes = [("splitscreen", _("Split Screen")),
                 ("audiozap", _("Audio Zap")),
                 ("pip", _("Picture in Picture"))]
    config.usage.default_pip_mode = ConfigSelection(default="splitscreen",
                                                    choices=pip_modes)
    config.usage.default_zero_double_click_mode = ConfigSelection(
        default="pip", choices=pip_modes)
    default_timeout = SystemInfo["CanPiP"] and 500 or 50
    config.usage.zero_doubleclick_timeout = ConfigInteger(
        default=default_timeout, limits=(50, 5000))
    config.usage.zap_pip = ConfigYesNo(default=True)
    config.usage.zap_before_record = ConfigYesNo(default=False)
    config.usage.zap_notification_record = ConfigYesNo(default=True)
    if SystemInfo["CanPiP"]:
        config.usage.pip_in_EPGBar = ConfigYesNo(default=True)
    else:
        config.usage.pip_in_EPGBar = ConfigYesNo(default=False)
    config.usage.picon_dir = ConfigDirectory(
        default="/usr/share/enigma2/picon")
    config.usage.picon_scale = ConfigYesNo(default=True)
    config.usage.sort_menu_byname = ConfigYesNo(default=False)
    config.usage.sort_plugins_byname = ConfigYesNo(default=True)
    config.usage.plugins_sort_mode = ConfigSelection(default="user",
                                                     choices=[
                                                         ("a_z",
                                                          _("alphabetical")),
                                                         ("default",
                                                          _("Default")),
                                                         ("user",
                                                          _("user defined")),
                                                     ])
    config.usage.plugin_sort_weight = ConfigDictionarySet()
    config.usage.menu_sort_mode = ConfigSelection(
        default="user",
        choices=[
            ("a_z", _("alphabetical")),
            ("default", _("Default")),
            ("user", _("user defined")),
        ])
    config.usage.menu_sort_weight = ConfigDictionarySet(
        default={"mainmenu": {
            "submenu": {}
        }})
    config.usage.numberzap_timeout = ConfigInteger(default=3000,
                                                   limits=(100, 20000))
    config.usage.numberzap_show_servicename = ConfigYesNo(default=True)
    config.usage.numberzap_show_picon = ConfigYesNo(default=True)
    config.usage.startup_service_leavestandby = ConfigYesNo(default=False)
    config.usage.overzap_notplayable = ConfigYesNo(default=True)
    config.usage.disable_tuner_error_popup = ConfigYesNo(default=False)
    config.usage.disable_infobar_timeout_okbutton = ConfigYesNo(default=False)
    config.usage.ask_timer_file_del = ConfigYesNo(default=True)
    config.usage.record_file_name_date_at_end = ConfigYesNo(default=False)
    config.usage.silent_rec_mode = ConfigYesNo(default=True)
    config.usage.vfd_scroll_delay = ConfigSelection(
        default="10000",
        choices=[("10000", "10 " + _("seconds")),
                 ("20000", "20 " + _("seconds")),
                 ("30000", "30 " + _("seconds")),
                 ("60000", "1 " + _("minute")),
                 ("300000", "5 " + _("minutes")), ("noscrolling", _("off"))])
    config.usage.vfd_scroll_speed = ConfigSelection(default="300",
                                                    choices=[
                                                        ("500", _("slow")),
                                                        ("300", _("normal")),
                                                        ("100", _("fast"))
                                                    ])

    def get_default_RC():
        device = HardwareInfoVu().get_device_name()
        if device == "duo2":
            return "2"
        elif device == "ultimo":
            return "1"
        return "0"

    config.usage.rc_style = ConfigSelection(
        default=get_default_RC(),
        choices=[("0", "Vu+ 1 (Duo, Solo, Uno, Solo2)"),
                 ("1", "Vu+ 2 (Ultimo)"), ("2", "Vu+ 3 (Duo2)")])
    config.usage.use_force_overwrite = ConfigYesNo(default=True)
    config.usage.use_package_conffile = ConfigYesNo(default=True)
    config.usage.use_rm_force_depends = ConfigYesNo(default=False)
    config.usage.use_rm_autoremove = ConfigYesNo(default=True)
    config.usage.check_for_updates = ConfigInteger(default=0, limits=(0, 24))
    config.usage.show_notification_for_updates = ConfigYesNo(default=True)
    config.usage.update_available = NoSave(ConfigYesNo(default=False))
    config.usage.blinking_rec_symbol_during_recording = ConfigYesNo(
        default=True)
    config.usage.enable_hbbtv_autostart = ConfigYesNo(default=True)
    config.subtitles = ConfigSubsection()
    config.subtitles.subtitle_fontcolor = ConfigSelection(
        default="0",
        choices=[("0", _("default")), ("1", _("white")), ("2", _("yellow")),
                 ("3", _("green")), ("4", _("cyan")), ("5", _("blue")),
                 ("6", _("magneta")), ("7", _("red")), ("8", _("black"))])
    config.subtitles.subtitle_fontsize = ConfigSelection(
        choices=["%d" % x for x in range(16, 101) if not x % 2], default="20")
    config.subtitles.subtitle_padding_y = ConfigSelection(
        choices=["%d" % x for x in range(2, 301) if not x % 2], default="10")
    config.subtitles.subtitle_bgcolor = ConfigSelection(default="0",
                                                        choices=[
                                                            ("0", _("black")),
                                                            ("1", _("red")),
                                                            ("2",
                                                             _("magneta")),
                                                            ("3", _("blue")),
                                                            ("4", _("cyan")),
                                                            ("5", _("green")),
                                                            ("6", _("yellow")),
                                                            ("7", _("white"))
                                                        ])
    config.subtitles.subtitle_bgopacity = ConfigSelection(
        default="225",
        choices=[("0", _("No transparency")), ("25", "10%"), ("50", "20%"),
                 ("75", "30%"), ("100", "40%"), ("125", "50%"), ("150", "60%"),
                 ("175", "70%"), ("200", "80%"), ("225", "90%"),
                 ("255", _("Full transparency"))])
    config.subtitles.subtitle_edgestyle = ConfigSelection(
        default="2",
        choices=[("0", _("None")), ("1", _("Raised")), ("2", _("Depressed")),
                 ("3", _("Uniform"))])
    config.subtitles.subtitle_edgestyle_level = ConfigSelection(
        choices=["0", "1", "2", "3", "4", "5"], default="3")
    config.subtitles.subtitle_opacity = ConfigSelection(
        default="0",
        choices=[("0", _("No transparency")), ("75", "25%"), ("150", "50%")])
    config.subtitles.subtitle_original_position = ConfigYesNo(default=True)
    config.subtitles.subtitle_alignment = ConfigSelection(choices=[
        ("left", _("left")), ("center", _("center")), ("right", _("right"))
    ],
                                                          default="center")
    config.subtitles.subtitle_position = ConfigSelection(choices=[
        "0", "50", "100", "150", "200", "250", "300", "350", "400", "450",
        "500", "550", "600"
    ],
                                                         default="100")

    config.subtitles.dvb_subtitles_centered = ConfigYesNo(default=False)

    subtitle_delay_choicelist = []
    for i in range(-900000, 1845000, 45000):
        if i == 0:
            subtitle_delay_choicelist.append(("0", _("No delay")))
        else:
            subtitle_delay_choicelist.append(
                (str(i), "%2.1f sec" % (i / 90000.)))
    config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(
        default="315000", choices=subtitle_delay_choicelist)
    config.subtitles.subtitle_bad_timing_delay = ConfigSelection(
        default="0", choices=subtitle_delay_choicelist)
    config.subtitles.subtitle_rewrap = ConfigYesNo(default=False)
    config.subtitles.colourise_dialogs = ConfigYesNo(default=False)
    config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default=True)
    config.subtitles.pango_subtitles_delay = ConfigSelection(
        default="0", choices=subtitle_delay_choicelist)
    config.subtitles.pango_subtitles_fps = ConfigSelection(
        default="1",
        choices=[("1", _("Original")), ("23976", _("23.976")),
                 ("24000", _("24")), ("25000", _("25")), ("29970", _("29.97")),
                 ("30000", _("30"))])
    config.subtitles.pango_autoturnon = ConfigYesNo(default=True)

    debug_choices = [
        ("off", _("off")),
        ("console", _("Console")),
        ("file", _("File")),
        ("fileloop", _("File (loop)")),
        ("console|file", _("Console & File")),
        ("console|fileloop", _("Console & File (loop)")),
    ]
    config.usage.debug_config = ConfigSelection(default="off_",
                                                choices=debug_choices)
    debug_file = "/etc/enigma2/dvbapp2debug.conf"
    val = "off"
    if os.path.exists(debug_file):
        f = open(debug_file, "r")
        lines = f.readlines()
        f.close()
        if lines and len(lines):
            val = lines[0].strip()
            is_valid = False
            for x in debug_choices:
                if x[0] == val:
                    is_valid = True
                    config.usage.debug_config.value = val
                    break
    config.usage.debug_config.value = val
Exemplo n.º 14
0
def InitLcd():
    if getBoxType() in ('wetekplay', 'wetekplayplus', 'vuzero', 'et7x00mini',
                        'xpeedlxcs2', 'xpeedlxcc', 'e4hd', 'e4hdc', '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',
                        'mixosf7', 'mixoslumi', 'gbx1', 'gbx3'):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()
    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if fileExists("/proc/stb/lcd/mode"):
        f = open("/proc/stb/lcd/mode", "r")
        can_lcdmodechecking = f.read().strip().split(" ")
        f.close()
    else:
        can_lcdmodechecking = False
    SystemInfo["LCDMiniTV"] = can_lcdmodechecking

    if detected:
        if can_lcdmodechecking:

            def setLCDModeMinitTV(configElement):
                try:
                    f = open("/proc/stb/lcd/mode", "w")
                    f.write(configElement.value)
                    f.close()
                except:
                    pass

            def setMiniTVFPS(configElement):
                try:
                    f = open("/proc/stb/lcd/fps", "w")
                    f.write("%d \n" % configElement.value)
                    f.close()
                except:
                    pass

            def setLCDModePiP(configElement):
                pass

            config.lcd.modepip = ConfigSelection(choices={
                "0": _("off"),
                "5": _("PIP"),
                "7": _("PIP with OSD")
            },
                                                 default="0")
            if config.misc.boxtype.value == 'gbquad' or config.misc.boxtype.value == 'gbquadplus':
                config.lcd.modepip.addNotifier(setLCDModePiP)
            else:
                config.lcd.modepip = ConfigNothing()

            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.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 setLCDrepeat(configElement):
            ilcd.setRepeat(configElement.value)

        def setLCDscrollspeed(configElement):
            ilcd.setScrollspeed(configElement.value)

        if fileExists("/proc/stb/lcd/symbol_hdd"):
            f = open("/proc/stb/lcd/symbol_hdd", "w")
            f.write("0")
            f.close()
        if fileExists("/proc/stb/lcd/symbol_hddprogress"):
            f = open("/proc/stb/lcd/symbol_hddprogress", "w")
            f.write("0")
            f.close()

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

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

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

        def setPowerLEDstanbystate(configElement):
            if fileExists("/proc/stb/power/standbyled"):
                f = open("/proc/stb/power/standbyled", "w")
                f.write(configElement.value)
                f.close()

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

        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

        if getBoxType() in ('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))
        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=5, 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)

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

        if getBoxType() in ('mixosf5', 'mixosf5mini', 'gi9196m', 'gi9196lite',
                            'zgemmas2s', 'gi9196lite', 'zgemmash1',
                            'zgemmash2'):
            config.lcd.scrollspeed = ConfigSlider(default=150,
                                                  increment=10,
                                                  limits=(0, 500))
            config.lcd.scrollspeed.addNotifier(setLCDscrollspeed)
            config.lcd.repeat = ConfigSelection([("0", _("None")),
                                                 ("1", _("1X")),
                                                 ("2", _("2X")),
                                                 ("3", _("3X")),
                                                 ("4", _("4X")),
                                                 ("500", _("Continues"))], "3")
            config.lcd.repeat.addNotifier(setLCDrepeat)
            config.lcd.hdd = ConfigNothing()
            config.lcd.mode = ConfigNothing()
        elif fileExists("/proc/stb/lcd/scroll_delay") and getBoxType() not in (
                'ixussone', 'ixusszero'):
            config.lcd.hdd = ConfigSelection([("0", _("No")), ("1", _("Yes"))],
                                             "1")
            config.lcd.scrollspeed = ConfigSlider(default=150,
                                                  increment=10,
                                                  limits=(0, 500))
            config.lcd.scrollspeed.addNotifier(setLCDscrollspeed)
            config.lcd.repeat = ConfigSelection([("0", _("None")),
                                                 ("1", _("1X")),
                                                 ("2", _("2X")),
                                                 ("3", _("3X")),
                                                 ("4", _("4X")),
                                                 ("500", _("Continues"))], "3")
            config.lcd.repeat.addNotifier(setLCDrepeat)
            config.lcd.mode = ConfigSelection([("0", _("No")),
                                               ("1", _("Yes"))], "1")
            config.lcd.mode.addNotifier(setLCDmode)
        else:
            config.lcd.mode = ConfigNothing()
            config.lcd.repeat = ConfigNothing()
            config.lcd.scrollspeed = ConfigNothing()
            config.lcd.hdd = 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 getBoxType() == '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.repeat = ConfigNothing()
        config.lcd.scrollspeed = ConfigNothing()
        config.lcd.scroll_speed = ConfigSelection(choices=[("300",
                                                            _("normal"))])
        config.lcd.scroll_delay = ConfigSelection(choices=[("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.misc.standbyCounter.addNotifier(standbyCounterChanged,
                                           initial_call=False)
Exemplo n.º 15
0
def InitLcd():
	if getBoxType() in ('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
	else:
		detected = eDBoxLCD.getInstance().detected()
	SystemInfo["Display"] = detected
	config.lcd = ConfigSubsection();

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

	if detected:
		ilcd = LCD()
		if can_lcdmodechecking:
			def setLCDModeMinitTV(configElement):
				try:
					print 'setLCDModeMinitTV',configElement.value
					f = open("/proc/stb/lcd/mode", "w")
					f.write(configElement.value)
					f.close()
				except:
					pass
			def setMiniTVFPS(configElement):
				try:
					print 'setMiniTVFPS',configElement.value
					f = open("/proc/stb/lcd/fps", "w")
					f.write("%d \n" % configElement.value)
					f.close()
				except:
					pass
			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")
			if config.misc.boxtype.value in ( 'gbquad', 'gbquadplus'):
				config.lcd.modepip.addNotifier(setLCDModePiP)
			else:
				config.lcd.modepip = ConfigNothing()
			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 setPowerLEDstanbystate(configElement):
			if fileExists("/proc/stb/power/standbyled"):
				f = open("/proc/stb/power/standbyled", "w")
				f.write(configElement.value)
				f.close()

		def setXcoreVFD(configElement):
			if fileExists("/sys/module/brcmstb_osmega/parameters/pt6302_cgram"):
				f = open("/sys/module/brcmstb_osmega/parameters/pt6302_cgram", "w")
				f.write(configElement.value)
				f.close()
			if fileExists("/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram"):
				f = open("/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram", "w")
				f.write(configElement.value)
				f.close()
			if fileExists("/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram"):
				f = open("/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram", "w")
				f.write(configElement.value)
				f.close()
			if fileExists("/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram"):
				f = open("/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram", "w")
				f.write(configElement.value)
				f.close()

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

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

		if getBoxType() in ('dm900', 'dm920', 'e4hdultra', 'protek4k'):
			standby_default = 4
		elif getBoxType() 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 getBoxType() 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 getBoxType() 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);

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

		if SystemInfo["LcdLiveTV"]:
			def lcdLiveTvChanged(configElement):
				open(SystemInfo["LcdLiveTV"], "w").write(configElement.value and "0" or "1")
				from Screens.InfoBar import InfoBar
				InfoBarInstance = InfoBar.instance
				InfoBarInstance and InfoBarInstance.session.open(dummyScreen)
			config.lcd.showTv = ConfigYesNo(default = False)
			config.lcd.showTv.addNotifier(lcdLiveTvChanged)

		if SystemInfo["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 SystemInfo["VFD_scroll_repeats"] and getBoxType() not in ('ixussone', 'ixusszero') and getDisplayType() not in ('7segment'):
			def scroll_repeats(el):
				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 getBoxType() not in ('ixussone', 'ixusszero')  and getDisplayType() not in ('7segment'):
			def scroll_delay(el):
				# add workaround for Boxes who need hex code
				if getBoxType() in ('sf4008', 'beyonwizu4'):
					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 getBoxType() not in ('ixussone', 'ixusszero')  and getDisplayType() not in ('7segment'):
			def initial_scroll_delay(el):
				if getBoxType() in ('sf4008', 'beyonwizu4'):
					# 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 getBoxType() not in ('ixussone', 'ixusszero')  and getDisplayType() not in ('7segment'):
			def final_scroll_delay(el):
				if getBoxType() in ('sf4008', 'beyonwizu4'):
					# 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 getBoxType() == '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.misc.standbyCounter.addNotifier(standbyCounterChanged, initial_call = False)
Exemplo n.º 16
0
def InitRecordingConfig():
    config.recording = ConfigSubsection()
    # actually this is "recordings always have priority". "Yes" does mean: don't ask. The RecordTimer will ask when value is 0.
    config.recording.asktozap = ConfigYesNo(default=True)
    config.recording.margin_before = ConfigSelectionNumber(min=0,
                                                           max=120,
                                                           stepwidth=1,
                                                           default=3,
                                                           wraparound=True)
    config.recording.margin_after = ConfigSelectionNumber(min=0,
                                                          max=120,
                                                          stepwidth=1,
                                                          default=5,
                                                          wraparound=True)
    config.recording.debug = ConfigYesNo(default=False)
    config.recording.ascii_filenames = ConfigYesNo(default=False)
    config.recording.keep_timers = ConfigSelectionNumber(min=1,
                                                         max=120,
                                                         stepwidth=1,
                                                         default=7,
                                                         wraparound=True)
    config.recording.filename_composition = ConfigSelection(
        default="standard",
        choices=[("standard", _("standard")),
                 ("veryveryshort", _("Very very short filenames - Warning")),
                 ("veryshort", _("Very short filenames")),
                 ("shortwithtime", _("Short filenames with time")),
                 ("short", _("Short filenames")),
                 ("long", _("Long filenames"))])
    config.recording.always_ecm = ConfigYesNo(default=False)
    config.recording.never_decrypt = ConfigYesNo(default=False)
    config.recording.offline_decode_delay = ConfigSelectionNumber(
        min=1, max=10000, stepwidth=10, default=1000, wraparound=True)
    config.recording.ecm_data = ConfigSelection(
        default="normal",
        choices=[("normal", _("normal")),
                 ("descrambled+ecm", _("descramble and record ecm")),
                 ("scrambled+ecm", _("don't descramble, record ecm"))])
    config.recording.include_ait = ConfigYesNo(default=False)
    config.recording.show_rec_symbol_for_rec_types = ConfigSelection(
        default="real",
        choices=[("any", _("any recordings")), ("real", _("real recordings")),
                 ("real_streaming", _("real recordings or streaming")),
                 ("real_pseudo", _("real or pseudo recordings"))])
    config.recording.warn_box_restart_rec_types = ConfigSelection(
        default="real_streaming",
        choices=[("any", _("any recordings")), ("real", _("real recordings")),
                 ("real_streaming", _("real recordings or streaming")),
                 ("real_pseudo", _("real or pseudo recordings"))])
    config.recording.ask_to_abort_pseudo_rec = ConfigSelection(
        default="abort_msg",
        choices=[("ask", _("ask user")),
                 ("abort_no_msg", _("just abort, no message")),
                 ("abort_msg", _("just abort, show message")),
                 ("never_abort", _("never abort"))])
    config.recording.ask_to_abort_streaming = ConfigSelection(
        default="abort_msg",
        choices=[("ask", _("ask user")),
                 ("abort_no_msg", _("just abort, no message")),
                 ("abort_msg", _("just abort, show message")),
                 ("never_abort", _("never abort"))])
    config.recording.ask_to_abort_pip = ConfigSelection(
        default="abort_msg",
        choices=[("ask", _("ask user")),
                 ("abort_no_msg", _("just abort, no message")),
                 ("abort_msg", _("just abort, show message")),
                 ("never_abort", _("never abort"))])
Exemplo n.º 17
0
def InitAVSwitch():
	config.av = ConfigSubsection()
	config.av.yuvenabled = ConfigBoolean(default=True)
	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.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 = "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: display as fullscreen, even if this breaks the aspect)
	"scale": _("Just scale")}
	try:
		if "auto" in open("/proc/stb/video/policy2_choices").read():
			# TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
			policy2_choices.update({"auto": _("Auto")})
	except:
		pass
	config.av.policy_169 = ConfigSelection(choices=policy2_choices, default = "letterbox")
	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: display as fullscreen, with stretching the left/right)
	"nonlinear": _("Nonlinear"),
	# TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
	"scale": _("Just scale")}
	try:
		if "auto" in open("/proc/stb/video/policy_choices").read():
			# TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
			policy_choices.update({"auto": _("Auto")})
	except:
		pass
	config.av.policy_43 = ConfigSelection(choices=policy_choices, default = "pillarbox")
	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()

	try:
		SystemInfo["CanDownmixAC3"] = "downmix" in open("/proc/stb/audio/ac3_choices", "r").read()
	except:
		SystemInfo["CanDownmixAC3"] = False

	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)

	try:
		SystemInfo["CanDownmixDTS"] = "downmix" in open("/proc/stb/audio/dts_choices", "r").read()
	except:
		SystemInfo["CanDownmixDTS"] = False

	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)

	try:
		SystemInfo["CanDownmixAAC"] = "downmix" in open("/proc/stb/audio/aac_choices", "r").read()
	except:
		SystemInfo["CanDownmixAAC"] = False

	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)

	try:
		SystemInfo["CanChangeOsdAlpha"] = open("/proc/stb/video/alpha", "r") and True or False
	except:
		SystemInfo["CanChangeOsdAlpha"] = False

	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 os.path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):
		def setScaler_sharpness(config):
			myval = int(config.value)
			try:
				print "--> setting scaler_sharpness to: %0.8X" % myval
				open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w").write("%0.8X" % myval)
				open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
			except IOError:
				print "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["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)

	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)
Exemplo n.º 18
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="letterbox")
    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="pillarbox")
    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

    if getMachineBuild() in ('gb7325', ):
        detected = eAVSwitch.getInstance().haveScartSwitch()
    else:
        detected = False

    SystemInfo["ScartSwitch"] = detected

    if SystemInfo["HasMultichannelPCM"]:

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

        config.av.pcm_multichannel = ConfigYesNo(default=False)
        config.av.pcm_multichannel.addNotifier(setPCMMultichannel)

    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["CanDownmixAC3Plus"]:

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

        config.av.downmix_ac3plus = ConfigYesNo(default=True)
        config.av.downmix_ac3plus.addNotifier(setAC3PlusDownmix)

    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["CanDownmixDTSHD"]:

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

        config.av.downmix_dtshd = ConfigYesNo(default=True)
        config.av.downmix_dtshd.addNotifier(setDTSHDDownmix)

    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["CanDownmixAACPlus"]:

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

        config.av.downmix_aacplus = ConfigYesNo(default=True)
        config.av.downmix_aacplus.addNotifier(setAACPlusDownmix)

    if SystemInfo["CanDownmixWMApro"]:

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

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

    if SystemInfo["CanAACTranscode"]:

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

        config.av.transcode_aac = ConfigSelection(default="off",
                                                  choices=[("off", _("off")),
                                                           ("ac3", _("AC3")),
                                                           ("dts", _("DTS"))])
        config.av.transcode_aac.addNotifier(setAACTranscode)

    try:
        SystemInfo["CanChangeOsdAlpha"] = open("/proc/stb/video/alpha",
                                               "r") and True or False
    except:
        SystemInfo["CanChangeOsdAlpha"] = False

    if SystemInfo["CanChangeOsdAlpha"]:

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

        config.av.osd_alpha = ConfigSlider(default=255,
                                           increment=5,
                                           limits=(20, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

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

        def setScaler_sharpness(config):
            myval = int(config.value)
            try:
                print "--> setting scaler_sharpness to: %0.8X" % myval
                open("/proc/stb/vmpeg/0/pep_scaler_sharpness",
                     "w").write("%0.8X" % myval)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            except IOError:
                print "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())

    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)
Exemplo n.º 19
0
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 openATV 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 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.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")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.bypass_edid_checking = ConfigSelection(choices={
				"00000000": _("off"),
				"00000001": _("on")},
				default = "00000001")
		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'):
			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):
			f = open("/proc/stb/audio/3d_surround_speaker_position", "w")
			f.write(configElement.value)
			f.close()
		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'):
			config.av.downmix_ac3 = ConfigSelection(choices = [("downmix",  _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel",  _("convert to multi-channel PCM")), ("hdmi_best",  _("use best / controlled by HDMI"))], 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")
		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'):
				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")
		else:
			config.av.downmix_aac = ConfigYesNo(default = True)
		config.av.downmix_aac.addNotifier(setAACDownmix)

	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/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()
Exemplo n.º 20
0
def InitLcd():
    if getBoxType() in ('et4x00', 'et5x00', 'et6x00', 'gb800se', 'gb800solo',
                        'inihde2', 'iqonios300hd', 'mbmicro', 'sf128', 'sf138',
                        'tmsingle', 'tmnano2super', 'tmnanose', 'tmnanoseplus',
                        'tmnanosem2', 'tmnanosem2plus', 'tmnanosecombo',
                        'vusolo') or getMachineBuild() in ('inihde2', ):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()

    ilcd = LCD()

    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if SystemInfo["StandbyLED"]:

        def setLEDstandby(configElement):
            ilcd.setLEDStandby(configElement.value)

        config.usage.standbyLED = ConfigYesNo(default=True)
        config.usage.standbyLED.addNotifier(setLEDstandby)

    if SystemInfo["LEDButtons"]:

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

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

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

        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

    if detected:
        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 setLCDrepeat(configElement):
            ilcd.setRepeat(configElement.value)

        def setLCDscrollspeed(configElement):
            ilcd.setScrollspeed(configElement.value)

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

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

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

        def writeFp(fp, configElement):
            fp = "/proc/stb/fp/" + fp
            if fileExists(fp):
                f = open(fp, "w")
                f.write(configElement.value)
                f.close()

        def setLedPowerColor(configElement):
            # This is set briefly on restart (before symbolspoller is created),
            # so ignore it just in case it's not blue.
            if not config.usage.lcd_ledpowerrec.value:
                writeFp("ledpowercolor", configElement)

        def setLedStandbyColor(configElement):
            writeFp("ledstandbycolor", configElement)

        def setLedSuspendColor(configElement):
            writeFp("ledsuspendledcolor", configElement)

        def setPower4x7On(configElement):
            writeFp("power4x7on", configElement)

        def setPower4x7Standby(configElement):
            writeFp("power4x7standby", configElement)

        def setPower4x7Suspend(configElement):
            writeFp("power4x7suspend", configElement)

        config.usage.lcd_ledpowerrec = ConfigYesNo(default=False)

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

        config.usage.lcd_ledstandbycolor = ConfigSelection(
            default="3", choices=ledchoices[:])
        config.usage.lcd_ledstandbycolor.addNotifier(setLedStandbyColor)

        def doLedPowerRec(configElement):
            if configElement.value:
                try:
                    from Components.VfdSymbols import symbolspoller
                    symbolspoller.Recording()
                except:
                    pass
            else:
                setLedPowerColor(config.usage.lcd_ledpowercolor)
                setLedStandbyColor(config.usage.lcd_ledstandbycolor)

        config.usage.lcd_ledpowerrec.addNotifier(doLedPowerRec)

        config.usage.lcd_ledsuspendcolor = ConfigSelection(
            default="2", choices=ledchoices[:])
        config.usage.lcd_ledsuspendcolor.addNotifier(setLedSuspendColor)

        config.usage.lcd_power4x7on = ConfigSelection(default="on",
                                                      choices=[
                                                          ("off", _("off")),
                                                          ("on", _("on"))
                                                      ])
        config.usage.lcd_power4x7on.addNotifier(setPower4x7On)

        config.usage.lcd_power4x7standby = ConfigSelection(default="off",
                                                           choices=[("off",
                                                                     _("off")),
                                                                    ("on",
                                                                     _("on"))])
        config.usage.lcd_power4x7standby.addNotifier(setPower4x7Standby)

        config.usage.lcd_power4x7suspend = ConfigSelection(default="off",
                                                           choices=[("off",
                                                                     _("off")),
                                                                    ("on",
                                                                     _("on"))])
        config.usage.lcd_power4x7suspend.addNotifier(setPower4x7Suspend)

        brightness_default = ilcd.oled_brightness_scale
        standby_default = ilcd.oled_brightness_scale * 2 / 3

        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

        if getMachineBuild() in ('beyonwizv2', ):
            brightness_default = 1
            standby_default = 1

        class BrightnessSlider(ConfigSlider):
            def __init__(self, **kwargs):
                self._value = None
                ConfigSlider.__init__(self, **kwargs)

            def setValue(self, value):
                if self._value != value:
                    self._value = value
                    self.changed()

            value = property(ConfigSlider.getValue, setValue)

            def onSelect(self, session):
                self.changed()

            def onDeselect(self, session):
                ConfigSlider.onDeselect(self, session)
                b = config.lcd.bright.saved_value
                if not b:
                    b = config.lcd.bright.default
                ilcd.setBright(int(b))

        config.lcd.standby = BrightnessSlider(
            default=standby_default, limits=(0, ilcd.oled_brightness_scale))
        config.lcd.standby.addNotifier(setLCDbright)
        config.lcd.standby.apply = lambda: setLCDbright(config.lcd.standby)
        config.lcd.standby.callNotifiersOnSaveAndCancel = True

        config.lcd.bright = BrightnessSlider(
            default=brightness_default, limits=(0, ilcd.oled_brightness_scale))
        config.lcd.bright.addNotifier(setLCDbright)
        config.lcd.bright.apply = lambda: setLCDbright(config.lcd.bright)
        config.lcd.bright.callNotifiersOnSaveAndCancel = True

        config.lcd.dimbright = ConfigSlider(
            default=standby_default, limits=(0, ilcd.oled_brightness_scale))
        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.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):
                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)

        if SystemInfo["LCDMiniTV"]:
            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_delay"]:
            config.lcd.scrollspeed = ConfigSlider(default=150,
                                                  increment=1,
                                                  limits=(0, 500))
            config.lcd.scrollspeed.addNotifier(setLCDscrollspeed)
        else:
            config.lcd.scrollspeed = ConfigNothing()

        if SystemInfo["VFD_initial_scroll_delay"]:

            def initial_scroll_delay(el):
                open(SystemInfo["VFD_initial_scroll_delay"],
                     "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_initial_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_initial_scroll_delay.addNotifier(
                initial_scroll_delay, immediate_feedback=False)

        if SystemInfo["VFD_final_scroll_delay"]:

            def final_scroll_delay(el):
                open(SystemInfo["VFD_final_scroll_delay"], "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_final_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_final_scroll_delay.addNotifier(
                final_scroll_delay, immediate_feedback=False)

        if SystemInfo["VFD_scroll_repeats"]:
            config.lcd.repeat = ConfigSelection(
                [("0", _("None")), ("1", _("1x")), ("2", _("2x")),
                 ("3", _("3x")), ("4", _("4x")), ("5", _("5x")),
                 ("10", _("10x")), ("255", _("Continuous"))], "3")
            config.lcd.repeat.addNotifier(setLCDrepeat)
        else:
            config.lcd.repeat = 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"):
            config.lcd.power = ConfigSelection([("0", _("off")),
                                                ("1", _("on"))], "1")
            config.lcd.power.addNotifier(setLCDpower)
        else:
            config.lcd.power = 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.fblcddisplay = ConfigNothing()
        config.lcd.mode = ConfigNothing()
        config.lcd.repeat = ConfigNothing()
        config.lcd.scrollspeed = ConfigNothing()
        config.lcd.power = 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)
Exemplo n.º 21
0
def InitLcd():
    if getBoxType() in ('vusolo'):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()

    ilcd = LCD()

    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if fileExists("/proc/stb/lcd/mode"):
        f = open("/proc/stb/lcd/mode", "r")
        can_lcdmodechecking = f.read().strip().split(" ")
        print("[LCD] LCDMiniTV", can_lcdmodechecking)
        f.close()
    else:
        can_lcdmodechecking = False

    if SystemInfo["PowerLED"]:

        def setPowerLEDstate(configElement):
            print("[LCD] PowerLED = %s" % SystemInfo["PowerLED"])
            f = open("/proc/stb/power/powerled", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["PowerLED2"]:

        def setPowerLEDstate2(configElement):
            print("[LCD] PowerLED2 = %s" % SystemInfo["PowerLED2"])
            f = open("/proc/stb/power/powerled2", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["StandbyLED"]:

        def setPowerLEDstanbystate(configElement):
            print("[LCD] StandbyLED = %s configElement = %s" %
                  (SystemInfo["StandbyLED"], configElement.value))
            f = open("/proc/stb/power/standbyled", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["SuspendLED"]:

        def setPowerLEDdeepstanbystate(configElement):
            print("[LCD] SuspendLED = %s configElement = %s" %
                  (SystemInfo["SuspendLED"], configElement.value))
            f = open("/proc/stb/power/suspendled", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["LedPowerColor"]:

        def setLedPowerColor(configElement):
            f = open("/proc/stb/fp/ledpowercolor", "w")
            f.write(configElement.value)
            f.close()

        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):
            f = open("/proc/stb/fp/ledstandbycolor", "w")
            f.write(configElement.value)
            f.close()

        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):
            f = open("/proc/stb/fp/ledsuspendledcolor", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["Power24x7On"]:

        def setPower24x7On(configElement):
            f = open("/proc/stb/fp/power4x7on", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["Power24x7Standby"]:

        def setPower24x7Standby(configElement):
            f = open("/proc/stb/fp/power4x7standby", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["Power24x7Suspend"]:

        def setPower24x7Suspend(configElement):
            f = open("/proc/stb/fp/power4x7suspend", "w")
            f.write(configElement.value)
            f.close()

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

    if SystemInfo["LEDButtons"]:

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

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

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

        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

    if detected:
        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 setLCDminitvmode(configElement):
            ilcd.setLCDMiniTVMode(configElement.value)

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

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

        standby_default = 0

        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.dimbright = ConfigSlider(default=standby_default,
                                            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.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["LcdPowerOn"]:
            config.lcd.power = ConfigSelection([("0", _("Off")),
                                                ("1", _("On"))], "1")
            config.lcd.power.addNotifier(setLCDpower)
        else:
            config.lcd.power = ConfigNothing()

        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)

        if SystemInfo["LCDMiniTV"] and getBoxType() not in ('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)
        elif can_lcdmodechecking and getBoxType() in ('gbquad4k', 'gbue4k'):
            #  (0:normal, 1:video0, 2:fb, 3:vide0+fb, 4:video1, 5:vide0+video1, 6:video1+fb, 7:video0+video1+fb)
            config.lcd.minitvmode = ConfigSelection(
                default="0",
                choices=[("0", _("normal")),
                         ("1", _("MiniTV") + _(" - video0")),
                         ("3", _("MiniTV with OSD") + _(" - video0")),
                         ("2", _("OSD")), ("4", _("MiniTV") + _(" - video1")),
                         ("6", _("MiniTV with OSD") + _(" - video1")),
                         ("5", _("MiniTV") + _(" - video0+video1")),
                         ("7", _("MiniTV with OSD") + _(" - video0+video1"))])
            config.lcd.minitvmode.addNotifier(setLCDminitvmode)
            config.lcd.minitvpipmode = ConfigSelection(default="0",
                                                       choices=[
                                                           ("0", _("off")),
                                                           ("4", _("PIP")),
                                                           ("6",
                                                            _("PIP with OSD"))
                                                       ])
            config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
            config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.minitvfps.addNotifier(setLCDminitvfps)
        else:
            config.lcd.minitvmode = ConfigNothing()
            config.lcd.minitvpipmode = ConfigNothing()
            config.lcd.minitvfps = ConfigNothing()

        if SystemInfo["VFD_scroll_repeats"] and getDisplayType() not in (
                '7segment'):

            def scroll_repeats(el):
                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)

        if SystemInfo["VFD_scroll_delay"] and getDisplayType() not in (
                '7segment'):

            def scroll_delay(el):
                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)

        if SystemInfo["VFD_initial_scroll_delay"] and getDisplayType() not in (
                '7segment'):

            def initial_scroll_delay(el):
                open(SystemInfo["VFD_initial_scroll_delay"],
                     "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_initial_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_initial_scroll_delay.addNotifier(
                initial_scroll_delay, immediate_feedback=False)

        if SystemInfo["VFD_final_scroll_delay"] and getDisplayType() not in (
                '7segment'):

            def final_scroll_delay(el):
                open(SystemInfo["VFD_final_scroll_delay"], "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_final_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_final_scroll_delay.addNotifier(
                final_scroll_delay, immediate_feedback=False)

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

    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.mode = ConfigNothing()
        config.lcd.power = 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)
Exemplo n.º 22
0
def InitHdmiRecord():
    config.hdmirecord = ConfigSubsection()
    choices = [
        ("512000", "0.5 Mb/s"),
        ("1024000", "1 Mb/s"),
        ("2048000", "2 Mb/s"),
        ("3072000", "3 Mb/s"),
        ("4096000", "4 Mb/s"),
        ("5120000", "5 Mb/s"),
        ("6144000", "6 Mb/s"),
        ("7168000", "7 Mb/s"),
        ("8192000", "8 Mb/s"),
        ("9216000", "9 Mb/s"),
        ("10240000", "10 Mb/s"),
        ("15360000", "15 Mb/s"),
        ("20480000", "20 Mb/s"),
        ("25600000", "25 Mb/s"),
    ]

    config.hdmirecord.bitrate = ConfigSelection(choices, default="5120000")
    choices = [
        ("180", "180"),  # SD / 4
        ("240", "240"),  # FullHD / 8, SD / 3
        ("320", "320"),  # FullHD / 6
        ("360", "360"),  # SD / 2
        ("384", "384"),  # FullHD / 5
        ("480", "480"),  # FullHD / 4
        ("640", "640"),  # FullHD / 3
        ("720", "720"),  # SD
        ("960", "960"),  # FullHD / 2
        ("1280", "1280"),  # FullHD / 1.5
        ("1920", "1920"),  # FullHD
    ]

    config.hdmirecord.width = ConfigSelection(choices, default="1280")
    choices = [
        ("144", "144"),  # SD / 4
        ("135", "135"),  # FullHD / 8
        ("192", "192"),  # SD / 3
        ("180", "180"),  # FullHD / 6
        ("288", "288"),  # SD / 2
        ("216", "216"),  # FullHD / 5
        ("270", "270"),  # FullHD / 4
        ("360", "360"),  # FullHD / 3
        ("576", "576"),  # SD
        ("540", "540"),  # FullHD / 2
        ("720", "720"),  # FullHD / 1.5
        ("1080", "1080"),  # FullHD
    ]

    config.hdmirecord.height = ConfigSelection(choices, default="720")
    choices = [
        ("144", "144"),  # SD / 4
        ("135", "135"),  # FullHD / 8
        ("192", "192"),  # SD / 3
        ("180", "180"),  # FullHD / 6
        ("288", "288"),  # SD / 2
        ("216", "216"),  # FullHD / 5
        ("270", "270"),  # FullHD / 4
        ("360", "360"),  # FullHD / 3
        ("576", "576"),  # SD
        ("540", "540"),  # FullHD / 2
        ("720", "720"),  # FullHD / 1.5
        ("1080", "1080"),  # FullHD
    ]

    config.hdmirecord.framerate = ConfigSelection(choices=[
        ("24000", "24"),
        ("25000", "25"),
        ("30000", "30"),
        ("50000", "50"),
        ("60000", "60"),
    ],
                                                  default="60000")

    # Intentionally not a boolean because the API expects an integer parsed from the string
    config.hdmirecord.interlaced = ConfigSelection(choices=[
        ("0", "No"),
        ("1", "Yes"),
    ],
                                                   default="0")

    config.hdmirecord.aspectratio = ConfigSelection(choices=[
        ("0", "Auto"),
        ("1", "4:3"),
        ("2", "16:9"),
    ],
                                                    default="0")
Exemplo n.º 23
0
def InitHdmiRecord():
    full_hd = getMachineBuild() in (
        'et10000', 'dm900', 'dm920', 'et13000', 'sf5008', 'vuuno4kse',
        'vuduo4k') or getBoxType() in ('spycat4k', 'spycat4kcombo', 'gbquad4k')

    config.hdmirecord = ConfigSubsection()

    choices = [
        ("512000", "0.5 Mb/s"),
        ("1024000", "1 Mb/s"),
        ("2048000", "2 Mb/s"),
        ("3072000", "3 Mb/s"),
        ("4096000", "4 Mb/s"),
        ("5120000", "5 Mb/s"),
        ("6144000", "6 Mb/s"),
        ("7168000", "7 Mb/s"),
        ("8192000", "8 Mb/s"),
        ("9216000", "9 Mb/s"),
        ("10240000", "10 Mb/s"),
        ("15360000", "15 Mb/s"),
        ("20480000", "20 Mb/s"),
        ("25600000", "25 Mb/s"),
    ]
    config.hdmirecord.bitrate = ConfigSelection(choices, default="5120000")

    choices = [
        ("180", "180"),  # SD / 4
        ("240", "240"),  # FullHD / 8, SD / 3
        ("320", "320"),  # FullHD / 6
        ("360", "360"),  # SD / 2
        ("384", "384"),  # FullHD / 5
        ("480", "480"),  # FullHD / 4
        ("640", "640"),  # FullHD / 3
        ("720", "720"),  # SD
        ("960", "960"),  # FullHD / 2
        ("1280", "1280"),  # FullHD / 1.5
    ]
    if (full_hd):
        choices.append(("1920", "1920"))  # FullHD

    config.hdmirecord.width = ConfigSelection(choices, default="1280")

    choices = [
        ("144", "144"),  # SD / 4
        ("135", "135"),  # FullHD / 8
        ("192", "192"),  # SD / 3
        ("180", "180"),  # FullHD / 6
        ("288", "288"),  # SD / 2
        ("216", "216"),  # FullHD / 5
        ("270", "270"),  # FullHD / 4
        ("360", "360"),  # FullHD / 3
        ("576", "576"),  # SD
        ("540", "540"),  # FullHD / 2
        ("720", "720"),  # FullHD / 1.5
    ]

    if (full_hd):
        choices.append(("1080", "1080"))  # FullHD

    config.hdmirecord.height = ConfigSelection(choices, default="720")

    config.hdmirecord.framerate = ConfigSelection(choices=[
        ("24000", "24"),
        ("25000", "25"),
        ("30000", "30"),
        ("50000", "50"),
        ("60000", "60"),
    ],
                                                  default="60000")

    # Intentionally not a boolean because the API expects an integer parsed from the string
    config.hdmirecord.interlaced = ConfigSelection(choices=[
        ("0", "No"),
        ("1", "Yes"),
    ],
                                                   default="0")

    config.hdmirecord.aspectratio = ConfigSelection(choices=[
        ("0", "Auto"),
        ("1", "4:3"),
        ("2", "16:9"),
    ],
                                                    default="0")
Exemplo n.º 24
0
def InitUsageConfig():

    # iq [
    from Tools.HardwareInfo import HardwareInfo
    boxtype = HardwareInfo().get_device_name()
    if boxtype == "twin":
        boxtype = "tmtwin"
    elif boxtype == "ios100hd":
        boxtype = "ios100"
# ]

    config.misc.boxtype = ConfigText(default=boxtype)

    config.usage = ConfigSubsection()
    config.usage.showdish = ConfigYesNo(default=True)
    config.usage.multibouquet = ConfigYesNo(default=True)
    config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)

    config.usage.quickzap_bouquet_change = ConfigYesNo(default=False)
    config.usage.e1like_radio_mode = ConfigYesNo(default=True)
    choicelist = []
    for i in range(1, 12):
        choicelist.append(
            ("%d" % i, ngettext("%d second", "%d seconds", i) % i))
    config.usage.infobar_timeout = ConfigSelection(
        default="5", choices=[("0", _("no timeout"))] + choicelist)
    config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
    config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
    config.usage.sort_pluginlist = ConfigYesNo(
        default=True)  # sort plugins list
    config.usage.show_infobar_on_event_change = ConfigYesNo(default=False)
    # [iq
    #config.usage.show_second_infobar = ConfigSelection(default = None, choices = [(None, _("None")), ("0", _("no timeout"))] + choicelist)
    config.usage.show_second_infobar = ConfigSelection(
        default="5",
        choices=[(None, _("None")), ("0", _("no timeout"))] + choicelist)
    # iq]
    config.usage.show_spinner = ConfigYesNo(default=True)
    config.usage.enable_tt_caching = ConfigYesNo(default=True)
    choicelist = []
    for i in (10, 30):
        choicelist.append(
            ("%d" % i, ngettext("%d second", "%d seconds", i) % i))
    for i in (60, 120, 300, 600, 1200, 1800):
        m = i / 60
        choicelist.append(
            ("%d" % i, ngettext("%d minute", "%d minutes", m) % m))
    for i in (3600, 7200, 14400):
        h = i / 3600
        choicelist.append(("%d" % i, ngettext("%d hour", "%d hours", h) % h))
    config.usage.hdd_standby = ConfigSelection(
        default="300", choices=[("0", _("no standby"))] + choicelist)
    config.usage.output_12V = ConfigSelection(default="do not change",
                                              choices=[("do not change",
                                                        _("do not change")),
                                                       ("off", _("off")),
                                                       ("on", _("on"))])

    config.usage.pip_zero_button = ConfigSelection(
        default="standard",
        choices=[("standard", _("standard")),
                 ("swap", _("swap PiP and main picture")),
                 ("swapstop", _("move PiP to main picture")),
                 ("stop", _("stop PiP"))])

    # iq [
    if HardwareInfo().get_device_name() == "ios300hd":
        os.system("rm /hdd; ln -s /media/usb /hdd")
# ]
    config.usage.default_path = ConfigText(default=resolveFilename(SCOPE_HDD))
    config.usage.timer_path = ConfigText(default="<default>")
    config.usage.instantrec_path = ConfigText(default="<default>")
    # if [
    if HardwareInfo().get_device_name() == "ios300hd":
        config.usage.timeshift_path = ConfigText(default="/media/usb/")
        config.usage.allowed_timeshift_paths = ConfigLocations(
            default=["/media/usb/"])
    else:
        config.usage.timeshift_path = ConfigText(default="/media/hdd/")
        config.usage.allowed_timeshift_paths = ConfigLocations(
            default=["/media/hdd/"])
# ]

    config.usage.movielist_trashcan = ConfigYesNo(default=True)
    config.usage.movielist_trashcan_days = ConfigNumber(default=8)
    config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
    config.usage.on_movie_start = ConfigSelection(
        default="resume",
        choices=[("ask", _("Ask user")),
                 ("resume", _("Resume from last position")),
                 ("beginning", _("Start from the beginning"))])
    config.usage.on_movie_stop = ConfigSelection(
        default="movielist",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service"))])
    config.usage.on_movie_eof = ConfigSelection(
        default="movielist",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service")),
                 ("pause", _("Pause movie at end"))])

    config.usage.setup_level = ConfigSelection(default="expert",
                                               choices=[
                                                   ("simple", _("Simple")),
                                                   ("intermediate",
                                                    _("Intermediate")),
                                                   ("expert", _("Expert"))
                                               ])

    config.usage.on_long_powerpress = ConfigSelection(
        default="show_menu",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby"))])

    config.usage.on_short_powerpress = ConfigSelection(
        default="standby",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby"))])

    config.usage.alternatives_priority = ConfigSelection(
        default="0",
        choices=[("0", "DVB-S/-C/-T"), ("1", "DVB-S/-T/-C"),
                 ("2", "DVB-C/-S/-T"), ("3", "DVB-C/-T/-S"),
                 ("4", "DVB-T/-C/-S"), ("5", "DVB-T/-S/-C")])

    nims = [("-1", _("auto"))]
    for x in nimmanager.nim_slots:
        nims.append((str(x.slot), x.getSlotName()))
    config.usage.frontend_priority = ConfigSelection(default="-1",
                                                     choices=nims)
    config.misc.disable_background_scan = ConfigYesNo(default=False)

    config.usage.show_event_progress_in_servicelist = ConfigYesNo(default=True)
    config.usage.show_channel_numbers_in_servicelist = ConfigYesNo(
        default=True)

    config.usage.blinking_display_clock_during_recording = ConfigYesNo(
        default=False)

    config.usage.show_message_when_recording_starts = ConfigYesNo(default=True)

    config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(
        default=True)
    config.usage.show_icons_in_movielist = ConfigSelection(
        default='i',
        choices=[
            ('o', _("Off")),
            ('p', _("Progress")),
            ('s', _("Progress Small")),
            ('i', _("Icons")),
        ])
    config.usage.movielist_unseen = ConfigYesNo(default=False)

    config.usage.swap_snr_on_osd = ConfigYesNo(default=False)

    def SpinnerOnOffChanged(configElement):
        setSpinnerOnOff(int(configElement.value))

    config.usage.show_spinner.addNotifier(SpinnerOnOffChanged)

    def EnableTtCachingChanged(configElement):
        setEnableTtCachingOnOff(int(configElement.value))

    config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

    def TunerTypePriorityOrderChanged(configElement):
        setTunerTypePriorityOrder(int(configElement.value))

    config.usage.alternatives_priority.addNotifier(
        TunerTypePriorityOrderChanged, immediate_feedback=False)

    def PreferredTunerChanged(configElement):
        setPreferredTuner(int(configElement.value))

    config.usage.frontend_priority.addNotifier(PreferredTunerChanged)

    config.usage.hide_zap_errors = ConfigYesNo(default=False)
    config.usage.hide_ci_messages = ConfigYesNo(default=False)
    config.usage.show_cryptoinfo = ConfigYesNo(default=True)
    config.usage.show_eit_nownext = ConfigYesNo(default=True)

    config.epg = ConfigSubsection()
    config.epg.eit = ConfigYesNo(default=True)
    config.epg.mhw = ConfigYesNo(default=False)
    config.epg.freesat = ConfigYesNo(default=True)
    config.epg.viasat = ConfigYesNo(default=True)
    config.epg.netmed = ConfigYesNo(default=True)
    config.misc.showradiopic = ConfigYesNo(default=True)

    def EpgSettingsChanged(configElement):
        from enigma import eEPGCache
        mask = 0xffffffff
        if not config.epg.eit.value:
            mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE
                      | eEPGCache.SCHEDULE_OTHER)
        if not config.epg.mhw.value:
            mask &= ~eEPGCache.MHW
        if not config.epg.freesat.value:
            mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE
                      | eEPGCache.FREESAT_SCHEDULE_OTHER)
        if not config.epg.viasat.value:
            mask &= ~eEPGCache.VIASAT
        if not config.epg.netmed.value:
            mask &= ~(eEPGCache.NETMED_SCHEDULE
                      | eEPGCache.NETMED_SCHEDULE_OTHER)
        eEPGCache.getInstance().setEpgSources(mask)

    config.epg.eit.addNotifier(EpgSettingsChanged)
    config.epg.mhw.addNotifier(EpgSettingsChanged)
    config.epg.freesat.addNotifier(EpgSettingsChanged)
    config.epg.viasat.addNotifier(EpgSettingsChanged)
    config.epg.netmed.addNotifier(EpgSettingsChanged)

    config.epg.histminutes = ConfigSelectionNumber(min=0,
                                                   max=120,
                                                   stepwidth=15,
                                                   default=0,
                                                   wraparound=True)

    def EpgHistorySecondsChanged(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEpgHistorySeconds(
            config.epg.histminutes.getValue() * 60)

    config.epg.histminutes.addNotifier(EpgHistorySecondsChanged)

    def setHDDStandby(configElement):
        for hdd in harddiskmanager.HDDList():
            hdd[1].setIdleTime(int(configElement.value))

    config.usage.hdd_standby.addNotifier(setHDDStandby,
                                         immediate_feedback=False)

    def set12VOutput(configElement):
        if configElement.value == "on":
            enigma.Misc_Options.getInstance().set_12V_output(1)
        elif configElement.value == "off":
            enigma.Misc_Options.getInstance().set_12V_output(0)

    config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)

    SystemInfo["12V_Output"] = enigma.Misc_Options.getInstance(
    ).detected_12V_output()

    config.usage.keymap = ConfigText(
        default=eEnv.resolve("${datadir}/enigma2/keymap.xml"))

    config.seek = ConfigSubsection()
    config.seek.selfdefined_13 = ConfigNumber(default=15)
    config.seek.selfdefined_46 = ConfigNumber(default=60)
    config.seek.selfdefined_79 = ConfigNumber(default=300)

    config.seek.speeds_forward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_backward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8],
                                              choices=[2, 4, 6, 8, 12, 16, 25])

    config.seek.enter_forward = ConfigSelection(default="2",
                                                choices=[
                                                    "2", "4", "6", "8", "12",
                                                    "16", "24", "32", "48",
                                                    "64", "96", "128"
                                                ])
    config.seek.enter_backward = ConfigSelection(default="1",
                                                 choices=[
                                                     "1", "2", "4", "6", "8",
                                                     "12", "16", "24", "32",
                                                     "48", "64", "96", "128"
                                                 ])

    config.seek.on_pause = ConfigSelection(default="play",
                                           choices=[("play", _("Play")),
                                                    ("step",
                                                     _("Singlestep (GOP)")),
                                                    ("last", _("Last speed"))])

    config.crash = ConfigSubsection()
    config.crash.details = ConfigYesNo(default=False)
    config.usage.timerlist_finished_timer_position = ConfigSelection(
        default="end",
        choices=[("beginning", _("at beginning")), ("end", _("at end"))])

    def updateEnterForward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_forward, configElement.value)

    config.seek.speeds_forward.addNotifier(updateEnterForward,
                                           immediate_feedback=False)

    def updateEnterBackward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_backward, configElement.value)

    config.seek.speeds_backward.addNotifier(updateEnterBackward,
                                            immediate_feedback=False)

    def updateFlushSize(el):
        enigma.setFlushSize(int(el.value))
        print "[SETTING] getFlushSize=", enigma.getFlushSize()

    config.misc.flush_size = ConfigSelection(default="0",
                                             choices=[("0", "Off"),
                                                      ("524288", "512kB"),
                                                      ("1048576", "1 MB"),
                                                      ("2097152", "2 MB"),
                                                      ("4194304", "4 MB")])
    config.misc.flush_size.addNotifier(updateFlushSize,
                                       immediate_feedback=False)

    def updateEraseSpeed(el):
        enigma.eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.value))

    def updateEraseFlags(el):
        enigma.eBackgroundFileEraser.getInstance().setEraseFlags(int(el.value))

    config.misc.erase_speed = ConfigSelection(default="20",
                                              choices=[("10", "10 MB/s"),
                                                       ("20", "20 MB/s"),
                                                       ("50", "50 MB/s"),
                                                       ("100", "100 MB/s")])
    config.misc.erase_speed.addNotifier(updateEraseSpeed,
                                        immediate_feedback=False)
    config.misc.erase_flags = ConfigSelection(default="1",
                                              choices=[
                                                  ("0", _("Disable")),
                                                  ("1",
                                                   _("Internal hdd only")),
                                                  ("3", _("Everywhere"))
                                              ])
    config.misc.erase_flags.addNotifier(updateEraseFlags,
                                        immediate_feedback=False)

    SystemInfo["ZapMode"] = os.path.exists("/proc/stb/video/zapmode")
    if SystemInfo["ZapMode"]:

        def setZapmode(el):
            try:
                file = open("/proc/stb/video/zapmode", "w")
                file.write(el.value)
                file.close()
            except:
                pass

        config.misc.zapmode = ConfigSelection(
            default="mute",
            choices=[("mute", _("Black screen")), ("hold", _("Hold screen")),
                     ("mutetilllock", _("Black screen till locked")),
                     ("holdtilllock", _("Hold till locked"))])
        config.misc.zapmode.addNotifier(setZapmode, immediate_feedback=False)

    config.subtitles = ConfigSubsection()
    config.subtitles.ttx_subtitle_colors = ConfigSelection(
        default="1",
        choices=[("0", _("original")), ("1", _("white")), ("2", _("yellow"))])
    config.subtitles.ttx_subtitle_original_position = ConfigYesNo(
        default=False)
    config.subtitles.subtitle_position = ConfigSelection(choices=[
        "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100",
        "150", "200", "250", "300", "350", "400", "450"
    ],
                                                         default="50")
    config.subtitles.subtitle_alignment = ConfigSelection(choices=[
        ("left", _("left")), ("center", _("center")), ("right", _("right"))
    ],
                                                          default="center")
    config.subtitles.subtitle_rewrap = ConfigYesNo(default=False)
    config.subtitles.subtitle_borderwidth = ConfigSelection(
        choices=["1", "2", "3", "4", "5"], default="3")
    config.subtitles.subtitle_fontsize = ConfigSelection(choices=[
        "16", "18", "20", "22", "24", "26", "28", "30", "32", "34", "36", "38",
        "40", "42", "44", "46", "48", "50", "52", "54"
    ],
                                                         default="34")
    choicelist = []
    for i in range(45000, 945000, 45000):
        choicelist.append(("%d" % i, "%2.1f sec" % (i / 90000.)))
    config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(
        default="315000", choices=[("0", _("No Delay"))] + choicelist)

    config.subtitles.dvb_subtitles_yellow = ConfigYesNo(default=False)
    config.subtitles.dvb_subtitles_original_position = ConfigSelection(
        default="0",
        choices=[("0", _("original")), ("1", _("fixed")),
                 ("2", _("relative"))])
    config.subtitles.dvb_subtitles_centered = ConfigYesNo(default=False)
    config.subtitles.dvb_subtitles_backtrans = ConfigSelection(
        default="0",
        choices=[("0", _("no transparency")), ("25", "10%"), ("50", "20%"),
                 ("75", "30%"), ("100", "40%"), ("125", "50%"), ("150", "60%"),
                 ("175", "70%"), ("200", "80%"), ("225", "90%"),
                 ("255", _("full transparency"))])
    config.subtitles.pango_subtitles_yellow = ConfigYesNo(default=False)

    config.autolanguage = ConfigSubsection()
    audio_language_choices = [
        ("---", _("None")),
        ("orj dos ory org esl qaa und mis mul ORY ORJ Audio_ORJ",
         _("Original")), ("ara", _("Arabic")), ("eus baq", _("Basque")),
        ("bul", _("Bulgarian")),
        ("hrv", _("Croatian")), ("ces cze", _("Czech")), ("dan", _("Danish")),
        ("dut ndl", _("Dutch")), ("eng qaa", _("English")),
        ("est", _("Estonian")), ("fin", _("Finnish")),
        ("fra fre", _("French")), ("deu ger", _("German")),
        ("ell gre", _("Greek")), ("heb", _("Hebrew")), ("hun", _("Hungarian")),
        ("ita", _("Italian")), ("lat", _("Latvian")), ("lit", _("Lithuanian")),
        ("ltz", _("Letzeburgesch")), ("nor", _("Norwegian")),
        ("pol", _("Polish")), ("por", _("Portuguese")),
        ("fas per", _("Persian")), ("ron rum", _("Romanian")),
        ("rus", _("Russian")), ("srp", _("Serbian")), ("slk slo", _("Slovak")),
        ("slv", _("Slovenian")), ("spa", _("Spanish")), ("swe", _("Swedish")),
        ("tha", _("Thai")), ("tur Audio_TUR", _("Turkish"))
    ]

    def setEpgLanguage(configElement):
        enigma.eServiceEvent.setEPGLanguage(configElement.value)


#	config.autolanguage.audio_epglanguage = ConfigSelection(audio_language_choices[:1] + audio_language_choices [2:], default="---")

    config.autolanguage.audio_epglanguage = ConfigSelection(
        audio_language_choices[:1] + audio_language_choices[2:],
        default="eng qaa")  # [iq]
    config.autolanguage.audio_epglanguage.addNotifier(setEpgLanguage)

    def setEpgLanguageAlternative(configElement):
        enigma.eServiceEvent.setEPGLanguageAlternative(configElement.value)

    config.autolanguage.audio_epglanguage_alternative = ConfigSelection(
        audio_language_choices[:1] + audio_language_choices[2:], default="---")
    config.autolanguage.audio_epglanguage_alternative.addNotifier(
        setEpgLanguageAlternative)

    #	config.autolanguage.audio_autoselect1 = ConfigSelection(choices=audio_language_choices, default="---")
    config.autolanguage.audio_autoselect1 = ConfigSelection(
        choices=audio_language_choices, default="eng qaa")  # [iq]
    config.autolanguage.audio_autoselect2 = ConfigSelection(
        choices=audio_language_choices, default="---")
    config.autolanguage.audio_autoselect3 = ConfigSelection(
        choices=audio_language_choices, default="---")
    config.autolanguage.audio_autoselect4 = ConfigSelection(
        choices=audio_language_choices, default="---")
    config.autolanguage.audio_defaultac3 = ConfigYesNo(default=True)  # [iq]
    #config.autolanguage.audio_defaultac3 = ConfigYesNo(default = False)		# [iq]
    config.autolanguage.audio_usecache = ConfigYesNo(default=True)

    subtitle_language_choices = audio_language_choices[:
                                                       1] + audio_language_choices[
                                                           2:]
    #	config.autolanguage.subtitle_autoselect1 = ConfigSelection(choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_autoselect1 = ConfigSelection(
        choices=subtitle_language_choices, default="eng qaa")  # [iq]
    config.autolanguage.subtitle_autoselect2 = ConfigSelection(
        choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_autoselect3 = ConfigSelection(
        choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_autoselect4 = ConfigSelection(
        choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_hearingimpaired = ConfigYesNo(default=False)
    config.autolanguage.subtitle_defaultimpaired = ConfigYesNo(default=False)
    config.autolanguage.subtitle_defaultdvb = ConfigYesNo(default=False)
    config.autolanguage.subtitle_usecache = ConfigYesNo(default=True)
    #	config.autolanguage.equal_languages = ConfigSelection(default = "15", choices = [
    config.autolanguage.equal_languages = ConfigSelection(
        default="0",
        choices=[  # [iq]
            ("0", "None"), ("1", "1"), ("2", "2"), ("3", "1,2"), ("4", "3"),
            ("5", "1,3"), ("6", "2,3"), ("7", "1,2,3"), ("8", "4"),
            ("9", "1,4"), ("10", "2,4"), ("11", "1,2,4"), ("12", "3,4"),
            ("13", "1,3,4"), ("14", "2,3,4"), ("15", "All")
        ])

    # [ iqteam
    config.fan_config = ConfigSubsection()
    config.fan_config.offset = ConfigNumber(default=0)
    config.fan_config.default = ConfigNumber(default=5)
    config.fan_config.increment = ConfigNumber(default=5)
    config.fan_config.configured = ConfigYesNo(default=False)

    config.swupdate = ConfigSubsection()
    config.swupdate.folderprefix = ConfigText(default='', fixed_size=False)
    config.swupdate.downloadlocation = ConfigSelection(choices=[])

    config.vfd_scroll = ConfigYesNo(default=True)

    config.usage.background_hddjob = ConfigYesNo(default=False)  # [iq]
    config.usage.try_cooltvguide = ConfigYesNo(default=True)  # [iq]
    # iqteam ]
    config.streaming = ConfigSubsection()
    config.streaming.stream_ecm = ConfigYesNo(default=False)
    config.streaming.descramble = ConfigYesNo(default=True)
    config.streaming.stream_eit = ConfigYesNo(default=True)
    config.streaming.stream_ait = ConfigYesNo(default=True)
Exemplo n.º 25
0
def InitUsageConfig():
	config.usage = ConfigSubsection()
	config.usage.showdish = ConfigYesNo(default = True)
	config.misc.showrotorposition = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("withtext", _("with text")), ("tunername", _("with tuner name"))])
	config.usage.multibouquet = ConfigYesNo(default = True)

	config.usage.alternative_number_mode = ConfigYesNo(default = False)
	def alternativeNumberModeChange(configElement):
		eDVBDB.getInstance().setNumberingMode(configElement.value)
		refreshServiceList()
	config.usage.alternative_number_mode.addNotifier(alternativeNumberModeChange)

	config.usage.hide_number_markers = ConfigYesNo(default = True)
	config.usage.hide_number_markers.addNotifier(refreshServiceList)

	config.usage.servicetype_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
	config.usage.servicetype_icon_mode.addNotifier(refreshServiceList)
	config.usage.crypto_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
	config.usage.crypto_icon_mode.addNotifier(refreshServiceList)
	config.usage.record_indicator_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename")), ("3", _("Red colored"))])
	config.usage.record_indicator_mode.addNotifier(refreshServiceList)

	choicelist = [("-1", _("Disable"))]
	for i in range(0,1300,100):
		choicelist.append((str(i), ngettext("%d pixel wide", "%d pixels wide", i) % i))
	config.usage.servicelist_column = ConfigSelection(default="-1", choices=choicelist)
	config.usage.servicelist_column.addNotifier(refreshServiceList)

	config.usage.service_icon_enable = ConfigYesNo(default = False)
	config.usage.service_icon_enable.addNotifier(refreshServiceList)
	config.usage.servicelist_cursor_behavior = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")),
		("keep", _("Keep service")),
		("reverseB", _("Reverse bouquet buttons")),
		("keep reverseB", _("Keep service") + " + " + _("Reverse bouquet buttons"))])

	config.usage.multiepg_ask_bouquet = ConfigYesNo(default = False)

	config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
	config.usage.e1like_radio_mode = ConfigYesNo(default = True)
	choicelist = [("0", _("No timeout"))]
	for i in range(1, 12):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	config.usage.infobar_timeout = ConfigSelection(default = "5", choices = choicelist)
	config.usage.show_infobar_on_zap = ConfigYesNo(default = True)
	config.usage.show_infobar_on_skip = ConfigYesNo(default = True)
	config.usage.show_infobar_on_event_change = ConfigYesNo(default = False)
	config.usage.show_second_infobar = ConfigSelection(default = None, choices = [(None, _("None"))] + choicelist + [("EPG",_("EPG"))])
	config.usage.infobar_frontend_source = ConfigSelection(default = "tuner", choices = [("settings", _("Settings")), ("tuner", _("Tuner"))])
	config.usage.oldstyle_zap_controls = ConfigYesNo(default = False)
	config.usage.oldstyle_channel_select_controls = ConfigYesNo(default = False)
	config.usage.zap_with_ch_buttons = ConfigYesNo(default = False)
	config.usage.ok_is_channelselection = ConfigYesNo(default = False)
	config.usage.volume_instead_of_channelselection = ConfigYesNo(default = False)
	config.usage.channelselection_preview = ConfigYesNo(default = False)
	config.usage.show_spinner = ConfigYesNo(default = True)
	config.usage.enable_tt_caching = ConfigYesNo(default = True)
	choicelist = []
	for i in (10, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300, 600, 1200, 1800):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	for i in (3600, 7200, 14400):
		h = i / 3600
		choicelist.append((str(i), ngettext("%d hour", "%d hours", h) % h))
	config.usage.hdd_standby = ConfigSelection(default = "300", choices = [("0", _("No standby"))] + choicelist)
	config.usage.output_12V = ConfigSelection(default = "do not change", choices = [
		("do not change", _("Do not change")), ("off", _("Off")), ("on", _("On")) ])

	config.usage.pip_zero_button = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")), ("swap", _("Swap PiP and main picture")),
		("swapstop", _("Move PiP to main picture")), ("stop", _("Stop PiP")) ])
	config.usage.pip_hideOnExit = ConfigSelection(default = "without popup", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")) ])
	choicelist = [("-1", _("Disabled")), ("0", _("No timeout"))]
	for i in [60, 300, 600, 900, 1800, 2700, 3600]:
		m = i/60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.pip_last_service_timeout = ConfigSelection(default = "0", choices = choicelist)

	config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
	config.usage.timer_path = ConfigText(default = "<default>")
	config.usage.instantrec_path = ConfigText(default = "<default>")
	config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
	config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])

	config.usage.movielist_trashcan = ConfigYesNo(default=True)
	config.usage.movielist_trashcan_days = ConfigNumber(default=8)
	config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
	config.usage.on_movie_start = ConfigSelection(default = "resume", choices = [
		("ask yes", _("Ask user") + " " + _("default") + " " + _("yes")),
		("ask no", _("Ask user") + " " + _("default") + " " + _("no")),
		("resume", _("Resume from last position")),
		("beginning", _("Start from the beginning"))])
	config.usage.on_movie_stop = ConfigSelection(default = "movielist", choices = [
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")) ])
	config.usage.on_movie_eof = ConfigSelection(default = "movielist", choices = [
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")), ("pause", _("Pause movie at end")), ("playlist", _("Play next (return to movie list)")),
		("playlistquit", _("Play next (return to previous service)")), ("loop", _("Continues play (loop)")), ("repeatcurrent", _("Repeat"))])
	config.usage.next_movie_msg = ConfigYesNo(default = True)
	config.usage.last_movie_played = ConfigText()
	config.usage.leave_movieplayer_onExit = ConfigSelection(default = "popup", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")), ("movielist", _("Return to movie list")) ])

	config.usage.setup_level = ConfigSelection(default = "expert", choices = [
		("simple", _("Simple")),
		("intermediate", _("Intermediate")),
		("expert", _("Expert")) ])

	config.usage.startup_to_standby = ConfigSelection(default = "no", choices = [
		("no", _("No")),
		("yes", _("Yes")),
		("except", _("No, except Wakeup timer")) ])

	config.usage.wakeup_menu = ConfigNothing()
	config.usage.wakeup_enabled = ConfigYesNo(default = False)
	config.usage.wakeup_day = ConfigSubDict()
	config.usage.wakeup_time = ConfigSubDict()
	for i in range(7):
		config.usage.wakeup_day[i] = ConfigEnableDisable(default = False)
		config.usage.wakeup_time[i] = ConfigClock(default = ((6 * 60 + 0) * 60))

	config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [
		("show_menu", _("Show shutdown menu")),
		("shutdown", _("Immediate shutdown")),
		("standby", _("Standby")) ] )

	config.usage.on_short_powerpress = ConfigSelection(default = "standby", choices = [
		("show_menu", _("Show shutdown menu")),
		("shutdown", _("Immediate shutdown")),
		("standby", _("Standby")) ] )

	choicelist = [("0", _("Do nothing"))]
	for i in range(3600, 21601, 3600):
		h = abs(i / 3600)
		h = ngettext("%d hour", "%d hours", h) % h
		choicelist.append((str(i), _("Standby in ") + h))
	config.usage.inactivity_timer = ConfigSelection(default = "0", choices = choicelist)
	config.usage.inactivity_timer_blocktime = ConfigYesNo(default = True)
	config.usage.inactivity_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_end = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default = False)
	config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(default = time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled")),("event_standby", _("Standby after current event"))]
	for i in range(900, 7201, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("Standby in ") + m))
	config.usage.sleep_timer = ConfigSelection(default = "0", choices = choicelist)

	choicelist = [("0", _("Disabled"))]
	for i in [60, 300, 600] + range(900, 7201, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("after ") + m))
	config.usage.standby_to_shutdown_timer = ConfigSelection(default = "0", choices = choicelist)
	config.usage.standby_to_shutdown_timer_blocktime = ConfigYesNo(default = True)
	config.usage.standby_to_shutdown_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.standby_to_shutdown_timer_blocktime_end = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled"))]
	for m in (1, 5, 10, 15, 30, 60):
		choicelist.append((str(m * 60), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.screen_saver = ConfigSelection(default = "300", choices = choicelist)

	config.usage.check_timeshift = ConfigYesNo(default = True)

	choicelist = [("0", _("Disabled"))]
	for i in (2, 3, 4, 5, 10, 20, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.timeshift_start_delay = ConfigSelection(default = "0", choices = choicelist)

	config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
		("0", "DVB-S/-C/-T"),
		("1", "DVB-S/-T/-C"),
		("2", "DVB-C/-S/-T"),
		("3", "DVB-C/-T/-S"),
		("4", "DVB-T/-C/-S"),
		("5", "DVB-T/-S/-C"),
		("127", _("No priority")) ])

	config.usage.remote_fallback_enabled = ConfigYesNo(default = False)
	config.usage.remote_fallback = ConfigText(default = "", fixed_size = False)
	config.usage.show_timer_conflict_warning = ConfigYesNo(default = True)

	dvbs_nims = [("-2", _("Disabled"))]
	dvbt_nims = [("-2", _("Disabled"))]
	dvbc_nims = [("-2", _("Disabled"))]
	nims = [("-1", _("auto"))]
	for x in nimmanager.nim_slots:
		if x.isCompatible("DVB-S"):
			dvbs_nims.append((str(x.slot), x.getSlotName()))
		elif x.isCompatible("DVB-T"):
			dvbt_nims.append((str(x.slot), x.getSlotName()))
		elif x.isCompatible("DVB-C"):
			dvbc_nims.append((str(x.slot), x.getSlotName()))
		nims.append((str(x.slot), x.getSlotName()))
	config.usage.frontend_priority = ConfigSelection(default = "-1", choices = list(nims))
	nims.insert(0,("-2", _("Disabled")))
	config.usage.recording_frontend_priority = ConfigSelection(default = "-2", choices = nims)
	config.usage.frontend_priority_dvbs = ConfigSelection(default = "-2", choices = list(dvbs_nims))
	dvbs_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbs = ConfigSelection(default = "-2", choices = dvbs_nims)
	config.usage.frontend_priority_dvbt = ConfigSelection(default = "-2", choices = list(dvbt_nims))
	dvbt_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbt = ConfigSelection(default = "-2", choices = dvbt_nims)
	config.usage.frontend_priority_dvbc = ConfigSelection(default = "-2", choices = list(dvbc_nims))
	dvbc_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbc = ConfigSelection(default = "-2", choices = dvbc_nims)
	SystemInfo["DVB-S_priority_tuner_available"] = len(dvbs_nims) > 3 and (len(dvbt_nims) > 2 or len(dvbc_nims) > 2)
	SystemInfo["DVB-T_priority_tuner_available"] = len(dvbt_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbc_nims) > 2)
	SystemInfo["DVB-C_priority_tuner_available"] = len(dvbc_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbt_nims) > 2)

	config.misc.disable_background_scan = ConfigYesNo(default = False)
	config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barright', choices = [
		('barleft', _("Progress bar left")),
		('barright', _("Progress bar right")),
		('percleft', _("Percentage left")),
		('percright', _("Percentage right")),
		('no', _("No")) ])
	config.usage.show_channel_numbers_in_servicelist = ConfigYesNo(default = True)
	config.usage.show_event_progress_in_servicelist.addNotifier(refreshServiceList)
	config.usage.show_channel_numbers_in_servicelist.addNotifier(refreshServiceList)

	config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)

	config.usage.show_message_when_recording_starts = ConfigYesNo(default = True)

	config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default = True)
	config.usage.show_icons_in_movielist = ConfigSelection(default = 'i', choices = [
		('o', _("Off")),
		('p', _("Progress")),
		('s', _("Small progress")),
		('i', _("Icons")),
	])
	config.usage.movielist_unseen = ConfigYesNo(default = False)

	config.usage.swap_snr_on_osd = ConfigYesNo(default = False)

	def SpinnerOnOffChanged(configElement):
		setSpinnerOnOff(int(configElement.value))
	config.usage.show_spinner.addNotifier(SpinnerOnOffChanged)

	def EnableTtCachingChanged(configElement):
		setEnableTtCachingOnOff(int(configElement.value))
	config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

	def TunerTypePriorityOrderChanged(configElement):
		setTunerTypePriorityOrder(int(configElement.value))
	config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)

	def PreferredTunerChanged(configElement):
		setPreferredTuner(int(configElement.value))
	config.usage.frontend_priority.addNotifier(PreferredTunerChanged)

	config.usage.hide_zap_errors = ConfigYesNo(default = False)
	config.usage.hide_ci_messages = ConfigYesNo(default = True)
	config.usage.show_cryptoinfo = ConfigYesNo(default = True)
	config.usage.show_eit_nownext = ConfigYesNo(default = True)
	config.usage.show_vcr_scart = ConfigYesNo(default = False)
	config.usage.show_update_disclaimer = ConfigYesNo(default = True)
	config.usage.pic_resolution = ConfigSelection(default = None, choices = [(None, _("Same resolution as skin")), ("(720, 576)","720x576"), ("(1280, 720)", "1280x720"), ("(1920, 1080)", "1920x1080")])

	if SystemInfo["Fan"]:
		choicelist = [('off', _("Off")), ('on', _("On")), ('auto', _("Auto"))]
		if os.path.exists("/proc/stb/fp/fan_choices"):
			choicelist = [x for x in choicelist if x[0] in open("/proc/stb/fp/fan_choices", "r").read().strip().split(" ")]
		config.usage.fan = ConfigSelection(choicelist)
		def fanChanged(configElement):
			open(SystemInfo["Fan"], "w").write(configElement.value)
		config.usage.fan.addNotifier(fanChanged)

	if SystemInfo["FanPWM"]:
		def fanSpeedChanged(configElement):
			open(SystemInfo["FanPWM"], "w").write(hex(configElement.value)[2:])
		config.usage.fanspeed = ConfigSlider(default=127, increment=8, limits=(0, 255))
		config.usage.fanspeed.addNotifier(fanSpeedChanged)

	if SystemInfo["StandbyLED"]:
		def standbyLEDChanged(configElement):
			open(SystemInfo["StandbyLED"], "w").write(configElement.value and "on" or "off")
		config.usage.standbyLED = ConfigYesNo(default = True)
		config.usage.standbyLED.addNotifier(standbyLEDChanged)

	if SystemInfo["WakeOnLAN"]:
		def wakeOnLANChanged(configElement):
			if "fp" in SystemInfo["WakeOnLAN"]:
				open(SystemInfo["WakeOnLAN"], "w").write(configElement.value and "enable" or "disable")
			else:
				open(SystemInfo["WakeOnLAN"], "w").write(configElement.value and "on" or "off")
		config.usage.wakeOnLAN = ConfigYesNo(default = False)
		config.usage.wakeOnLAN.addNotifier(wakeOnLANChanged)

	config.epg = ConfigSubsection()
	config.epg.eit = ConfigYesNo(default = True)
	config.epg.mhw = ConfigYesNo(default = False)
	config.epg.freesat = ConfigYesNo(default = True)
	config.epg.viasat = ConfigYesNo(default = True)
	config.epg.netmed = ConfigYesNo(default = True)
	config.epg.virgin = ConfigYesNo(default = False)
	config.misc.showradiopic = ConfigYesNo(default = True)
	def EpgSettingsChanged(configElement):
		from enigma import eEPGCache
		mask = 0xffffffff
		if not config.epg.eit.value:
			mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE | eEPGCache.SCHEDULE_OTHER)
		if not config.epg.mhw.value:
			mask &= ~eEPGCache.MHW
		if not config.epg.freesat.value:
			mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE | eEPGCache.FREESAT_SCHEDULE_OTHER)
		if not config.epg.viasat.value:
			mask &= ~eEPGCache.VIASAT
		if not config.epg.netmed.value:
			mask &= ~(eEPGCache.NETMED_SCHEDULE | eEPGCache.NETMED_SCHEDULE_OTHER)
		if not config.epg.virgin.value:
			mask &= ~(eEPGCache.VIRGIN_NOWNEXT | eEPGCache.VIRGIN_SCHEDULE)
		eEPGCache.getInstance().setEpgSources(mask)
	config.epg.eit.addNotifier(EpgSettingsChanged)
	config.epg.mhw.addNotifier(EpgSettingsChanged)
	config.epg.freesat.addNotifier(EpgSettingsChanged)
	config.epg.viasat.addNotifier(EpgSettingsChanged)
	config.epg.netmed.addNotifier(EpgSettingsChanged)
	config.epg.virgin.addNotifier(EpgSettingsChanged)

	config.epg.histminutes = ConfigSelectionNumber(min = 0, max = 120, stepwidth = 15, default = 0, wraparound = True)
	def EpgHistorySecondsChanged(configElement):
		from enigma import eEPGCache
		eEPGCache.getInstance().setEpgHistorySeconds(config.epg.histminutes.getValue()*60)
	config.epg.histminutes.addNotifier(EpgHistorySecondsChanged)

	def setHDDStandby(configElement):
		for hdd in harddiskmanager.HDDList():
			hdd[1].setIdleTime(int(configElement.value))
	config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False)

	if SystemInfo["12V_Output"]:
		def set12VOutput(configElement):
			Misc_Options.getInstance().set_12V_output(configElement.value == "on" and 1 or 0)
		config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)

	config.usage.keymap = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keymap.xml"))
	config.usage.keytrans = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keytranslation.xml"))

	config.seek = ConfigSubsection()
	config.seek.selfdefined_13 = ConfigNumber(default=15)
	config.seek.selfdefined_46 = ConfigNumber(default=60)
	config.seek.selfdefined_79 = ConfigNumber(default=300)

	config.seek.speeds_forward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_backward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])

	config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
	config.seek.enter_backward = ConfigSelection(default = "1", choices = ["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])

	config.seek.on_pause = ConfigSelection(default = "play", choices = [
		("play", _("Play")),
		("step", _("Single step (GOP)")),
		("last", _("Last speed")) ])

	config.usage.timerlist_finished_timer_position = ConfigSelection(default = "end", choices = [("beginning", _("At beginning")), ("end", _("At end"))])

	def updateEnterForward(configElement):
		if not configElement.value:
			configElement.value = [2]
		updateChoices(config.seek.enter_forward, configElement.value)

	config.seek.speeds_forward.addNotifier(updateEnterForward, immediate_feedback = False)

	def updateEnterBackward(configElement):
		if not configElement.value:
			configElement.value = [2]
		updateChoices(config.seek.enter_backward, configElement.value)

	config.seek.speeds_backward.addNotifier(updateEnterBackward, immediate_feedback = False)

	def updateEraseSpeed(el):
		eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.value))
	def updateEraseFlags(el):
		eBackgroundFileEraser.getInstance().setEraseFlags(int(el.value))
	config.misc.erase_speed = ConfigSelection(default="20", choices = [
		("10", "10 MB/s"),
		("20", "20 MB/s"),
		("50", "50 MB/s"),
		("100", "100 MB/s")])
	config.misc.erase_speed.addNotifier(updateEraseSpeed, immediate_feedback = False)
	config.misc.erase_flags = ConfigSelection(default="1", choices = [
		("0", _("Disable")),
		("1", _("Internal hdd only")),
		("3", _("Everywhere"))])
	config.misc.erase_flags.addNotifier(updateEraseFlags, immediate_feedback = False)

	if SystemInfo["ZapMode"]:
		def setZapmode(el):
			open(SystemInfo["ZapMode"], "w").write(el.value)
		config.misc.zapmode = ConfigSelection(default = "mute", choices = [
			("mute", _("Black screen")), ("hold", _("Hold screen")), ("mutetilllock", _("Black screen till locked")), ("holdtilllock", _("Hold till locked"))])
		config.misc.zapmode.addNotifier(setZapmode, immediate_feedback = False)

	if SystemInfo["VFD_scroll_repeats"]:
		def scroll_repeats(el):
			open(SystemInfo["VFD_scroll_repeats"], "w").write(el.value)
		choicelist = []
		for i in range(1, 11, 1):
			choicelist.append((str(i)))
		config.usage.vfd_scroll_repeats = ConfigSelection(default = "3", choices = choicelist)
		config.usage.vfd_scroll_repeats.addNotifier(scroll_repeats, immediate_feedback = False)

	if SystemInfo["VFD_scroll_delay"]:
		def scroll_delay(el):
			open(SystemInfo["VFD_scroll_delay"], "w").write(el.value)
		choicelist = []
		for i in range(0, 1001, 50):
			choicelist.append((str(i)))
		config.usage.vfd_scroll_delay = ConfigSelection(default = "150", choices = choicelist)
		config.usage.vfd_scroll_delay.addNotifier(scroll_delay, immediate_feedback = False)

	if SystemInfo["VFD_initial_scroll_delay"]:
		def initial_scroll_delay(el):
			open(SystemInfo["VFD_initial_scroll_delay"], "w").write(el.value)
		choicelist = []
		for i in range(0, 20001, 500):
			choicelist.append((str(i)))
		config.usage.vfd_initial_scroll_delay = ConfigSelection(default = "1000", choices = choicelist)
		config.usage.vfd_initial_scroll_delay.addNotifier(initial_scroll_delay, immediate_feedback = False)

	if SystemInfo["VFD_final_scroll_delay"]:
		def final_scroll_delay(el):
			open(SystemInfo["VFD_final_scroll_delay"], "w").write(el.value)
		choicelist = []
		for i in range(0, 20001, 500):
			choicelist.append((str(i)))
		config.usage.vfd_final_scroll_delay = ConfigSelection(default = "1000", choices = choicelist)
		config.usage.vfd_final_scroll_delay.addNotifier(final_scroll_delay, immediate_feedback = False)

	config.subtitles = ConfigSubsection()
	config.subtitles.ttx_subtitle_colors = ConfigSelection(default = "1", choices = [
		("0", _("original")),
		("1", _("white")),
		("2", _("yellow")) ])
	config.subtitles.ttx_subtitle_original_position = ConfigYesNo(default = False)
	config.subtitles.subtitle_position = ConfigSelection( choices = ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "150", "200", "250", "300", "350", "400", "450"], default = "50")
	config.subtitles.subtitle_alignment = ConfigSelection(choices = [("left", _("left")), ("center", _("center")), ("right", _("right"))], default = "center")
	config.subtitles.subtitle_rewrap = ConfigYesNo(default = False)
	config.subtitles.colourise_dialogs = ConfigYesNo(default = False)
	config.subtitles.subtitle_borderwidth = ConfigSelection(choices = ["1", "2", "3", "4", "5"], default = "3")
	config.subtitles.subtitle_fontsize  = ConfigSelection(choices = ["%d" % x for x in range(16,101) if not x % 2], default = "40")
	config.subtitles.showbackground = ConfigYesNo(default = False)

	subtitle_delay_choicelist = []
	for i in range(-900000, 1845000, 45000):
		if i == 0:
			subtitle_delay_choicelist.append(("0", _("No delay")))
		else:
			subtitle_delay_choicelist.append((str(i), "%2.1f sec" % (i / 90000.)))
	config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(default = "315000", choices = subtitle_delay_choicelist)

	config.subtitles.dvb_subtitles_yellow = ConfigYesNo(default = False)
	config.subtitles.dvb_subtitles_original_position = ConfigSelection(default = "0", choices = [("0", _("Original")), ("1", _("Fixed")), ("2", _("Relative"))])
	config.subtitles.dvb_subtitles_centered = ConfigYesNo(default = True)
	config.subtitles.subtitle_bad_timing_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
	config.subtitles.dvb_subtitles_backtrans = ConfigSelection(default = "0", choices = [
		("0", _("No transparency")),
		("25", "10%"),
		("50", "20%"),
		("75", "30%"),
		("100", "40%"),
		("125", "50%"),
		("150", "60%"),
		("175", "70%"),
		("200", "80%"),
		("225", "90%"),
		("255", _("Full transparency"))])
	config.subtitles.pango_subtitle_colors = ConfigSelection(default = "1", choices = [
		("0", _("alternative")),
		("1", _("white")),
		("2", _("yellow")) ])
	config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default = True)
	config.subtitles.pango_subtitles_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
	config.subtitles.pango_subtitles_fps = ConfigSelection(default = "1", choices = [
		("1", _("Original")),
		("23976", _("23.976")),
		("24000", _("24")),
		("25000", _("25")),
		("29970", _("29.97")),
		("30000", _("30"))])
	config.subtitles.pango_autoturnon = ConfigYesNo(default = True)

	config.autolanguage = ConfigSubsection()
	audio_language_choices=[
		("---", _("None")),
		("orj dos ory org esl qaa und mis mul ORY ORJ Audio_ORJ", _("Original")),
		("ara", _("Arabic")),
		("eus baq", _("Basque")),
		("bul", _("Bulgarian")),
		("hrv", _("Croatian")),
		("ces cze", _("Czech")),
		("dan", _("Danish")),
		("dut ndl", _("Dutch")),
		("eng qaa", _("English")),
		("est", _("Estonian")),
		("fin", _("Finnish")),
		("fra fre", _("French")),
		("deu ger", _("German")),
		("ell gre", _("Greek")),
		("heb", _("Hebrew")),
		("hun", _("Hungarian")),
		("ita", _("Italian")),
		("lav", _("Latvian")),
		("lit", _("Lithuanian")),
		("ltz", _("Luxembourgish")),
		("nor", _("Norwegian")),
		("pol", _("Polish")),
		("por dub DUB", _("Portuguese")),
		("fas per", _("Persian")),
		("ron rum", _("Romanian")),
		("rus", _("Russian")),
		("srp", _("Serbian")),
		("slk slo", _("Slovak")),
		("slv", _("Slovenian")),
		("spa", _("Spanish")),
		("swe", _("Swedish")),
		("tha", _("Thai")),
		("tur Audio_TUR", _("Turkish")),
		("ukr Ukr", _("Ukrainian"))]

	def setEpgLanguage(configElement):
		eServiceEvent.setEPGLanguage(configElement.value)
	config.autolanguage.audio_epglanguage = ConfigSelection(audio_language_choices[:1] + audio_language_choices [2:], default="---")
	config.autolanguage.audio_epglanguage.addNotifier(setEpgLanguage)

	def setEpgLanguageAlternative(configElement):
		eServiceEvent.setEPGLanguageAlternative(configElement.value)
	config.autolanguage.audio_epglanguage_alternative = ConfigSelection(audio_language_choices[:1] + audio_language_choices [2:], default="---")
	config.autolanguage.audio_epglanguage_alternative.addNotifier(setEpgLanguageAlternative)

	config.autolanguage.audio_autoselect1 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect2 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect3 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect4 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_defaultac3 = ConfigYesNo(default = False)
	config.autolanguage.audio_defaultddp = ConfigYesNo(default = False)
	config.autolanguage.audio_usecache = ConfigYesNo(default = True)

	subtitle_language_choices = audio_language_choices[:1] + audio_language_choices [2:]
	config.autolanguage.subtitle_autoselect1 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect2 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect3 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect4 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_hearingimpaired = ConfigYesNo(default = False)
	config.autolanguage.subtitle_defaultimpaired = ConfigYesNo(default = False)
	config.autolanguage.subtitle_defaultdvb = ConfigYesNo(default = False)
	config.autolanguage.subtitle_usecache = ConfigYesNo(default = True)
	config.autolanguage.equal_languages = ConfigSelection(default = "15", choices = [
		("0", _("None")),("1", "1"),("2", "2"),("3", "1,2"),
		("4", "3"),("5", "1,3"),("6", "2,3"),("7", "1,2,3"),
		("8", "4"),("9", "1,4"),("10", "2,4"),("11", "1,2,4"),
		("12", "3,4"),("13", "1,3,4"),("14", "2,3,4"),("15", _("All"))])

	config.streaming = ConfigSubsection()
	config.streaming.stream_ecm = ConfigYesNo(default = False)
	config.streaming.descramble = ConfigYesNo(default = True)
	config.streaming.descramble_client = ConfigYesNo(default = False)
	config.streaming.stream_eit = ConfigYesNo(default = True)
	config.streaming.stream_ait = ConfigYesNo(default = True)
	config.streaming.authentication = ConfigYesNo(default = False)
Exemplo n.º 26
0
def InitUsageConfig():
    config.usage = ConfigSubsection()
    config.usage.showdish = ConfigYesNo(default=True)
    config.usage.multibouquet = ConfigYesNo(default=False)
    config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)

    config.usage.quickzap_bouquet_change = ConfigYesNo(default=False)
    config.usage.e1like_radio_mode = ConfigYesNo(default=False)
    config.usage.infobar_timeout = ConfigSelection(
        default="5",
        choices=[("0", _("no timeout")), ("1", "1 " + _("second")),
                 ("2", "2 " + _("seconds")), ("3", "3 " + _("seconds")),
                 ("4", "4 " + _("seconds")), ("5", "5 " + _("seconds")),
                 ("6", "6 " + _("seconds")), ("7", "7 " + _("seconds")),
                 ("8", "8 " + _("seconds")), ("9", "9 " + _("seconds")),
                 ("10", "10 " + _("seconds"))])
    config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
    config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
    config.usage.show_infobar_on_event_change = ConfigYesNo(default=True)
    config.usage.hdd_standby = ConfigSelection(
        default="600",
        choices=[("0", _("no standby")), ("10", "10 " + _("seconds")),
                 ("30", "30 " + _("seconds")), ("60", "1 " + _("minute")),
                 ("120", "2 " + _("minutes")), ("300", "5 " + _("minutes")),
                 ("600", "10 " + _("minutes")), ("1200", "20 " + _("minutes")),
                 ("1800", "30 " + _("minutes")), ("3600", "1 " + _("hour")),
                 ("7200", "2 " + _("hours")), ("14400", "4 " + _("hours"))])
    config.usage.output_12V = ConfigSelection(default="do not change",
                                              choices=[("do not change",
                                                        _("do not change")),
                                                       ("off", _("off")),
                                                       ("on", _("on"))])

    config.usage.pip_zero_button = ConfigSelection(
        default="standard",
        choices=[("standard", _("standard")),
                 ("swap", _("swap PiP and main picture")),
                 ("swapstop", _("move PiP to main picture")),
                 ("stop", _("stop PiP"))])

    config.usage.default_path = ConfigText(default="")
    config.usage.timer_path = ConfigText(default="<default>")
    config.usage.instantrec_path = ConfigText(default="<default>")
    config.usage.timeshift_path = ConfigText(default="/media/hdd/")
    config.usage.allowed_timeshift_paths = ConfigLocations(
        default=["/media/hdd/"])

    config.usage.hide_number_markers = ConfigYesNo(default=False)
    config.usage.hide_number_markers.addNotifier(refreshServiceList)

    config.usage.on_movie_start = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("resume", _("Resume from last position")),
                 ("beginning", _("Start from the beginning"))])
    config.usage.on_movie_stop = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service"))])
    config.usage.on_movie_eof = ConfigSelection(
        default="ask",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service")),
                 ("pause", _("Pause movie at end"))])

    config.usage.setup_level = ConfigSelection(default="intermediate",
                                               choices=[
                                                   ("simple", _("Simple")),
                                                   ("intermediate",
                                                    _("Intermediate")),
                                                   ("expert", _("Expert"))
                                               ])

    config.usage.on_long_powerpress = ConfigSelection(
        default="show_menu",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby"))])

    config.usage.on_short_powerpress = ConfigSelection(
        default="standby",
        choices=[("show_menu", _("show shutdown menu")),
                 ("shutdown", _("immediate shutdown")),
                 ("standby", _("Standby"))])

    config.usage.alternatives_priority = ConfigSelection(
        default="0",
        choices=[("0", "DVB-S/-C/-T"), ("1", "DVB-S/-T/-C"),
                 ("2", "DVB-C/-S/-T"), ("3", "DVB-C/-T/-S"),
                 ("4", "DVB-T/-C/-S"), ("5", "DVB-T/-S/-C")])

    nims = [("-1", _("auto"))]
    for x in nimmanager.nim_slots:
        nims.append((str(x.slot), x.getSlotName()))
    config.usage.frontend_priority = ConfigSelection(default="-1",
                                                     choices=nims)

    config.usage.service_icon_enable = ConfigYesNo(default=False)
    config.usage.service_icon_enable.addNotifier(refreshServiceList)

    config.usage.show_event_progress_in_servicelist = ConfigYesNo(
        default=False)
    config.usage.show_event_progress_in_servicelist.addNotifier(
        refreshServiceList)

    config.usage.blinking_display_clock_during_recording = ConfigYesNo(
        default=False)

    config.usage.show_message_when_recording_starts = ConfigYesNo(default=True)

    config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(
        default=True)

    def TunerTypePriorityOrderChanged(configElement):
        setTunerTypePriorityOrder(int(configElement.value))

    config.usage.alternatives_priority.addNotifier(
        TunerTypePriorityOrderChanged, immediate_feedback=False)

    def PreferredTunerChanged(configElement):
        setPreferredTuner(int(configElement.value))

    config.usage.frontend_priority.addNotifier(PreferredTunerChanged)

    config.epg = ConfigSubsection()
    config.epg.eit = ConfigYesNo(default=True)
    config.epg.mhw = ConfigYesNo(default=False)
    config.epg.freesat = ConfigYesNo(default=True)
    config.epg.viasat = ConfigYesNo(default=True)
    config.epg.netmed = ConfigYesNo(default=True)
    config.epg.virgin = ConfigYesNo(default=False)

    def EpgSettingsChanged(configElement):
        from enigma import eEPGCache
        mask = 0xffffffff
        if not config.epg.eit.value:
            mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE
                      | eEPGCache.SCHEDULE_OTHER)
        if not config.epg.mhw.value:
            mask &= ~eEPGCache.MHW
        if not config.epg.freesat.value:
            mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE
                      | eEPGCache.FREESAT_SCHEDULE_OTHER)
        if not config.epg.viasat.value:
            mask &= ~eEPGCache.VIASAT
        #if not config.epg.netmed.value:
        #	mask &= ~(eEPGCache.NETMED_SCHEDULE | eEPGCache.NETMED_SCHEDULE_OTHER)
        #if not config.epg.virgin.value:
        #	mask &= ~(eEPGCache.VIRGIN_NOWNEXT | eEPGCache.VIRGIN_SCHEDULE)
        eEPGCache.getInstance().setEpgSources(mask)

    config.epg.eit.addNotifier(EpgSettingsChanged)
    config.epg.mhw.addNotifier(EpgSettingsChanged)
    config.epg.freesat.addNotifier(EpgSettingsChanged)
    config.epg.viasat.addNotifier(EpgSettingsChanged)
    config.epg.netmed.addNotifier(EpgSettingsChanged)
    config.epg.virgin.addNotifier(EpgSettingsChanged)

    config.epg.histminutes = ConfigSelectionNumber(min=0,
                                                   max=120,
                                                   stepwidth=15,
                                                   default=0,
                                                   wraparound=True)

    def EpgHistorySecondsChanged(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEpgHistorySeconds(
            config.epg.histminutes.getValue() * 60)

    config.epg.histminutes.addNotifier(EpgHistorySecondsChanged)

    def setHDDStandby(configElement):
        for hdd in harddiskmanager.HDDList():
            hdd[1].setIdleTime(int(configElement.value))

    config.usage.hdd_standby.addNotifier(setHDDStandby,
                                         immediate_feedback=False)

    def set12VOutput(configElement):
        if configElement.value == "on":
            Misc_Options.getInstance().set_12V_output(1)
        elif configElement.value == "off":
            Misc_Options.getInstance().set_12V_output(0)

    config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)

    SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()

    config.usage.keymap = ConfigText(
        default=eEnv.resolve("${datadir}/enigma2/keymap.xml"))

    config.seek = ConfigSubsection()
    config.seek.selfdefined_13 = ConfigNumber(default=15)
    config.seek.selfdefined_46 = ConfigNumber(default=60)
    config.seek.selfdefined_79 = ConfigNumber(default=300)

    config.seek.speeds_forward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_backward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8],
                                              choices=[2, 4, 6, 8, 12, 16, 25])

    config.seek.enter_forward = ConfigSelection(default="2",
                                                choices=[
                                                    "2", "4", "6", "8", "12",
                                                    "16", "24", "32", "48",
                                                    "64", "96", "128"
                                                ])
    config.seek.enter_backward = ConfigSelection(default="1",
                                                 choices=[
                                                     "1", "2", "4", "6", "8",
                                                     "12", "16", "24", "32",
                                                     "48", "64", "96", "128"
                                                 ])

    config.seek.on_pause = ConfigSelection(default="play",
                                           choices=[("play", _("Play")),
                                                    ("step",
                                                     _("Singlestep (GOP)")),
                                                    ("last", _("Last speed"))])

    config.usage.timerlist_finished_timer_position = ConfigSelection(
        default="beginning",
        choices=[("beginning", _("at beginning")), ("end", _("at end"))])

    def updateEnterForward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_forward, configElement.value)

    config.seek.speeds_forward.addNotifier(updateEnterForward,
                                           immediate_feedback=False)

    def updateEnterBackward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_backward, configElement.value)

    config.seek.speeds_backward.addNotifier(updateEnterBackward,
                                            immediate_feedback=False)

    config.subtitles = ConfigSubsection()
    config.subtitles.subtitle_fontcolor = ConfigSelection(
        default="0",
        choices=[("0", _("default")), ("1", _("white")), ("2", _("yellow")),
                 ("3", _("green")), ("4", _("cyan")), ("5", _("blue")),
                 ("6", _("magneta")), ("7", _("red")), ("8", _("black"))])
    config.subtitles.subtitle_fontsize = ConfigSelection(
        choices=["%d" % x for x in range(16, 101) if not x % 2], default="20")
    config.subtitles.subtitle_bgcolor = ConfigSelection(default="0",
                                                        choices=[
                                                            ("0", _("black")),
                                                            ("1", _("red")),
                                                            ("2",
                                                             _("magneta")),
                                                            ("3", _("blue")),
                                                            ("4", _("cyan")),
                                                            ("5", _("green")),
                                                            ("6", _("yellow")),
                                                            ("7", _("white"))
                                                        ])
    config.subtitles.subtitle_bgopacity = ConfigSelection(
        default="225",
        choices=[("0", _("No transparency")), ("25", "10%"), ("50", "20%"),
                 ("75", "30%"), ("100", "40%"), ("125", "50%"), ("150", "60%"),
                 ("175", "70%"), ("200", "80%"), ("225", "90%"),
                 ("255", _("Full transparency"))])
    config.subtitles.subtitle_edgestyle = ConfigSelection(default="2",
                                                          choices=[
                                                              ("0", "None"),
                                                              ("1", "Raised"),
                                                              ("2",
                                                               "Depressed"),
                                                              ("3", "Uniform")
                                                          ])
    config.subtitles.subtitle_edgestyle_level = ConfigSelection(
        choices=["0", "1", "2", "3", "4", "5"], default="3")
    config.subtitles.subtitle_opacity = ConfigSelection(
        default="0",
        choices=[("0", _("No transparency")), ("75", "25%"), ("150", "50%")])
    config.subtitles.subtitle_original_position = ConfigYesNo(default=True)
    config.subtitles.subtitle_alignment = ConfigSelection(choices=[
        ("left", _("left")), ("center", _("center")), ("right", _("right"))
    ],
                                                          default="center")
    config.subtitles.subtitle_position = ConfigSelection(choices=[
        "0", "50", "100", "150", "200", "250", "300", "350", "400", "450",
        "500", "550", "600"
    ],
                                                         default="100")

    config.subtitles.dvb_subtitles_centered = ConfigYesNo(default=False)

    subtitle_delay_choicelist = []
    for i in range(-900000, 1845000, 45000):
        if i == 0:
            subtitle_delay_choicelist.append(("0", _("No delay")))
        else:
            subtitle_delay_choicelist.append(
                (str(i), "%2.1f sec" % (i / 90000.)))
    config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(
        default="315000", choices=subtitle_delay_choicelist)
    config.subtitles.subtitle_bad_timing_delay = ConfigSelection(
        default="0", choices=subtitle_delay_choicelist)
    config.subtitles.subtitle_rewrap = ConfigYesNo(default=False)
    config.subtitles.colourise_dialogs = ConfigYesNo(default=False)
    config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default=True)
    config.subtitles.pango_subtitles_delay = ConfigSelection(
        default="0", choices=subtitle_delay_choicelist)
    config.subtitles.pango_subtitles_fps = ConfigSelection(
        default="1",
        choices=[("1", _("Original")), ("23976", _("23.976")),
                 ("24000", _("24")), ("25000", _("25")), ("29970", _("29.97")),
                 ("30000", _("30"))])
    config.subtitles.pango_autoturnon = ConfigYesNo(default=True)

    config.autolanguage = ConfigSubsection()
    epg_language_choices = [("---", _("None")), ("eng qaa", _("English")),
                            ("deu ger", _("German")), ("ara", _("Arabic")),
                            ("eus baq", _("Basque")), ("bul", _("Bulgarian")),
                            ("hrv", _("Croatian")), ("ces cze", _("Czech")),
                            ("dan", _("Danish")), ("dut ndl nld", _("Dutch")),
                            ("est", _("Estonian")), ("fin", _("Finnish")),
                            ("fra fre", _("French")), ("ell gre", _("Greek")),
                            ("heb", _("Hebrew")), ("hun", _("Hungarian")),
                            ("ita", _("Italian")), ("lav", _("Latvian")),
                            ("lit", _("Lithuanian")),
                            ("ltz", _("Luxembourgish")),
                            ("nor", _("Norwegian")),
                            ("fas per fa pes", _("Persian")),
                            ("pol", _("Polish")),
                            ("por dub Dub DUB ud1", _("Portuguese")),
                            ("ron rum", _("Romanian")), ("rus", _("Russian")),
                            ("srp", _("Serbian")), ("slk slo", _("Slovak")),
                            ("slv", _("Slovenian")), ("spa", _("Spanish")),
                            ("swe", _("Swedish")), ("tha", _("Thai")),
                            ("tur Audio_TUR", _("Turkish")),
                            ("ukr Ukr", _("Ukrainian"))]

    def setEpgLanguage(configElement):
        eServiceEvent.setEPGLanguage(configElement.value)

    config.autolanguage.epglanguage = ConfigSelection(epg_language_choices,
                                                      default="---")
    config.autolanguage.epglanguage.addNotifier(setEpgLanguage)

    def setEpgLanguageAlternative(configElement):
        eServiceEvent.setEPGLanguageAlternative(configElement.value)

    config.autolanguage.epglanguage_alternative = ConfigSelection(
        epg_language_choices, default="---")
    config.autolanguage.epglanguage_alternative.addNotifier(
        setEpgLanguageAlternative)
Exemplo n.º 27
0
def InitAVSwitch():
    config.av.yuvenabled = ConfigBoolean(default=True)
    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"),
        "all": _("All resolutions"),
        "hd": _("only HD")
    },
                                        default="disabled")
    choicelist = []
    for i in 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=15000,
                                                    stepwidth=500,
                                                    default=500,
                                                    wraparound=True)
    config.av.autores_deinterlace = ConfigYesNo(default=False)
    config.av.autores_sd = ConfigSelection(choices={
        "720p": _("720p"),
        "1080i": _("1080i")
    },
                                           default="720p")
    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")
    },
                                               default="1080p24")
    config.av.autores_1080p24 = ConfigSelection(choices={
        "1080p24": _("1080p 24Hz"),
        "1080p25": _("1080p 25Hz")
    },
                                                default="1080p24")
    config.av.autores_1080p25 = ConfigSelection(choices={
        "1080p25": _("1080p 25Hz"),
        "1080p50": _("1080p 50Hz")
    },
                                                default="1080p25")
    config.av.autores_1080p30 = ConfigSelection(choices={
        "1080p30": _("1080p 30Hz"),
        "1080p60": _("1080p 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.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")
    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: display as fullscreen, even if this breaks the aspect)
        "scale": _("Just scale")
    }
    if os.path.exists("/proc/stb/video/policy2_choices"):
        f = open("/proc/stb/video/policy2_choices")
        if "auto" in f.readline():
            # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
            policy2_choices.update({"auto": _("Auto")})
        f.close()
    config.av.policy_169 = ConfigSelection(choices=policy2_choices,
                                           default="letterbox")
    policy_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
        "panscan": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "letterbox": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
        # "nonlinear": _("Nonlinear"),
        # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
        "bestfit": _("Just scale")
    }
    if os.path.exists("/proc/stb/video/policy_choices"):
        f = open("/proc/stb/video/policy_choices")
        if "auto" in f.readline():
            # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
            policy_choices.update({"auto": _("Auto")})
        f.close()
    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:
            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
    SystemInfo["ScartSwitch"] = eAVSwitch.getInstance().haveScartSwitch()

    if SystemInfo["Canedidchecking"]:

        def setEDIDBypass(configElement):
            try:
                f = open("/proc/stb/hdmi/bypass_edid_checking", "w")
                f.write(configElement.value)
                f.close()
            except:
                pass

        if about.getChipSetString() in ('7111'):
            config.av.bypass_edid_checking = ConfigSelection(
                choices={
                    "00000000": _("off"),
                    "00000001": _("on")
                },
                default="00000001")
        else:
            config.av.bypass_edid_checking = ConfigSelection(
                choices={
                    "00000000": _("off"),
                    "00000001": _("on")
                },
                default="00000000")
        config.av.bypass_edid_checking.addNotifier(setEDIDBypass)
    else:
        config.av.bypass_edid_checking = ConfigNothing()

    if SystemInfo["havecolorspace"]:

        def setHDMIColorspace(configElement):
            try:
                f = open("/proc/stb/video/hdmi_colorspace", "w")
                f.write(configElement.value)
                f.close()
            except:
                pass

        if getBoxType() in ('vuzero4k', 'vusolo4k', 'vuuno4k', 'vuuno4kse',
                            'vuultimo4k'):
            config.av.hdmicolorspace = ConfigSelection(choices={
                "Edid(Auto)": _("Auto"),
                "Hdmi_Rgb": _("RGB"),
                "444": _("YCbCr444"),
                "422": _("YCbCr422"),
                "420": _("YCbCr420")
            },
                                                       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 SystemInfo["havecolorimetry"]:

        def setHDMIColorimetry(configElement):
            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 SystemInfo["haveboxmode"]:

        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":
            _("PIP enabled, no HDR"),
            "1":
            _("HDR, 12bit 4:2:0/4:2:2, no PIP")
        },
                                            default="12")
        config.av.boxmode.addNotifier(setBoxmode)
    else:
        config.av.boxmode = ConfigNothing()

    if SystemInfo["havehdmicolordepth"]:

        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 SystemInfo["Canaudiosource"]:

        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 SystemInfo["Can3DSurround"]:

        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 SystemInfo["Can3DSpeaker"]:

        def set3DSurroundSpeaker(configElement):
            f = open("/proc/stb/audio/3d_surround_speaker_position", "w")
            f.write(configElement.value)
            f.close()

        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 SystemInfo["CanAutoVolume"]:

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

    if SystemInfo["supportPcmMultichannel"]:

        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)

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")
            if SystemInfo.get("supportPcmMultichannel",
                              False) and not configElement.value:
                SystemInfo["CanPcmMultichannel"] = True
            else:
                SystemInfo["CanPcmMultichannel"] = False
                if SystemInfo["supportPcmMultichannel"]:
                    config.av.pcm_multichannel.setValue(False)

        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["CanAACTranscode"]:

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

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

    if SystemInfo["HasScaler_sharpness"]:

        def setScaler_sharpness(config):
            myval = int(config.value)
            try:
                print "[VideoHardware] setting scaler_sharpness to: %0.8X" % myval
                f = open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w")
                f.write("%0.8X" % myval)
                f.close()
                f = open("/proc/stb/vmpeg/0/pep_apply", "w")
                f.write("1")
                f.close()
            except IOError:
                print "[VideoHardware] 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())

    config.av.edid_override = ConfigYesNo(default=False)

    iAVSwitch.setConfiguredMode()
Exemplo n.º 28
0
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 openSPA 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"),
        "all": _("All resolutions"),
        "hd": _("only HD")
    },
                                        default="disabled")
    choicelist = []
    for i in 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=15000,
                                                    stepwidth=500,
                                                    default=500,
                                                    wraparound=True)
    config.av.autores_deinterlace = ConfigYesNo(default=False)
    config.av.autores_sd = ConfigSelection(choices={
        "720p": _("720p"),
        "1080i": _("1080i")
    },
                                           default="720p")
    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")
    },
                                               default="1080p24")
    config.av.autores_1080p24 = ConfigSelection(choices={
        "1080p24": _("1080p 24Hz"),
        "1080p25": _("1080p 25Hz")
    },
                                                default="1080p24")
    config.av.autores_1080p25 = ConfigSelection(choices={
        "1080p25": _("1080p 25Hz"),
        "1080p50": _("1080p 50Hz")
    },
                                                default="1080p25")
    config.av.autores_1080p30 = ConfigSelection(choices={
        "1080p30": _("1080p 30Hz"),
        "1080p60": _("1080p 60Hz")
    },
                                                default="1080p30")
    config.av.autores_2160p24 = ConfigSelection(choices={
        "2160p24": _("2160p 24Hz"),
        "2160p25": _("2160p 25Hz")
    },
                                                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.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")
    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: display as fullscreen, even if this breaks the aspect)
        "scale": _("Just scale")
    }
    if os.path.exists("/proc/stb/video/policy2_choices"):
        f = open("/proc/stb/video/policy2_choices")
        if "auto" in f.readline():
            # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
            policy2_choices.update({"auto": _("Auto")})
        f.close()
    config.av.policy_169 = ConfigSelection(choices=policy2_choices,
                                           default="letterbox")
    policy_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
        "panscan": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "letterbox": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
        # "nonlinear": _("Nonlinear"),
        # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
        "bestfit": _("Just scale")
    }
    if os.path.exists("/proc/stb/video/policy_choices"):
        f = open("/proc/stb/video/policy_choices")
        if "auto" in f.readline():
            # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
            policy_choices.update({"auto": _("Auto")})
        f.close()
    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")
                f.write(configElement.value)
                f.close()
            except:
                pass

        config.av.bypass_edid_checking = ConfigSelection(choices={
            "00000000": _("off"),
            "00000001": _("on")
        },
                                                         default="00000001")
        config.av.bypass_edid_checking.addNotifier(setEDIDBypass)
    else:
        config.av.bypass_edid_checking = ConfigNothing()

    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', 'vuultimo4k'):
            config.av.hdmicolorspace = ConfigSelection(choices={
                "Edid(Auto)": _("Auto"),
                "Hdmi_Rgb": _("RGB"),
                "444": _("YCbCr444"),
                "422": _("YCbCr422"),
                "420": _("YCbCr420")
            },
                                                       default="Edid(Auto)")
        elif getBoxType() in ('dm900'):
            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":
            _("PIP enabled, no HDR"),
            "1":
            _("HDR, 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/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):
            f = open("/proc/stb/audio/3d_surround_speaker_position", "w")
            f.write(configElement.value)
            f.close()

        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)

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

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

        choice_list = [("use_hdmi_caps", _("controlled by HDMI")),
                       ("force_ac3", _("always"))]
        config.av.transcodeac3plus = ConfigSelection(choices=choice_list,
                                                     default="use_hdmi_caps")
        config.av.transcodeac3plus.addNotifier(setAC3plusTranscode)

    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")
            f.write(configElement.value and "downmix" or "passthrough")
            f.close()

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

    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/vmpeg/0/pep_scaler_sharpness"):

        def setScaler_sharpness(config):
            myval = int(config.value)
            try:
                print "[VideoHardware] 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 "[VideoHardware] 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())

    config.av.edid_override = ConfigYesNo(default=False)

    iAVSwitch.setConfiguredMode()
Exemplo n.º 29
0
def InitLcd():
    if getBoxType() in ('gb800se', 'gb800solo', 'iqonios300hd', 'tmsingle',
                        'tmnano2super', 'vusolo', 'et4x00', 'et5x00',
                        'et6x00'):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()

    ilcd = LCD()

    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if SystemInfo["StandbyLED"]:

        def setLEDstandby(configElement):
            ilcd.setLEDStandby(configElement.value)

        config.usage.standbyLED = ConfigYesNo(default=True)
        config.usage.standbyLED.addNotifier(setLEDstandby)

    if SystemInfo["LEDButtons"]:

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

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

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

        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

    if detected:
        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 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 setLCDrepeat(configElement):
            ilcd.setRepeat(configElement.value)

        def setLCDscrollspeed(configElement):
            ilcd.setScrollspeed(configElement.value)

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

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

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

        standby_default = 0

        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["LCDMiniTV"]:
            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 fileExists("/proc/stb/lcd/scroll_delay"):
            config.lcd.scrollspeed = ConfigSlider(default=150,
                                                  increment=10,
                                                  limits=(0, 500))
            config.lcd.scrollspeed.addNotifier(setLCDscrollspeed)
        else:
            config.lcd.scrollspeed = ConfigNothing()
        if fileExists("/proc/stb/lcd/scroll_repeats"):
            config.lcd.repeat = ConfigSelection([("0", _("None")),
                                                 ("1", _("1X")),
                                                 ("2", _("2X")),
                                                 ("3", _("3X")),
                                                 ("4", _("4X")),
                                                 ("500", _("Continues"))], "3")
            config.lcd.repeat.addNotifier(setLCDrepeat)
        else:
            config.lcd.repeat = 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()

    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.mode = ConfigNothing()
        config.lcd.repeat = ConfigNothing()
        config.lcd.scrollspeed = 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)
Exemplo n.º 30
0
def InitLcd():
    if getBoxType() in ('amikomini', 'dynaspark', 'amiko8900',
                        'sognorevolution', 'arguspingulux',
                        'arguspinguluxmini', 'arguspinguluxplus',
                        'sparkreloaded', 'sabsolo', 'sparklx', 'gis8120',
                        'et4x00', 'et5x00', 'et6x00', 'gb800se', 'gb800solo',
                        'iqonios300hd', 'mbmicro', 'sf128', 'sf138',
                        'tmsingle', 'tmnano2super', 'tmnanose', 'tmnanoseplus',
                        'tmnanosem2', 'tmnanosem2plus', 'tmnanosecombo',
                        'vusolo'):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()

    ilcd = LCD()

    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if fileExists("/proc/stb/lcd/mode"):
        f = open("/proc/stb/lcd/mode", "r")
        can_lcdmodechecking = f.read().strip().split(" ")
        print 'LCDMiniTV', can_lcdmodechecking
        f.close()
    else:
        can_lcdmodechecking = False

    if SystemInfo["StandbyLED"]:

        def setLEDstandby(configElement):
            ilcd.setLEDStandby(configElement.value)

        config.usage.standbyLED = ConfigYesNo(default=True)
        config.usage.standbyLED.addNotifier(setLEDstandby)

    if SystemInfo["LEDButtons"]:

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

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

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

        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

    if detected:
        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 setLCDminitvmode(configElement):
            ilcd.setLCDMiniTVMode(configElement.value)

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

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

        standby_default = 0

        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.dimbright = ConfigSlider(default=standby_default,
                                            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.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):
                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)

        if SystemInfo["LCDMiniTV"] and getBoxType() not in ('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)
        elif can_lcdmodechecking and getBoxType() in ('gbquad4k', 'gbue4k'):
            #  (0:normal, 1:video0, 2:fb, 3:vide0+fb, 4:video1, 5:vide0+video1, 6:video1+fb, 7:video0+video1+fb)
            config.lcd.minitvmode = ConfigSelection(
                default="0",
                choices=[("0", _("normal")),
                         ("1", _("MiniTV") + _(" - video0")),
                         ("3", _("MiniTV with OSD") + _(" - video0")),
                         ("2", _("OSD")), ("4", _("MiniTV") + _(" - video1")),
                         ("6", _("MiniTV with OSD") + _(" - video1")),
                         ("5", _("MiniTV") + _(" - video0+video1")),
                         ("7", _("MiniTV with OSD") + _(" - video0+video1"))])
            config.lcd.minitvmode.addNotifier(setLCDminitvmode)
            config.lcd.minitvpipmode = ConfigSelection(default="0",
                                                       choices=[
                                                           ("0", _("off")),
                                                           ("4", _("PIP")),
                                                           ("6",
                                                            _("PIP with OSD"))
                                                       ])
            config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
            config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.minitvfps.addNotifier(setLCDminitvfps)
        else:
            config.lcd.minitvmode = ConfigNothing()
            config.lcd.minitvpipmode = ConfigNothing()
            config.lcd.minitvfps = ConfigNothing()

        if SystemInfo["VFD_scroll_repeats"]:

            def scroll_repeats(el):
                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)

        if SystemInfo["VFD_scroll_delay"]:

            def scroll_delay(el):
                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)

        if SystemInfo["VFD_initial_scroll_delay"]:

            def initial_scroll_delay(el):
                open(SystemInfo["VFD_initial_scroll_delay"],
                     "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_initial_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_initial_scroll_delay.addNotifier(
                initial_scroll_delay, immediate_feedback=False)

        if SystemInfo["VFD_final_scroll_delay"]:

            def final_scroll_delay(el):
                open(SystemInfo["VFD_final_scroll_delay"], "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_final_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_final_scroll_delay.addNotifier(
                final_scroll_delay, immediate_feedback=False)

        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"):
            config.lcd.power = ConfigSelection([("0", _("off")),
                                                ("1", _("on"))], "1")
            config.lcd.power.addNotifier(setLCDpower)
        else:
            config.lcd.power = 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.mode = ConfigNothing()
        config.lcd.power = 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)