Example #1
0
	def runInstall(self, val):
		if val:
			if self.type == self.DOWNLOAD:
# [iq
				print "download"
				if not self.isFreeSizeOk(self["list"].l.getCurrentSelection()[0].name):
					noSpace="No more capacity in the Flash memory.. \nPlease remove some files in Plugins menu if you want to download new files."
					self.session.open(MessageBox, noSpace, type = MessageBox.TYPE_WARNING)
					return
# iq]
				if self["list"].l.getCurrentSelection()[0].name.startswith("picons-"):
					print "picons"
					supported_filesystems = frozenset(('ext4', 'ext3', 'ext2', 'reiser', 'reiser4', 'jffs2', 'ubifs', 'rootfs'))
					candidates = []
					import Components.Harddisk
					mounts = Components.Harddisk.getProcMounts() 
					for partition in harddiskmanager.getMountedPartitions(False, mounts):
						if partition.filesystem(mounts) in supported_filesystems:
							candidates.append((partition.description, partition.mountpoint)) 
					if candidates:
						from Components.Renderer import Picon
						self.postInstallCall = Picon.initPiconPaths
						self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_("Install picons on"), list=candidates)
					return
				elif self["list"].l.getCurrentSelection()[0].name.startswith("lcdpicons-"):
					print "lcdpicons"
					supported_filesystems = frozenset(('ext4', 'ext3', 'ext2', 'reiser', 'reiser4', 'jffs2', 'ubifs', 'rootfs'))
					candidates = []
					import Components.Harddisk
					mounts = Components.Harddisk.getProcMounts() 
					for partition in harddiskmanager.getMountedPartitions(False, mounts):
						if partition.filesystem(mounts) in supported_filesystems:
							candidates.append((partition.description, partition.mountpoint)) 
					if candidates:
						from Components.Renderer import LcdPicon
						self.postInstallCall = LcdPicon.initLcdPiconPaths
						self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_("Install lcd picons on"), list=candidates)
					return
				self.install_settings_name = self["list"].l.getCurrentSelection()[0].name
				self.install_bootlogo_name = self["list"].l.getCurrentSelection()[0].name
				if self["list"].l.getCurrentSelection()[0].name.startswith('settings-'):
					print "settings"
					self.check_settings = True
					self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'settings-*')
# [iq
				elif self["list"].l.getCurrentSelection()[0].name.startswith('channel.'):
					print "channel"
					self.check_settings = True
					self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'channel.*')
# iq]
				elif self["list"].l.getCurrentSelection()[0].name.startswith('bootlogo-'):
					print "bootlogo"
					self.check_bootlogo = True
					self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'bootlogo-*')
				else:
					print "etc"
					self.runSettingsInstall()
			elif self.type == self.REMOVE:
				print "remove"
				self.doRemove(self.installFinished, self["list"].l.getCurrentSelection()[0].name + " --force-remove --force-depends")
Example #2
0
    def runInstall(self, val):
        if val:
            if self.type == self.DOWNLOAD:
                if self["list"].l.getCurrentSelection()[0].name.startswith("picons-"):
                    supported_filesystems = frozenset(
                        ("ext4", "ext3", "ext2", "reiser", "reiser4", "jffs2", "ubifs", "rootfs")
                    )
                    candidates = []
                    import Components.Harddisk

                    mounts = Components.Harddisk.getProcMounts()
                    for partition in harddiskmanager.getMountedPartitions(False, mounts):
                        if partition.filesystem(mounts) in supported_filesystems:
                            candidates.append((partition.description, partition.mountpoint))
                    if candidates:
                        from Components.Renderer import Picon

                        self.postInstallCall = Picon.initPiconPaths
                        self.session.openWithCallback(
                            self.installDestinationCallback, ChoiceBox, title=_("Install picons on"), list=candidates
                        )
                    return
                elif self["list"].l.getCurrentSelection()[0].name.startswith("lcdpicons-"):
                    supported_filesystems = frozenset(
                        ("ext4", "ext3", "ext2", "reiser", "reiser4", "jffs2", "ubifs", "rootfs")
                    )
                    candidates = []
                    import Components.Harddisk

                    mounts = Components.Harddisk.getProcMounts()
                    for partition in harddiskmanager.getMountedPartitions(False, mounts):
                        if partition.filesystem(mounts) in supported_filesystems:
                            candidates.append((partition.description, partition.mountpoint))
                    if candidates:
                        from Components.Renderer import LcdPicon

                        self.postInstallCall = LcdPicon.initLcdPiconPaths
                        self.session.openWithCallback(
                            self.installDestinationCallback,
                            ChoiceBox,
                            title=_("Install lcd picons on"),
                            list=candidates,
                        )
                    return
                self.install_settings_name = self["list"].l.getCurrentSelection()[0].name
                self.install_bootlogo_name = self["list"].l.getCurrentSelection()[0].name
                if self["list"].l.getCurrentSelection()[0].name.startswith("settings-"):
                    self.check_settings = True
                    self.startIpkgListInstalled(self.PLUGIN_PREFIX + "settings-*")
                elif self["list"].l.getCurrentSelection()[0].name.startswith("bootlogo-"):
                    self.check_bootlogo = True
                    self.startIpkgListInstalled(self.PLUGIN_PREFIX + "bootlogo-*")
                else:
                    self.runSettingsInstall()
            elif self.type == self.REMOVE:
                self.doRemove(
                    self.installFinished,
                    self["list"].l.getCurrentSelection()[0].name + " --force-remove --force-depends",
                )
Example #3
0
    def runInstall(self, val):
        if val:
            if self.type == self.DOWNLOAD:
                if self['list'].l.getCurrentSelection()[0].name.startswith('picons-'):
                    supported_filesystems = frozenset(('vfat', 'ext4', 'ext3', 'ext2', 'reiser', 'reiser4', 'jffs2', 'ubifs', 'rootfs'))
                    candidates = []
                    import Components.Harddisk
                    mounts = Components.Harddisk.getProcMounts()
                    for partition in harddiskmanager.getMountedPartitions(False, mounts):
                        if partition.filesystem(mounts) in supported_filesystems:
                            candidates.append((partition.description, partition.mountpoint))

                    if candidates:
                        from Components.Renderer import Picon
                        self.postInstallCall = Picon.initPiconPaths
                        self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_('Install picons on'), list=candidates)
                    return
                if self['list'].l.getCurrentSelection()[0].name.startswith('display-picon'):
                    supported_filesystems = frozenset(('vfat', 'ext4', 'ext3', 'ext2', 'reiser', 'reiser4', 'jffs2', 'ubifs', 'rootfs'))
                    candidates = []
                    import Components.Harddisk
                    mounts = Components.Harddisk.getProcMounts()
                    for partition in harddiskmanager.getMountedPartitions(False, mounts):
                        if partition.filesystem(mounts) in supported_filesystems:
                            candidates.append((partition.description, partition.mountpoint))

                    if candidates:
                        from Components.Renderer import LcdPicon
                        self.postInstallCall = LcdPicon.initLcdPiconPaths
                        self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_('Install lcd picons on'), list=candidates)
                    return
                self.install_settings_name = self['list'].l.getCurrentSelection()[0].name
                self.install_bootlogo_name = self['list'].l.getCurrentSelection()[0].name
                if self['list'].l.getCurrentSelection()[0].name.startswith('settings-'):
                    self.check_settings = True
                    self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'settings-*')
                elif self['list'].l.getCurrentSelection()[0].name.startswith('bootlogo-'):
                    self.check_bootlogo = True
                    self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'bootlogo-*')
                else:
                    self.runSettingsInstall()
            elif self.type == self.REMOVE:
                if self['list'].l.getCurrentSelection()[0].name.startswith('bootlogo-'):
                    self.doRemove(self.installFinished, self['list'].l.getCurrentSelection()[0].name + ' --force-remove --force-depends')
                else:
                    self.doRemove(self.installFinished, self['list'].l.getCurrentSelection()[0].name)
            elif self.type == self.TOOGLE:
                self.doToogle(self.installFinished, self['list'].l.getCurrentSelection()[0].name)
Example #4
0
	def runInstall(self, val):
		if val:
			if self.type == self.DOWNLOAD:
				if self["list"].l.getCurrentSelection()[0].name[0:7] == "picons-":
					partitions = harddiskmanager.getMountedPartitions()
					partitiondict = {}
					for partition in partitions:
						partitiondict[partition.mountpoint] = partition

					supported_filesystems = ['ext3', 'ext2', 'reiser', 'reiser4']
					list = []
					mountpoint = '/'
					if mountpoint in partitiondict.keys() and partitiondict[mountpoint].free() > 5 * 1024 * 1024:
						list.append((partitiondict[mountpoint].description, '', partitiondict[mountpoint]))
					mountpoint = '/media/cf'
					if mountpoint in partitiondict.keys() and partitiondict[mountpoint].filesystem() in supported_filesystems:
						list.append((partitiondict[mountpoint].description, '-d cf', partitiondict[mountpoint]))
					mountpoint = '/media/mmc1'
					if mountpoint in partitiondict.keys() and partitiondict[mountpoint].filesystem() in supported_filesystems:
						list.append((partitiondict[mountpoint].description, '-d mmc1', partitiondict[mountpoint]))
					mountpoint = '/media/usb'
					if mountpoint in partitiondict.keys() and partitiondict[mountpoint].filesystem() in supported_filesystems:
						list.append((partitiondict[mountpoint].description, '-d usb', partitiondict[mountpoint]))
					mountpoint = '/media/hdd'
					if mountpoint in partitiondict.keys() and partitiondict[mountpoint].filesystem() in supported_filesystems:
						list.append((partitiondict[mountpoint].description, '-d hdd', partitiondict[mountpoint]))

					if len(list):
						self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_("Install picons on"), list = list)
					return
				self.session.openWithCallback(self.installFinished, Console, cmdlist = [self.ipkg_install + " enigma2-plugin-" + self["list"].l.getCurrentSelection()[0].name], closeOnSuccess = True)
			elif self.type == self.REMOVE:
				self.session.openWithCallback(self.installFinished, Console, cmdlist = [self.ipkg_remove + " enigma2-plugin-" + self["list"].l.getCurrentSelection()[0].name], closeOnSuccess = True)
Example #5
0
	def runInstall(self, val):
		if val:
			if self.type == self.DOWNLOAD:
				if self["list"].l.getCurrentSelection()[0].name.startswith("picons-"):
					supported_filesystems = frozenset(('ext4', 'ext3', 'ext2', 'reiser', 'reiser4', 'jffs2', 'ubifs', 'rootfs'))
					candidates = []
					import Components.Harddisk
					mounts = Components.Harddisk.getProcMounts() 
					for partition in harddiskmanager.getMountedPartitions(False, mounts):
						if partition.filesystem(mounts) in supported_filesystems:
							candidates.append((partition.description, partition.mountpoint)) 
					if candidates:
						from Components.Renderer import Picon
						self.postInstallCall = Picon.initPiconPaths
						self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_("Install picons on"), list=candidates)
					return
				self.install_settings_name = self["list"].l.getCurrentSelection()[0].name
# iq [
#				if self["list"].l.getCurrentSelection()[0].name.startswith('settings-'):
				if self["list"].l.getCurrentSelection()[0].name.startswith('settings-') or self["list"].l.getCurrentSelection()[0].name.startswith('channel.'):
# ]
					self.check_settings = True
# iq [
#					self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'settings-*')
					self.container.execute(self.ipkg + Ipkg.opkgExtraDestinations() + " list_installed " + self.PLUGIN_PREFIX + "settings-* ; " + self.ipkg + Ipkg.opkgExtraDestinations() + " list_installed " + self.PLUGIN_PREFIX + "channel.*")
# iq[
					self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'settings-*') or self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'channel*')
# iq]
				else:
					self.runSettingsInstall()
			elif self.type == self.REMOVE:
				self.doRemove(self.installFinished, self["list"].l.getCurrentSelection()[0].name)
Example #6
0
def initLcdPiconPaths():
	global searchPaths
	searchPaths = []
	for mp in ('/usr/share/enigma2/', '/'):
		onMountpointAdded(mp)
	for part in harddiskmanager.getMountedPartitions():
		onMountpointAdded(part.mountpoint)
def OMBManager(session, **kwargs):
	found = False

	kernel_module = 'kernel-module-nandsim'
	if "jffs2" in OMB_GETIMAGEFILESYSTEM:
		if os.path.exists(OMB_UNJFFS2_BIN):
			kernel_module = None
		else:
			kernel_module = 'kernel-module-block2mtd'
	
	if kernel_module and os.system('opkg list_installed | grep ' + kernel_module) != 0 and BRANDING:
		OMBManagerKernelModule(session, kernel_module)
		return

	data_dir = OMB_MAIN_DIR + '/' + OMB_DATA_DIR
	if os.path.exists(data_dir):
		session.open(OMBManagerList, OMB_MAIN_DIR)
		found = True
	else:
		for partition in harddiskmanager.getMountedPartitions():
			if partition.mountpoint != '/':
				data_dir = partition.mountpoint + '/' + OMB_DATA_DIR
				if os.path.exists(data_dir):
					session.open(OMBManagerList, partition.mountpoint)
					found = True
					break
				
	if not found:
		OMBManagerInit(session)
Example #8
0
def checkConfigBackup():
    try:
        devices = [(r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug=False)]
        list = []
        files = []
        for x in devices:
            if x[1] == "/":
                devices.remove(x)

        if len(devices):
            for x in devices:
                devpath = path.join(x[1], "backup")
                if path.exists(devpath):
                    try:
                        files = listdir(devpath)
                    except:
                        files = []

                else:
                    files = []
                if len(files):
                    for file in files:
                        if file.endswith(".tar.gz"):
                            list.append((path.join(devpath, file), devpath, file))

        if len(list):
            return True
        return None
    except IOError as e:
        print "unable to use device (%s)..." % str(e)
        return None

    return None
Example #9
0
	def listDevices(self):
		devices = [(r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug=False)]
		list = []
		files = []
		for x in devices:
			if x[1] == '/':
				devices.remove(x)
		if len(devices):
			for x in devices:
				devpath = path.join(x[1], 'backup')
				if path.exists(devpath):
					try:
						files = listdir(devpath)
					except:
						files = []
				else:
					files = []
				if len(files):
					for file in files:
						if file.endswith('.tar.gz'):
							list.append((path.join(devpath, file), path.join(devpath, file)))
		if len(list):
			list.sort()
			list.reverse()
		return list
Example #10
0
	def startSwap2(self, result = None, retval = None, extra_args = None):
		swap_place = ""
		if result and result.find('sd') != -1:
			for line in result.split('\n'):
				if line.find('sd') != -1:
					parts = line.strip().split()
					swap_place = parts[0]
					file('/etc/fstab.tmp', 'w').writelines([l for l in file('/etc/fstab').readlines() if swap_place not in l])
					rename('/etc/fstab.tmp','/etc/fstab')
					print "[SwapManager] Found a swap partition:", swap_place
		else:
			devicelist = []
			for p in harddiskmanager.getMountedPartitions():
				d = path.normpath(p.mountpoint)
				if path.exists(p.mountpoint) and p.mountpoint != "/" and not p.mountpoint.startswith('/media/net') and not p.mountpoint.startswith('/media/autofs'):
					devicelist.append((p.description, d))
			if len(devicelist):
				for device in devicelist:
					for filename in glob(device[1] + '/swap*'):
						if path.exists(filename):
							swap_place = filename
							print "[SwapManager] Found a swapfile on ", swap_place

		f = file('/proc/swaps').read()
		if f.find(swap_place) == -1:
			print "[SwapManager] Starting swapfile on ", swap_place
			system('swapon ' + swap_place)
		else:
			print "[SwapManager] Swapfile is already active on ", swap_place
Example #11
0
    def updateNandStatus(self):
        partitions = harddiskmanager.getMountedPartitions()
        partitiondict = {}
        for partition in partitions:
            if partition.mountpoint == "/":
                self.freeSize = partition.free()

        if self.freeSize >= 1024 * 1024:
            self["free_size"].setText(_("free size : %d MB" % (self.freeSize / 1024 / 1024)))
        else:
            self["free_size"].setText(_("free size : %.2f MB" % (self.freeSize / 1024 / 1024.0)))
        from os import statvfs

        s = statvfs("/")
        percent = str(100 - ((100 * s.f_bavail) / s.f_blocks))

        self["percent"].setText(percent + "%")
        self["free_progress"].setValue(int(percent))
        self["free_progress"].show()

        # 		from os import system
        # 		system("df | grep /dev/root > /tmp/nand_info")
        # 		readFp=open("/tmp/nand_info", "r")
        # 		lines = readFp.readlines()
        # 		readFp.close()
        # 		lines = lines[0] # change list to string
        # 		lines = lines.split('%') #  "rootfs 54528 48960 5568 90% /" ==> "rootfs 54528 48960 5568 90" , " /"
        # 		lines = lines[0].split(' ')
        # 		percent = lines.pop()

        self["percent"].setText(percent + "%")
        self["free_progress"].setValue(int(percent))
        self["free_progress"].show()
Example #12
0
	def listDevices(self):
		devices = [(r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug=False)]
		list = []
		files = []
		mtimes = []
		for x in devices:
			if x[1] == '/':
				devices.remove(x)
		if len(devices):
			for x in devices:
				devpath = path.join(x[1], 'backup')
				if path.exists(devpath):
					try:
						files = listdir(devpath)
					except:
						files = []
				else:
					files = []
				if len(files):
					for file in files:
						if file.endswith('.tar.gz'):
							mtimes.append((path.join(devpath, file), stat(path.join(devpath, file)).st_mtime)) # (filname, mtime)
		for file in [x[0] for x in sorted(mtimes, key=lambda x: x[1], reverse=True)]: # sort by mtime
			list.append((file, file))
		return list
Example #13
0
def listConfigBackup():
	try:
		devices = [(r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
		list = []
		files = []
		for x in devices:
			if x[1] == '/':
				devices.remove(x)
		if len(devices):
			for x in devices:
				devpath = path.join(x[1], 'backup')
				if path.exists(devpath):
					try:
						files = listdir(devpath)
					except:
						files = []
				else:
					files = []
				if len(files):
					for file in files:
						if file.endswith('.tar.gz'):
							list.append((path.join(devpath,file),path.join(devpath,file)))
		if len(list):
			list.sort()
			list.reverse()
			return list
		else:
			return None
	except IOError, e:
		print "unable to use device (%s)..." % str(e)
		return None
Example #14
0
def checkConfigBackup():
	parts = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
	box = getBoxType()
	for x in parts:
		if x[1] == '/':
			parts.remove(x)
	if len(parts):
		for x in parts:
			if x[1].endswith('/'):
				fullbackupfile =  x[1] + 'backup_' + box + '/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
				fullbackupfile = x[1] + '/backup/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
			else:
				fullbackupfile =  x[1] + '/backup_' + box + '/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
				fullbackupfile = x[1] + '/backup/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
		return None
Example #15
0
def initLcdPiconPaths():
	global searchPaths
	searchPaths = []
	path = str(config.misc.picon_path.value)
	for mp in ('/usr/share/enigma2/', '/', path):
		onMountpointAdded(mp)
	for part in harddiskmanager.getMountedPartitions():
		onMountpointAdded(part.mountpoint)
Example #16
0
	def getUSBPartitions(self):
		allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
		print "[getUSBPartitions]", allpartitions
		usbpartition = []
		for x in allpartitions:
			print x, x[1] == '/', x[0].find("USB"), access(x[1], R_OK)
			if x[1] != '/' and x[0].find("USB") > -1:  # and access(x[1], R_OK) is True:
				usbpartition.append(x)
		return usbpartition
Example #17
0
def initPiconPaths():
	global searchPaths
	searchPaths = []
	path = str(config.misc.picon_path.value)
	for mp in ('/usr/share/enigma2/', '/', path):
		onMountpointAdded(mp)
	for part in harddiskmanager.getMountedPartitions():
		if not part.mountpoint.startswith("/media/hdd") or config.misc.picon_search_hdd.value == True: 
			onMountpointAdded(part.mountpoint)
Example #18
0
def initPiconPaths():
    global searchPaths
    searchPaths = []
    for mp in ("/usr/share/enigma2/", "/"):
        onMountpointAdded(mp)
    for part in harddiskmanager.getMountedPartitions():
        mp = path = os.path.join(part.mountpoint, "usr/share/enigma2")
        onMountpointAdded(part.mountpoint)
        onMountpointAdded(mp)
Example #19
0
	def listDevices(self):
		list = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
		for x in list:
			result = access(x[1], W_OK) and access(x[1], R_OK)
			if result is False or x[1] == '/':
				list.remove(x)
		for x in list:
			if x[1].startswith('/autofs/'):
				list.remove(x)	
		return list
	def __init__(self, session, kernel_module):
		self.session = session
		self.kernel_module = kernel_module

		message = _("You need the module " + self.kernel_module + " to use openMultiboot\nDo you want install it?")
		disks_list = []
		for partition in harddiskmanager.getMountedPartitions():
			if partition.mountpoint != '/':
				disks_list.append((partition.description, partition.mountpoint))

		self.session.openWithCallback(self.installCallback, MessageBox, message, MessageBox.TYPE_YESNO)
Example #21
0
def scan(session):
	from Screens.ChoiceBox import ChoiceBox

	from Components.Harddisk import harddiskmanager

	parts = [ (r.description, r.mountpoint, session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
	if parts:
		for x in parts:
			if not access(x[1], F_OK|R_OK):
				parts.remove(x)	
		session.openWithCallback(mountpoint_choosen, ChoiceBox, title = _("Please Select Medium to be Scanned"), list = parts)
Example #22
0
def initPiconPaths():
    for part in harddiskmanager.getMountedPartitions():
        if DBG: j00zekDEBUG('MountedPartitions:' + part.mountpoint)
        addPiconPath(part.mountpoint)
    if pathExists("/proc/mounts"):
        with open("/proc/mounts", "r") as f:
            for line in f:
                if line.startswith('/dev/sd'):
                    mountpoint = line.split(' ')[1]
                    if DBG: j00zekDEBUG('mounts:' + mountpoint)
                    addPiconPath(mountpoint)
Example #23
0
	def doCreateSwap(self):
		parts = []
		supported_filesystems = frozenset(('ext4', 'ext3', 'ext2', 'vfat'))
		candidates = []
		mounts = getProcMounts() 
		for partition in harddiskmanager.getMountedPartitions(False, mounts):
			if partition.filesystem(mounts) in supported_filesystems:
				candidates.append((partition.description, partition.mountpoint)) 
		if len(candidates):
			self.session.openWithCallback(self.doCSplace, ChoiceBox, title = _("Please select device to use as swapfile location"), list = candidates)
		else:
			self.session.open(MessageBox, _("Sorry, no physical devices that supports SWAP attached. Can't create Swapfile on network or fat32 filesystems"), MessageBox.TYPE_INFO, timeout = 10)
Example #24
0
	def runInstall(self, val):
		if val:
			if self.type == self.DOWNLOAD:
				if pluginnames.startswith("enigma2-plugin-picons-"):
					supported_filesystems = frozenset(('vfat','ext4', 'ext3', 'ext2', 'reiser', 'reiser4', 'jffs2', 'ubifs', 'rootfs'))
					candidates = []
					import Components.Harddisk
					mounts = Components.Harddisk.getProcMounts()
					for partition in harddiskmanager.getMountedPartitions(False, mounts):
						if partition.filesystem(mounts) in supported_filesystems:
							candidates.append((partition.description, partition.mountpoint))
					if candidates:
						from Components.Renderer import Picon
						self.postInstallCall = Picon.initPiconPaths
						self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_("Install picons on"), list=candidates)
					return
				elif pluginnames.startswith("enigma2-plugin-display-picon"):
					supported_filesystems = frozenset(('vfat','ext4', 'ext3', 'ext2', 'reiser', 'reiser4', 'jffs2', 'ubifs', 'rootfs'))
					candidates = []
					import Components.Harddisk
					mounts = Components.Harddisk.getProcMounts()
					for partition in harddiskmanager.getMountedPartitions(False, mounts):
						if partition.filesystem(mounts) in supported_filesystems:
							candidates.append((partition.description, partition.mountpoint))
					if candidates:
						from Components.Renderer import LcdPicon
						self.postInstallCall = LcdPicon.initLcdPiconPaths
						self.session.openWithCallback(self.installDestinationCallback, ChoiceBox, title=_("Install lcd picons on"), list=candidates)
					return
				self.install_settings_name = pluginnames
				self.install_bootlogo_name = pluginnames
				if pluginnames.startswith('enigma2-plugin-settings-'):
					self.check_settings = True
					self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'settings-*')
				elif pluginnames.startswith('enigma2-plugin-bootlogo-'):
					self.check_bootlogo = True
					self.startIpkgListInstalled(self.PLUGIN_PREFIX + 'bootlogo-*')
				else:
					self.runSettingsInstall()
Example #25
0
def checkConfigBackup():
	parts = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
	if boxtype in ('maram9', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius', 'evo', 'galaxym6'):
		parts.append(('mtd backup','/media/backup'))
	for x in parts:
		if x[1] == '/':
			parts.remove(x)
	if len(parts):
		for x in parts:
			if x[1].endswith('/'):
				fullbackupfile =  x[1] + 'backup_' + distro + '_' +  boxtype + '/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
				fullbackupfile =  x[1] + 'backup_' + boxtype + '/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
				fullbackupfile =  x[1] + 'backup/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
			else:
				fullbackupfile =  x[1] + '/backup_' + distro + '_' +   boxtype + '/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
				fullbackupfile =  x[1] + '/backup_' + boxtype + '/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
				fullbackupfile =  x[1] + '/backup/' + backupfile
				if fileExists(fullbackupfile):
					config.plugins.configurationbackup.backuplocation.setValue(str(x[1]))
					config.plugins.configurationbackup.backuplocation.save()
					config.plugins.configurationbackup.save()
					return x
		return None
	def __init__(self, session):
		self.session = session

		message = _("Where do you want to install openMultiboot?")
		disks_list = []
		for partition in harddiskmanager.getMountedPartitions():
			if partition and partition.mountpoint and partition.device and partition.mountpoint != '/' and partition.device[:2] == 'sd':
				disks_list.append((partition.description, partition))

		if len(disks_list) > 0:
			disks_list.append((_("Cancel"), None))
			self.session.openWithCallback(self.initCallback, MessageBox, message, list=disks_list)
		else:
			self.session.open(
				MessageBox,
				_("No suitable devices found"),
				type = MessageBox.TYPE_ERROR
			)
Example #27
0
	def updateNandStatus(self):
		partitions = harddiskmanager.getMountedPartitions()
		partitiondict = {}
		for partition in partitions:
			if partition.mountpoint == "/":
				self.freeSize = partition.free()

		if self.freeSize >= 1024*1024:
			self["free_size"].setText(_("free size : %d MB" % ( self.freeSize/1024/1024 ) ))
		else:
			self["free_size"].setText(_("free size : %.2f MB" % ( self.freeSize/1024/1024.0 ) ))
		from os import statvfs
		s=statvfs("/")
		percent  = str(100 - ((100 * s.f_bavail)/ s.f_blocks))
					
		self["percent"].setText(percent+'%')
		self["free_progress"].setValue(int(percent))
		self["free_progress"].show()
Example #28
0
	def checkUSBStick(self):
		self.target_dir = None
		allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
		print "[checkUSBStick] found partitions:", allpartitions
		usbpartition = []
		for x in allpartitions:
			print x, x[1] == '/', x[0].find("USB"), access(x[1], R_OK)
			if x[1] != '/' and x[0].find("USB") > -1:  # and access(x[1], R_OK) is True:
				usbpartition.append(x)

		print usbpartition
		if len(usbpartition) == 1:
			self.target_dir = usbpartition[0][1]
			self.md5_passback = self.getFeed
			self.md5_failback = self.askStartWizard
			self.md5verify(self.stickimage_md5, self.target_dir)
		elif usbpartition == []:
			print "[NFIFlash] needs to create usb flasher stick first!"
			self.askStartWizard()
		else:
			self.askStartWizard()
Example #29
0
	def MemCheck(self):
		memfree = 0
		swapfree = 0
		f = open('/proc/meminfo', 'r')
		for line in f.readlines():
			if line.find('MemFree') != -1:
				parts = line.strip().split()
				memfree = int(parts[1])
			elif line.find('SwapFree') != -1:
				parts = line.strip().split()
				swapfree = int(parts[1])
		f.close()
		TotalFree = memfree + swapfree
		print '[ImageManager] Stage1: Free Mem', TotalFree
		if int(TotalFree) < 3000:
			supported_filesystems = frozenset(('ext4', 'ext3', 'ext2'))
			candidates = []
			mounts = getProcMounts()
			for partition in harddiskmanager.getMountedPartitions(False, mounts):
				if partition.filesystem(mounts) in supported_filesystems:
					candidates.append((partition.description, partition.mountpoint))
			for swapdevice in candidates:
				self.swapdevice = swapdevice[1]
			if self.swapdevice:
				print '[ImageManager] Stage1: Creating Swapfile.'
				self.RamChecked = True
				self.MemCheck2()
			else:
				print '[ImageManager] Sorry, not enough free ram found, and no physical devices that supports SWAP attached'
				AddPopupWithCallback(self.BackupComplete,
									 _("Sorry, not enough free ram found, and no physical devices that supports SWAP attached. Can't create Swapfile on network or fat32 filesystems, unable to make backup"),
									 MessageBox.TYPE_INFO,
									 10,
									 'RamCheckFailedNotification'
				)
		else:
			print '[ImageManager] Stage1: Found Enough Ram'
			self.RamChecked = True
			self.SwapCreated = True
def checkConfigBackup():
    parts = [(r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug=False)]
    for x in parts:
        if x[1] == "/":
            parts.remove(x)
    if len(parts):
        for x in parts:
            if x[1].endswith("/"):
                fullbackupfile = x[1] + "backup/" + backupfile
                if fileExists(fullbackupfile):
                    config.plugins.configurationbackup.backuplocation.value = str(x[1])
                    config.plugins.configurationbackup.backuplocation.save()
                    config.plugins.configurationbackup.save()
                    return x
            else:
                fullbackupfile = x[1] + "/backup/" + backupfile
                if fileExists(fullbackupfile):
                    config.plugins.configurationbackup.backuplocation.value = str(x[1])
                    config.plugins.configurationbackup.backuplocation.save()
                    config.plugins.configurationbackup.save()
                    return x
        return None
from cPickle import dump, load
from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK
from os import environ, system, path, listdir, remove
from time import time, gmtime, strftime, localtime
from stat import ST_MTIME
import datetime
import urllib2
import gettext
import os
from image_downloader import process_mode
config.plugins.ImageDownLoader2 = ConfigSubsection()
config.plugins.ImageDownLoader2.Downloadlocation = ConfigText(default='/media/', visible_width=50, fixed_size=False)
dwidth = getDesktop(0).size().width()
currversion = 'eo2.0'
mountedDevs = []
for p in harddiskmanager.getMountedPartitions(True):
    mountedDevs.append((p.mountpoint, _(p.description) if p.description else ''))

mounted_string = 'Nothing mounted at '

p_path = '/usr/lib/enigma2/python/Plugins/Extensions/SatVenusPanel'

def getDownloadPath():
    Downloadpath = config.plugins.ImageDownLoader2.Downloadlocation.value
    if Downloadpath.endswith('/'):
        return Downloadpath
    else:
        return Downloadpath + '/'

def freespace():
    downloadlocation = getDownloadPath()
    def changeDirectory(self, directory, select=None):
        self.list = []

        # if we are just entering from the list of mount points:
        if self.current_directory is None:
            if directory and self.showMountpoints:
                self.current_mountpoint = self.getMountpointLink(directory)
            else:
                self.current_mountpoint = None
        self.current_directory = directory
        directories = []
        files = []

        if directory is None and self.showMountpoints:  # present available mountpoints
            for p in harddiskmanager.getMountedPartitions():
                path = os_path.join(p.mountpoint, "")
                if path not in self.inhibitMounts and not self.inParentDirs(
                        path, self.inhibitDirs):
                    self.list.append(
                        (p.description, path, None, True, False, None))
            files = []
            directories = []
        elif directory is None:
            files = []
            directories = []
        else:
            if os_path.exists(directory):
                try:
                    files = listdir(directory)
                except:
                    files = []
                files.sort()
                tmpfiles = files[:]
                for x in tmpfiles:
                    if os_path.isdir(directory + x):
                        directories.append(directory + x + "/")
                        files.remove(x)

        if directory is not None and self.showDirectories and not self.isTop:
            if directory == self.current_mountpoint and self.showMountpoints:
                self.list.append(("<%s>" % (_("List of Storage Devices")),
                                  None, None, True, False, None))
            elif (directory != "/") and not (self.inhibitMounts
                                             and self.getMountpoint(directory)
                                             in self.inhibitMounts):
                self.list.append(("<%s>" % (_("Parent Directory")),
                                  '/'.join(directory.split('/')[:-2]) + '/',
                                  None, True, False, None))

        if self.showDirectories:
            for x in directories:
                if not (self.inhibitMounts and self.getMountpoint(x)
                        in self.inhibitMounts) and not self.inParentDirs(
                            x, self.inhibitDirs):
                    name = x.split('/')[-2]
                    self.list.append((name, x, None, True, False, None))
        if self.showFiles:
            for x in files:
                path = directory + x
                name = x

                if (self.matchingPattern is None) or re_compile(
                        self.matchingPattern).search(path):
                    nx = None
                    if (config.plugins.DreamExplorer.useMediaFilter.value ==
                            "on"):
                        nx = self.getTSInfo(path)
                        if nx is not None:
                            name = nx

                    extension = None
                    extensionPos = name.rfind('.')
                    if extensionPos != -1:
                        extension = name[extensionPos + 1:].lower()
                    mediaType = EXTENSIONS.get(extension)
                    if nx is None:
                        fileInfo = os_lstat(path)
                        lastModified = strftime("%d.%m.%Y %H:%M:%S",
                                                localtime(fileInfo.st_mtime))
                        self.list.append(
                            (name, directory, path, False, False, mediaType))
                    else:
                        extname = name + " [" + self.getTSLength(path) + "]"
                        self.list.append(
                            (extname, directory, path, False, True, mediaType))

        # let's sort the list to retain the last selection after directory change
        self.sortList()

        self.l.setList(self.list)

        if select is not None:
            i = 0
            self.moveToIndex(0)
            for x in self.list:
                p = x[1]

                if isinstance(p, eServiceReference):
                    p = p.getPath()

                if p == select:
                    self.moveToIndex(i)
                    break
                i += 1
Example #33
0
def initPiconPaths():
    global piconPaths
    piconPaths = []
    piconPaths.append(e2m3u2bouquet.PICONSPATH)
    map(lambda part: onMountpointAdded(part.mountpoint),
        harddiskmanager.getMountedPartitions())
Example #34
0
def getMountedDevices():
	def handleMountpoint(loc):
		# debug("[NcidClient] handleMountpoint: %s" %repr(loc))
		mp = loc[0]
		while mp[-1] == '/':
			mp = mp[:-1]

		desc = loc[1]
		return (mp, desc + " (" + mp + ")")

	mountedDevs = [(resolveFilename(SCOPE_CONFIG), _("Flash")),
				   (resolveFilename(SCOPE_MEDIA, "cf"), _("Compact Flash")),
				   (resolveFilename(SCOPE_MEDIA, "usb"), _("USB Device"))]
	mountedDevs += map(lambda p: (p.mountpoint, (_(p.description) if p.description else "")), harddiskmanager.getMountedPartitions(True))
	mediaDir = resolveFilename(SCOPE_MEDIA)
	for p in os.listdir(mediaDir):
		if os.path.join(mediaDir, p) not in [path[0] for path in mountedDevs]:
			mountedDevs.append((os.path.join(mediaDir, p), _("Media directory")))
	debug("[NcidClient] getMountedDevices1: %s" % repr(mountedDevs))
	mountedDevs = filter(lambda path: os.path.isdir(path[0]) and os.access(path[0], os.W_OK | os.X_OK), mountedDevs)
	# put this after the write/executable check, that is far too slow...
	netDir = resolveFilename(SCOPE_MEDIA, "net")
	if os.path.isdir(netDir):
		mountedDevs += map(lambda p: (os.path.join(netDir, p), _("Network mount")), os.listdir(netDir))
	mountedDevs = map(handleMountpoint, mountedDevs)
	return mountedDevs
Example #35
0
    def updateSwap2(self, result=None, retval=None, extra_args=None):
        self.swapsize = 0
        self.swap_place = ""
        self.swap_active = False
        self.device = False
        if sys.version_info >= (3, 0):
            result = result.decode('utf-8')
        if result.find("sd") > 0:
            self["key_blue"].setText("")
            for line in result.split("\n"):
                if line.find("sd") > 0:
                    parts = line.strip().split()
                    self.swap_place = parts[0]
                    if self.swap_place == "sfdisk:":
                        self.swap_place = ""
                    self.device = True
                f = open("/proc/swaps", "r")
                for line2 in f.readlines():
                    parts = line.strip().split()
                    if line2.find("partition") != -1:
                        self.swap_active = True
                        self.swapsize = parts[2]
                        continue
                f.close()
        else:
            self["key_blue"].setText(_("Create"))
            devicelist = []
            for p in harddiskmanager.getMountedPartitions():
                d = path.normpath(p.mountpoint)
                if path.exists(
                        p.mountpoint
                ) and p.mountpoint != "/" and not p.mountpoint.startswith(
                        "/media/net"):
                    devicelist.append((p.description, d))
            if len(devicelist):
                for device in devicelist:
                    for filename in glob(device[1] + "/swap*"):
                        self.swap_place = filename
                        self["key_blue"].setText(_("Delete"))
                        info = mystat(self.swap_place)
                        self.swapsize = info[stat.ST_SIZE]
                        continue

        if config.vixsettings.swapautostart.value and self.swap_place:
            self["autostart_off"].hide()
            self["autostart_on"].show()
        else:
            config.vixsettings.swapautostart.setValue(False)
            config.vixsettings.swapautostart.save()
            configfile.save()
            self["autostart_on"].hide()
            self["autostart_off"].show()
        self["labplace"].setText(self.swap_place)
        self["labplace"].show()

        f = open("/proc/swaps", "r")
        for line in f.readlines():
            parts = line.strip().split()
            if line.find("partition") != -1:
                self.swap_active = True
                continue
            elif line.find("file") != -1:
                self.swap_active = True
                continue
        f.close()

        if self.swapsize > 0:
            if self.swapsize >= 1024:
                self.swapsize = int(self.swapsize) // 1024
                if self.swapsize >= 1024:
                    self.swapsize = int(self.swapsize) // 1024
                self.swapsize = str(self.swapsize) + " " + "MB"
            else:
                self.swapsize = str(self.swapsize) + " " + "KB"
        else:
            self.swapsize = ""

        self["labsize"].setText(self.swapsize)
        self["labsize"].show()

        if self.swap_active:
            self["inactive"].hide()
            self["active"].show()
            self["key_green"].setText(_("Deactivate"))
            self["swapactive_summary"].setText(
                _("Current status:") + " " + _("Active"))
        else:
            self["inactive"].show()
            self["active"].hide()
            self["key_green"].setText(_("Activate"))
            self["swapactive_summary"].setText(
                _("Current status:") + " " + _("Inactive"))

        scanning = _("Enable SWAP at startup")
        self["lab1"].setText(scanning)
        self["lab1"].show()
        self["actions"].setEnabled(True)

        name = self["labplace"].text
        self["swapname_summary"].setText(name)
Example #36
0
 def changeDir(self, directory, sort="default", select=None):
     isDir = False
     if sort == "shuffle":
         sort = "default"
         shuffle = True
     else:
         shuffle = False
     self.list = []
     if self.current_directory is None:
         if directory and self.showMountpoints:
             self.current_mountpoint = self.getMountpointLink(directory)
         else:
             self.current_mountpoint = None
     self.current_directory = directory
     directories = []
     files = []
     if directory is None and self.showMountpoints:
         for p in harddiskmanager.getMountedPartitions():
             path = os_path.join(p.mountpoint, "")
             if path not in self.inhibitMounts and not self.inParentDirs(
                     path, self.inhibitDirs):
                 self.list.append(
                     FileEntryComponent(name=p.description,
                                        absolute=path,
                                        isDir=True,
                                        directory=directory))
         files = []
         directories = []
     elif directory is None:
         files = []
         directories = []
     elif self.useServiceRef:
         root = eServiceReference(2, 0, directory)
         if self.additional_extensions:
             root.setName(self.additional_extensions)
         serviceHandler = eServiceCenter.getInstance()
         list = serviceHandler.list(root)
         while True:
             s = list.getNext()
             if not s.valid():
                 del list
                 break
             if s.flags & s.mustDescent:
                 directories.append(s.getPath())
             else:
                 files.append(s)
         directories.sort()
         files.sort()
     else:
         if fileExists(directory):
             try:
                 files = listdir(directory)
             except:
                 files = []
             files.sort()
             tmpfiles = files[:]
             for x in tmpfiles:
                 if os_path.isdir(directory + x):
                     directories.append(directory + x + "/")
                     files.remove(x)
     if directory is not None and self.showDirectories and not self.isTop:
         if directory == self.current_mountpoint and self.showMountpoints:
             self.list.append(
                 FileEntryComponent(name="<" +
                                    _("List of storage Devices") + ">",
                                    absolute=None,
                                    isDir=True,
                                    directory=directory))
         elif (directory != "/") and not (self.inhibitMounts
                                          and self.getMountpoint(directory)
                                          in self.inhibitMounts):
             self.list.append(
                 FileEntryComponent(
                     name="<" + _("Parent directory") + ">",
                     absolute='/'.join(directory.split('/')[:-2]) + '/',
                     isDir=True,
                     directory=directory))
     date_file_list = []
     if self.showDirectories:
         for x in directories:
             if not (self.inhibitMounts and self.getMountpoint(x)
                     in self.inhibitMounts) and not self.inParentDirs(
                         x, self.inhibitDirs):
                 name = x.split('/')[-2]
                 file = x
                 path = x
                 if pathExists(path):
                     stats = os.stat(path)
                     size = stats[6]
                     lastmod_date = time.localtime(stats[8])
                 else:
                     size = 0
                     lastmod_date = 0
                 isDir = True
                 if sort == "size" or sort == "sizereverse":
                     date_file_tuple = size, name, path, file, lastmod_date, isDir
                 elif sort == "date" or sort == "datereverse" or sort == "default":
                     date_file_tuple = lastmod_date, name, path, file, size, isDir
                 elif sort == "alpha" or sort == "alphareverse":
                     date_file_tuple = name, lastmod_date, path, file, size, isDir
                 date_file_list.append(date_file_tuple)
     if self.showFiles:
         for x in files:
             if self.useServiceRef:
                 path = x.getPath()
                 name = path.split('/')[-1]
                 file = x
                 if pathExists(path):
                     stats = os.stat(path)
                     size = stats[6]
                     lastmod_date = time.localtime(stats[8])
                 else:
                     size = 0
                     lastmod_date = 0
                 isDir = False
                 if sort == "size" or sort == "sizereverse":
                     date_file_tuple = size, name, path, file, lastmod_date, isDir
                 elif sort == "date" or sort == "datereverse" or sort == "default":
                     date_file_tuple = lastmod_date, name, path, file, size, isDir
                 elif sort == "alpha" or sort == "alphareverse":
                     date_file_tuple = name, lastmod_date, path, file, size, isDir
                 date_file_list.append(date_file_tuple)
             else:
                 path = directory + x
                 name = x
                 if sort == "size" or sort == "sizereverse":
                     date_file_tuple = size, name, path, file, lastmod_date, isDir
                 elif sort == "date" or sort == "datereverse" or sort == "default":
                     date_file_tuple = lastmod_date, name, path, file, size, isDir
                 elif sort == "alpha" or sort == "alphareverse":
                     date_file_tuple = name, lastmod_date, path, file, size, isDir
                 date_file_list.append(date_file_tuple)
     if sort == "datereverse" or sort == "alpha" or sort == "sizereverse" or sort == "date" or sort == "alphareverse" or sort == "size":
         date_file_list.sort()
     if sort == "date" or sort == "alphareverse" or sort == "size":
         date_file_list.reverse()
     if shuffle == True:
         random.shuffle(date_file_list)
     for x in date_file_list:
         if sort == "size" or sort == "sizereverse":
             size = x[0]
             name = x[1]
             path = x[2]
             file = x[3]
             timestamp = x[4]
             isDir = x[5]
         elif sort == "date" or sort == "datereverse" or sort == "default":
             timestamp = x[0]
             name = x[1]
             path = x[2]
             file = x[3]
             size = x[4]
             isDir = x[5]
         elif sort == "alpha" or sort == "alphareverse":
             name = x[0]
             timestamp = x[1]
             path = x[2]
             file = x[3]
             size = x[4]
             isDir = x[5]
         if isDir == True:
             if not (self.inhibitMounts and self.getMountpoint(file)
                     in self.inhibitMounts) and not self.inParentDirs(
                         file, self.inhibitDirs):
                 self.list.append(
                     FileEntryComponent(name=name,
                                        absolute=file,
                                        isDir=isDir,
                                        directory=directory,
                                        size=size,
                                        timestamp=timestamp))
         else:
             if (self.matchingPattern is None) or re_compile(
                     self.matchingPattern).search(path):
                 self.list.append(
                     FileEntryComponent(name=name,
                                        absolute=file,
                                        isDir=isDir,
                                        directory=directory,
                                        size=size,
                                        timestamp=timestamp))
     if self.showMountpoints and len(self.list) == 0:
         self.list.append(
             FileEntryComponent(name=_("nothing connected"),
                                absolute=None,
                                isDir=False))
     self.l.setList(self.list)
     if select is not None:
         i = 0
         self.moveToIndex(0)
         for x in self.list:
             p = x[0][0]
             if isinstance(p, eServiceReference):
                 p = p.getPath()
             if p == select:
                 self.moveToIndex(i)
             i += 1
Example #37
0
    def changeDir(self, directory, select = None):
        self.list = []

        # if we are just entering from the list of mount points:
        if self.current_directory is None:
            if directory and self.showMountpoints:
                self.current_mountpoint = self.getMountpointLink(directory)
            else:
                self.current_mountpoint = None
        self.current_directory = directory
        directories = []
        files = []

        if directory is None and self.showMountpoints: # present available mountpoints
            for p in harddiskmanager.getMountedPartitions():
                path = os_path.join(p.mountpoint, "")
                if path not in self.inhibitMounts and not self.inParentDirs(path, self.inhibitDirs):
                    self.list.append(FileEntryComponent(name = p.description, absolute = path, isDir = True, currDir = self.current_directory))
            files = [ ]
            directories = [ ]
        elif directory is None:
            files = [ ]
            directories = [ ]
        else:
            if fileExists(directory):
                try:
                    for x in listdir(directory):
                        #printDEBUG('x[-4:]="%s"' % x[-4:] )
                        if x[-4:] in ('meta','.eit', 's.ap', 's.sc', 'cuts'):
                            continue
                        elif os_path.isdir(directory + x):
                            directories.append((directory + x + "/", os_path.getmtime(directory + x), DecodeNationalLetters(x).lower()))
                            #printDEBUG('%s, %s, %s' % (directory + x + "/", os_path.getmtime(directory + x), DecodeNationalLetters(x).lower()))
                        else:
                            if config.plugins.AdvancedFreePlayer.NamesNOfiles.value:
                                files.append( (x, os_path.getmtime(directory + x), cleanFile(DecodeNationalLetters(x),ReturnMovieYear = False, metaFileName = "%s/%s.meta" %(directory,x))) )
                                printDEBUG("'%s', '%s', '%s'" % (x, os_path.getmtime(directory + x), cleanFile(DecodeNationalLetters(x),ReturnMovieYear = False, metaFileName = "%s/%s.meta" %(directory,x))))
                            else:
                                files.append( (x, os_path.getmtime(directory + x), DecodeNationalLetters(x).lower()) )
                                #printDEBUG('%s', '%s', '%s' % (x, os_path.getmtime(directory + x), DecodeNationalLetters(x).lower()))
                except Exception, e:
                    files = []
                    directories = []
                    
                #sortowanie plików
                printDEBUG("FileList.sortType ='%s'" % self.sortType )
                #printDEBUG("config.plugins.AdvancedFreePlayer.DirListSort.value ='%s'" % config.plugins.AdvancedFreePlayer.DirListSort.value )
                if self.sortType == 'name':
                    files = sorted(files , key = lambda x: x[2].lower())
                elif self.sortType == 'dateasc':
                    files = sorted(files , key = lambda x: x[1])
                elif self.sortType == 'datedesc':
                    files = sorted(files , key = lambda x: x[1], reverse=True)
                
                #sortowanie katalogow
                #printDEBUG("config.plugins.AdvancedFreePlayer.DirListSort.value ='%s'" % config.plugins.AdvancedFreePlayer.DirListSort.value )
                if config.plugins.AdvancedFreePlayer.DirListSort.value == 'name':
                    directories = sorted(directories , key = lambda x: x[2])
                elif config.plugins.AdvancedFreePlayer.DirListSort.value == 'dateasc':
                    directories = sorted(directories , key = lambda x: x[1])
                elif config.plugins.AdvancedFreePlayer.DirListSort.value == 'datedesc':
                    directories = sorted(directories , key = lambda x: x[1], reverse=True)
                elif config.plugins.AdvancedFreePlayer.DirListSort.value == 'asfiles':
                    if self.sortType == 'name':
                        directories = sorted(directories , key = lambda x: x[2])
                    elif self.sortType == 'dateasc':
                        directories = sorted(directories , key = lambda x: x[1])
                    elif self.sortType == 'datedesc':
                        directories = sorted(directories , key = lambda x: x[1], reverse=True)
                    
                #sortowanie
                #if self.sortType.startswith('date'):
                #    try: files.sort(key=lambda s: os_path.getmtime(os_path.join(directory, s)))
                #    except Exception, e: printDEBUG("Exception sorting by date: %s" % str(e))
                #    if self.sortType == 'datedesc': files.reverse()
                #elif config.plugins.AdvancedFreePlayer.NamesNOfiles.value:
                #    try: files.sort(key=lambda s: cleanFile(s,ReturnMovieYear = False).lower() )
                #    except Exception, e: printDEBUG("Exception sorting by MovieName: %s" % str(e))
                #else:
                #    files.sort(key=lambda s: s.lower())
                #finalnie porzadki
                files = [x[0] for x in files]
                directories = [x[0] for x in directories]
    def changeDir(self, directory, select=None):
        self.list = []

        # if we are just entering from the list of mount points:
        if self.current_directory is None:
            if directory and self.showMountpoints:
                self.current_mountpoint = self.getMountpointLink(directory)
            else:
                self.current_mountpoint = None
        self.current_directory = directory
        directories = []
        files = []

        if directory is None and self.showMountpoints:  # present available mountpoints
            for p in harddiskmanager.getMountedPartitions():
                path = os.path.join(p.mountpoint, "")
                if path not in self.inhibitMounts and not self.inParentDirs(
                        path, self.inhibitDirs):
                    self.list.append(
                        MultiFileSelectEntryComponent(name=p.description,
                                                      absolute=path,
                                                      isDir=True))
            files = []
            directories = []
        elif directory is None:
            files = []
            directories = []
        elif self.useServiceRef:
            # commented out
            #root = eServiceReference(eServiceReference.idFile, eServiceReference.noFlags, eServiceReferenceFS.directory)
            root = eServiceReference(eServiceReference.idFile,
                                     eServiceReference.noFlags)
            root.setPath(directory)
            if self.additional_extensions:
                root.setName(self.additional_extensions)
            serviceHandler = eServiceCenter.getInstance()
            list = serviceHandler.list(root)

            while 1:
                s = list.getNext()
                if not s.valid():
                    del list
                    break
                if s.flags & s.mustDescent:
                    directories.append(s.getPath())
                else:
                    files.append(s)
            #directories.sort()
            #files.sort()
        else:
            if fileExists(directory):
                try:
                    files = os.listdir(directory)
                except:
                    files = []
                #files.sort()
                tmpfiles = files[:]
                for x in tmpfiles:
                    if os.path.isdir(directory + x):
                        directories.append(directory + x + "/")
                        files.remove(x)

        directories = getSortedList(directories, self.sortDirs)
        files = getSortedList(files, self.sortFiles, directory or '')

        if directory is not None and self.showDirectories and not self.isTop:
            if directory == self.current_mountpoint and self.showMountpoints:
                self.list.append(
                    MultiFileSelectEntryComponent(
                        name="<" + _("List of Storage Devices") + ">",
                        absolute=None,
                        isDir=True))
                self.parent_directory = None
            elif (directory != "/") and not (self.inhibitMounts
                                             and self.getMountpoint(directory)
                                             in self.inhibitMounts):
                self.parent_directory = '/'.join(
                    directory.split('/')[:-2]) + '/'
                self.list.append(
                    MultiFileSelectEntryComponent(
                        name="<" + _("Parent Directory") + ">",
                        absolute=self.parent_directory,
                        isDir=True))

        if self.firstDirs:
            if self.showDirectories:
                for x in directories:
                    if not (self.inhibitMounts and self.getMountpoint(x)
                            in self.inhibitMounts) and not self.inParentDirs(
                                x, self.inhibitDirs):
                        name = x.split('/')[-2]
                        testname = x[:-1]
                        alreadySelected = x in self.selectedFiles
                        self.list.append(
                            MultiFileSelectEntryComponent(
                                name=name,
                                absolute=x,
                                isDir=True,
                                isLink=os.path.islink(testname),
                                selected=alreadySelected))

            if self.showFiles:
                for x in files:
                    if self.useServiceRef:
                        path = x.getPath()
                        name = path.split('/')[-1]
                    else:
                        path = directory + x
                        name = x

                    if (self.matchingPattern is
                            None) or self.matchingPattern.search(path):
                        alreadySelected = path in self.selectedFiles
                        self.list.append(
                            MultiFileSelectEntryComponent(
                                name=name,
                                absolute=x,
                                isDir=False,
                                isLink=os.path.islink(path),
                                selected=alreadySelected))
        else:
            if self.showFiles:
                for x in files:
                    if self.useServiceRef:
                        path = x.getPath()
                        name = path.split('/')[-1]
                    else:
                        path = directory + x
                        name = x

                    if (self.matchingPattern is
                            None) or self.matchingPattern.search(path):
                        alreadySelected = path in self.selectedFiles
                        self.list.append(
                            MultiFileSelectEntryComponent(
                                name=name,
                                absolute=x,
                                isDir=False,
                                isLink=os.path.islink(path),
                                selected=alreadySelected))

            if self.showDirectories:
                for x in directories:
                    if not (self.inhibitMounts and self.getMountpoint(x)
                            in self.inhibitMounts) and not self.inParentDirs(
                                x, self.inhibitDirs):
                        name = x.split('/')[-2]
                        testname = x[:-1]
                        alreadySelected = x in self.selectedFiles
                        self.list.append(
                            MultiFileSelectEntryComponent(
                                name=name,
                                absolute=x,
                                isDir=True,
                                isLink=os.path.islink(testname),
                                selected=alreadySelected))

        self.l.setList(self.list)

        if select is not None:
            i = 0
            #self.moveToIndex(0)
            for x in self.list:
                p = x[0][0]

                if isinstance(p, eServiceReference):
                    p = p.getPath()

                if p == select:
                    self.moveToIndex(i)
                i += 1
Example #39
0
                opkgStatusPath = 'var/lib/opkg/status'
                if not os.path.exists(os.path.join('/', opkgStatusPath)):
                    # older opkg versions
                    opkgStatusPath = 'usr/lib/opkg/status'
            if os.path.exists(os.path.join(mountpoint, opkgStatusPath)):
                opkgAddDestination(mountpoint)
        elif why == 'remove':
            try:
                opkgDestinations.remove(mountpoint)
                print "[Ipkg] Removed from OPKG destinations:", mountpoint
            except:
                pass


harddiskmanager.on_partition_list_change.append(onPartitionChange)
for part in harddiskmanager.getMountedPartitions():
    onPartitionChange('add', part)


class IpkgComponent:
    EVENT_INSTALL = 0
    EVENT_DOWNLOAD = 1
    EVENT_INFLATING = 2
    EVENT_CONFIGURING = 3
    EVENT_REMOVE = 4
    EVENT_UPGRADE = 5
    EVENT_LISTITEM = 9
    EVENT_DONE = 10
    EVENT_ERROR = 11
    EVENT_MODIFIED = 12
Example #40
0
 def runInstall(self, val):
     if val:
         if self.type == self.DOWNLOAD:
             if self["list"].l.getCurrentSelection()[0].name.startswith(
                     "picons-"):
                 supported_filesystems = frozenset(
                     ('vfat', 'ext4', 'ext3', 'ext2', 'reiser', 'reiser4',
                      'jffs2', 'ubifs', 'rootfs'))
                 candidates = []
                 import Components.Harddisk
                 mounts = Components.Harddisk.getProcMounts()
                 for partition in harddiskmanager.getMountedPartitions(
                         False, mounts):
                     if partition.filesystem(
                             mounts) in supported_filesystems:
                         candidates.append(
                             (partition.description, partition.mountpoint))
                 if candidates:
                     from Components.Renderer import Picon
                     self.postInstallCall = Picon.initPiconPaths
                     self.session.openWithCallback(
                         self.installDestinationCallback,
                         ChoiceBox,
                         title=_("Install picons on"),
                         list=candidates)
                 return
             elif self["list"].l.getCurrentSelection()[0].name.startswith(
                     "display-picon"):
                 supported_filesystems = frozenset(
                     ('vfat', 'ext4', 'ext3', 'ext2', 'reiser', 'reiser4',
                      'jffs2', 'ubifs', 'rootfs'))
                 candidates = []
                 import Components.Harddisk
                 mounts = Components.Harddisk.getProcMounts()
                 for partition in harddiskmanager.getMountedPartitions(
                         False, mounts):
                     if partition.filesystem(
                             mounts) in supported_filesystems:
                         candidates.append(
                             (partition.description, partition.mountpoint))
                 if candidates:
                     from Components.Renderer import LcdPicon
                     self.postInstallCall = LcdPicon.initLcdPiconPaths
                     self.session.openWithCallback(
                         self.installDestinationCallback,
                         ChoiceBox,
                         title=_("Install lcd picons on"),
                         list=candidates)
                 return
             self.install_settings_name = self[
                 "list"].l.getCurrentSelection()[0].name
             self.install_bootlogo_name = self[
                 "list"].l.getCurrentSelection()[0].name
             if self["list"].l.getCurrentSelection()[0].name.startswith(
                     'settings-'):
                 self.check_settings = True
                 self.startOpkgListInstalled(self.PLUGIN_PREFIX +
                                             'settings-*')
             elif self["list"].l.getCurrentSelection()[0].name.startswith(
                     'bootlogo-'):
                 self.check_bootlogo = True
                 self.startOpkgListInstalled(self.PLUGIN_PREFIX +
                                             'bootlogo-*')
             else:
                 self.runSettingsInstall()
         elif self.type == self.REMOVE:
             if self["list"].l.getCurrentSelection()[0].name.startswith(
                     "bootlogo-"):
                 self.doRemove(
                     self.installFinished,
                     self["list"].l.getCurrentSelection()[0].name +
                     " --force-remove --force-depends")
             else:
                 self.doRemove(self.installFinished,
                               self["list"].l.getCurrentSelection()[0].name)
	def changeDir(self, directory, select=None):
		self.list = []
		if self.current_directory is None:
			if directory and self.showMountpoints:
				self.current_mountpoint = self.getMountpointLink(directory)
			else:
				self.current_mountpoint = None
		self.current_directory = directory
		directories = []
		files = []
		if directory is None and self.showMountpoints:
			for p in harddiskmanager.getMountedPartitions():
				path = os_path.join(p.mountpoint, "")
				if path not in self.inhibitMounts and not self.inParentDirs(path, self.inhibitDirs):
					self.list.append(FileEntryComponent(name=p.description, absolute=path, isDir=True))
			files = []
			directories = []
		elif directory is None:
			files = []
			directories = []
		elif self.useServiceRef:
			root = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + directory)
			if self.additional_extensions:
				root.setName(self.additional_extensions)
			serviceHandler = eServiceCenter.getInstance()
			list = serviceHandler.list(root)
			while True:
				s = list.getNext()
				if not s.valid():
					del list
					break
				if s.flags & s.mustDescent:
					directories.append(s.getPath())
				else:
					files.append(s)
			directories.sort()
			files.sort()
		else:
			if os_path.exists(directory):
				try:
					files = listdir(directory)
				except:
					files = []
				files.sort()
				tmpfiles = files[:]
				for x in tmpfiles:
					if os_path.isdir(directory + x):
						directories.append(directory + x + "/")
						files.remove(x)
		if directory is not None and self.showDirectories and not self.isTop:
			if directory == self.current_mountpoint and self.showMountpoints:
				self.list.append(FileEntryComponent(name="<" + _("List of Storage Devices") + ">", absolute=None, isDir=True))
			elif (directory != "/") and not (self.inhibitMounts and self.getMountpoint(directory) in self.inhibitMounts):
				self.list.append(FileEntryComponent(name="<" + _("Parent Directory") + ">", absolute='/'.join(directory.split('/')[:-2]) + '/', isDir=True))
		if self.showDirectories:
			for x in directories:
				if not (self.inhibitMounts and self.getMountpoint(x) in self.inhibitMounts) and not self.inParentDirs(x, self.inhibitDirs):
					name = x.split('/')[-2]
					self.list.append(FileEntryComponent(name=name, absolute=x, isDir=True))
		if self.showFiles:
			for x in files:
				if self.useServiceRef:
					path = x.getPath()
					name = path.split('/')[-1]
				else:
					path = directory + x
					name = x
					nx = None
					if (config.plugins.DreamExplorer.MediaFilter.value == "on"):
						nx = self.getTSInfo(path)
						if nx is not None:
							name = nx
				EXext = os_path.splitext(path)[1]
				EXext = EXext.replace(".", "")
				EXext = EXext.lower()
				if (EXext == ""):
					EXext = "nothing"
				if (self.matchingPattern is None) or (EXext in self.matchingPattern):
					if nx is None:
						self.list.append(FileEntryComponent(name=name, absolute=x, isDir=False))
					else:
						res = [(x, False)]
						x, y, w, h = skin.parameters.get("DreamexplorerName", (40, 2, 1000, 22))
						res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, name + " [" + self.getTSLength(path) + "]"))
						png = LoadPixmap(resolveFilename(SCOPE_PLUGINS, "Extensions/DreamExplorer/res/movie.png"))
						x, y, w, h = skin.parameters.get("DreamexplorerIcon", (12, 3, 20, 20))
						res.append(MultiContentEntryPixmapAlphaTest(pos=(x, y), size=(w, h), png=png, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO))
						self.list.append(res)
		self.l.setList(self.list)
		if select is not None:
			i = 0
			self.moveToIndex(0)
			for x in self.list:
				p = x[0][0]
				if isinstance(p, eServiceReference):
					p = p.getPath()
				if p == select:
					self.moveToIndex(i)
				i += 1
Example #42
0
	def __init__(self, session):
		if (getDesktop(0).size().width() < 800):
			skin = "%s/skins/setup_sd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
		else:
			skin = "%s/skins/setup_hd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
		f = open(skin, "r")
		self.skin = f.read()
		f.close()
		Screen.__init__(self, session)

		patchtype = getEPGPatchType()
		if patchtype == 0 or patchtype == 1 or patchtype == 3:
			self.fastpatch = True
		else:
			self.fastpatch = False
		
		self.session = session

		self.config = CrossEPG_Config()
		self.config.load()

		self.lamedbs = self.config.getAllLamedbs()

		self.lamedbs_desc = []
		self.mountpoint = []
		self.mountdescription = []
		self.automatictype = []

		self.show_extension = self.config.show_extension
		self.show_plugin = self.config.show_plugin
		self.show_force_reload_as_plugin = self.config.show_force_reload_as_plugin

		# make devices entries
		if self.config.isQBOXHD():
			self.mountdescription.append(_("Internal flash"))
			self.mountpoint.append("/var/crossepg/data")

		for partition in harddiskmanager.getMountedPartitions():
			if (partition.mountpoint != '/') and (partition.mountpoint != '') and self.isMountedInRW(partition.mountpoint):
				self.mountpoint.append(partition.mountpoint + "/crossepg")

				if partition.description != '':
					self.mountdescription.append(partition.description)
				else:
					self.mountdescription.append(partition.mountpoint)
				
		if not self.config.isQBOXHD():		# for other decoders we add internal flash as last entry (it's unsuggested)
			self.mountdescription.append(_("Internal flash (unsuggested)"))
			self.mountpoint.append(self.config.home_directory + "/data")
			
		# make lamedb entries
		for lamedb in self.lamedbs:
			if lamedb == "lamedb":
				self.lamedbs_desc.append(_("main lamedb"))
			else:
				self.lamedbs_desc.append(lamedb.replace("lamedb.", "").replace(".", " "))
				
		# make automatic type entries
		self.automatictype.append(_("disabled"))
		self.automatictype.append(_("once a day"))
		self.automatictype.append(_("every hour (only in standby)"))

		self.list = []
		self["config"] = ConfigList(self.list, session = self.session)
		self["config"].onSelectionChanged.append(self.setInfo)
		self["information"] = Label("")
		self["key_red"] = Button(_("Back"))
		self["key_green"] = Button()
		self["key_yellow"] = Button()
		self["key_blue"] = Button("")
		self["config_actions"] = NumberActionMap(["SetupActions", "InputAsciiActions", "KeyboardInputActions", "ColorActions"],
		{
			"red": self.quit,
			"cancel": self.quit,
			"left": self.keyLeft,
			"right": self.keyRight,
			"home": self.keyHome,
			"end": self.keyEnd,
			"1": self.keyNumberGlobal,
			"2": self.keyNumberGlobal,
			"3": self.keyNumberGlobal,
			"4": self.keyNumberGlobal,
			"5": self.keyNumberGlobal,
			"6": self.keyNumberGlobal,
			"7": self.keyNumberGlobal,
			"8": self.keyNumberGlobal,
			"9": self.keyNumberGlobal,
			"0": self.keyNumberGlobal
		}, -1) # to prevent left/right overriding the listbox

		self.makeList()
Example #43
0
	def refreshMountpoints(self):
		self.mountpoints = [p.mountpoint for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"]
		self.mountpoints.sort(key = lambda x: -len(x))
Example #44
0
def InitUsageConfig():
	config.misc.useNTPminutes = ConfigSelection(default = "30", choices = [("30", "30" + " " +_("minutes")), ("60", _("Hour")), ("1440", _("Once per day"))])
	config.misc.remotecontrol_text_support = ConfigYesNo(default = True)	

	config.usage = ConfigSubsection()
	config.usage.showdish = ConfigSelection(default = "flashing", choices = [("flashing", _("Flashing")), ("normal", _("Not Flashing")), ("off", _("Off"))])
	config.usage.multibouquet = ConfigYesNo(default = True)

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

	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.panicbutton = ConfigYesNo(default = False)

	config.usage.service_icon_enable = ConfigYesNo(default = False)
	config.usage.service_icon_enable.addNotifier(refreshServiceList)
	config.usage.servicelist_cursor_behavior = ConfigSelection(default = "keep", 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.panicbutton = 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, 11):
		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.show_infobar_on_event_change = ConfigYesNo(default = False)
	config.usage.show_infobar_channel_number = ConfigYesNo(default = False)	
	config.usage.show_second_infobar = ConfigYesNo(default = True)
	
	def showsecondinfobarChanged(configElement):
		if config.usage.show_second_infobar.getValue() != "INFOBAREPG":
			SystemInfo["InfoBarEpg"] = True
		else:
			SystemInfo["InfoBarEpg"] = False
	config.usage.second_infobar_timeout = ConfigSelection(default = "5", choices = [("0", _("no timeout"))] + choicelist)	
	config.usage.show_picon_bkgrn = ConfigSelection(default = "transparent", choices = [("none", _("Disabled")), ("transparent", _("Transparent")), ("blue", _("Blue")), ("red", _("Red")), ("black", _("Black")), ("white", _("White")), ("lightgrey", _("Light Grey")), ("grey", _("Grey"))])

	config.usage.show_spinner = ConfigYesNo(default = True)
	config.usage.enable_tt_caching = ConfigYesNo(default = True)
	config.usage.sort_settings = ConfigYesNo(default = False)
	config.usage.sort_menus = ConfigYesNo(default = False)
	config.usage.sort_pluginlist = ConfigYesNo(default = True)
	config.usage.sort_extensionslist = ConfigYesNo(default = False)
	config.usage.movieplayer_pvrstate = 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")) ])
	config.usage.pip_hideOnExit = ConfigSelection(default = "no", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")) ])

	if not os.path.exists(resolveFilename(SCOPE_HDD)):
		try:
			os.mkdir(resolveFilename(SCOPE_HDD),0755)
		except:
			pass
	config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
	if not config.usage.default_path.getValue().endswith('/'):
		tmpvalue = config.usage.default_path.getValue()
		config.usage.default_path.setValue(tmpvalue + '/')
		config.usage.default_path.save()
	def defaultpathChanged(configElement):
		if not config.usage.default_path.getValue().endswith('/'):
			tmpvalue = config.usage.default_path.getValue()
			config.usage.default_path.setValue(tmpvalue + '/')
			config.usage.default_path.save()
	config.usage.default_path.addNotifier(defaultpathChanged, immediate_feedback = False)

	config.usage.timer_path = ConfigText(default = "<default>")
	config.usage.instantrec_path = ConfigText(default = "<default>")

	if not os.path.exists(resolveFilename(SCOPE_TIMESHIFT)):
		try:
			os.mkdir(resolveFilename(SCOPE_TIMESHIFT),0755)
		except:
			pass
	config.usage.timeshift_path = ConfigText(default = resolveFilename(SCOPE_TIMESHIFT))
	if not config.usage.default_path.getValue().endswith('/'):
		tmpvalue = config.usage.timeshift_path.getValue()
		config.usage.timeshift_path.setValue(tmpvalue + '/')
		config.usage.timeshift_path.save()
	def timeshiftpathChanged(configElement):
		if not config.usage.timeshift_path.getValue().endswith('/'):
			tmpvalue = config.usage.timeshift_path.getValue()
			config.usage.timeshift_path.setValue(tmpvalue + '/')
			config.usage.timeshift_path.save()
	config.usage.timeshift_path.addNotifier(timeshiftpathChanged, immediate_feedback = False)
	config.usage.allowed_timeshift_paths = ConfigLocations(default = [resolveFilename(SCOPE_TIMESHIFT)])

	config.usage.movielist_trashcan = ConfigYesNo(default=True)
	config.usage.movielist_trashcan_network_clean = ConfigYesNo(default=False)
	config.usage.movielist_trashcan_days = ConfigSelectionNumber(min = 1, max = 31, stepwidth = 1, default = 8, wraparound = True)
	config.usage.movielist_trashcan_reserve = ConfigNumber(default = 40)
	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 = "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.leave_movieplayer_onExit = ConfigSelection(default = "no", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")) ])

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

	choicelist = [("0", "Disabled")]
	for i in (5, 30, 60, 300, 600, 900, 1200, 1800, 2700, 3600):
		if i < 60:
			m = ngettext("%d second", "%d seconds", i) % i
		else:
			m = abs(i / 60)
			m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append(("%d" % i, m))
	config.usage.screen_saver = ConfigSelection(default = "0", choices = choicelist)

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

	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.jobtaksextensions = ConfigYesNo(default = True)

	config.usage.servicenum_fontsize = ConfigSelectionNumber(default = 2, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.usage.servicename_fontsize = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.usage.serviceinfo_fontsize = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.usage.serviceitems_per_page = ConfigSelectionNumber(default = 10, stepwidth = 1, min = 3, max = 40, wraparound = True)
	config.usage.show_servicelist = ConfigYesNo(default = True)
	config.usage.servicelist_mode = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")),
		("simple", _("Simple")) ] )
	config.usage.servicelistpreview_mode = ConfigYesNo(default = False)
	config.usage.tvradiobutton_mode = ConfigSelection(default="BouquetList", choices = [
					("ChannelList", _("Channel List")),
					("BouquetList", _("Bouquet List")),
					("MovieList", _("Movie List"))])
	config.usage.channelbutton_mode = ConfigSelection(default="0", choices = [
					("0", _("Just change channels")),
					("1", _("Channel List")),
					("2", _("Bouquet List"))])
	config.usage.show_bouquetalways = 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_channel_jump_in_servicelist = ConfigSelection(default="alpha", choices = [
					("alpha", _("Alpha")),
					("number", _("Number"))])

	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.blinking_rec_symbol_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 = True)

	config.usage.swap_snr_on_osd = ConfigYesNo(default = False)
	config.usage.swap_time_display_on_osd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_media_time_display_on_osd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_time_remaining_on_osd = ConfigSelection(default = "0", choices = [("0", _("Remaining")), ("1", _("Elapsed")), ("2", _("Elapsed & Remaining")), ("3", _("Remaining & Elapsed"))])
	config.usage.elapsed_time_positive_osd = ConfigYesNo(default = False)
	config.usage.swap_time_display_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_media_time_display_on_vfd = ConfigSelection(default = "2", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_time_remaining_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Remaining")), ("1", _("Elapsed")), ("2", _("Elapsed & Remaining")), ("3", _("Remaining & Elapsed"))])
	config.usage.elapsed_time_positive_vfd = ConfigYesNo(default = False)

	config.usage.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.usage.lcd_scroll_speed = ConfigSelection(default = "300", choices = [
		("500", _("slow")),
		("300", _("normal")),
		("100", _("fast"))])
		
	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 = ConfigSelection([("0", _("Off")),("1", _("One line")),("2", _("Two lines"))], "2")
	config.usage.show_eit_nownext = ConfigYesNo(default = True)
	config.usage.show_vcr_scart = ConfigYesNo(default = False)
	
	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.bootvideo = ConfigYesNo(default = True)
	def EpgSettingsChanged(configElement):
		from enigma import eEPGCache
		mask = 0xffffffff
		if not config.epg.eit.getValue():
			mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE | eEPGCache.SCHEDULE_OTHER)
		if not config.epg.mhw.getValue():
			mask &= ~eEPGCache.MHW
		if not config.epg.freesat.getValue():
			mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE | eEPGCache.FREESAT_SCHEDULE_OTHER)
		if not config.epg.viasat.getValue():
			mask &= ~eEPGCache.VIASAT
		if not config.epg.netmed.getValue():
			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)

	config.epg.cacheloadsched = ConfigYesNo(default = False)
	config.epg.cachesavesched = ConfigYesNo(default = False)
	def EpgCacheLoadSchedChanged(configElement):
		import EpgLoadSave
		EpgLoadSave.EpgCacheLoadCheck()
	def EpgCacheSaveSchedChanged(configElement):
		import EpgLoadSave
		EpgLoadSave.EpgCacheSaveCheck()
	config.epg.cacheloadsched.addNotifier(EpgCacheLoadSchedChanged, immediate_feedback = False)
	config.epg.cachesavesched.addNotifier(EpgCacheSaveSchedChanged, immediate_feedback = False)
	config.epg.cacheloadtimer = ConfigSelectionNumber(default = 24, stepwidth = 1, min = 1, max = 24, wraparound = True)
	config.epg.cachesavetimer = ConfigSelectionNumber(default = 24, stepwidth = 1, min = 1, max = 24, wraparound = True)

	config.osd.dst_left = ConfigSelectionNumber(default = 0, stepwidth = 1, min = 0, max = 720, wraparound = False)
	config.osd.dst_width = ConfigSelectionNumber(default = 720, stepwidth = 1, min = 0, max = 720, wraparound = False)
	config.osd.dst_top = ConfigSelectionNumber(default = 0, stepwidth = 1, min = 0, max = 576, wraparound = False)
	config.osd.dst_height = ConfigSelectionNumber(default = 576, stepwidth = 1, min = 0, max = 576, wraparound = False)
	config.osd.alpha = ConfigSelectionNumber(default = 255, stepwidth = 1, min = 0, max = 255, wraparound = False)
	config.av.osd_alpha = NoSave(ConfigNumber(default = 255))
	config.osd.threeDmode = ConfigSelection([("off", _("Off")), ("auto", _("Auto")), ("sidebyside", _("Side by Side")),("topandbottom", _("Top and Bottom"))], "auto")
	config.osd.threeDznorm = ConfigSlider(default = 50, increment = 1, limits = (0, 100))
	config.osd.show3dextensions = ConfigYesNo(default = False)
	choiceoptions = [("mode1", _("Mode 1")), ("mode2", _("Mode 2"))]
	config.osd.threeDsetmode = ConfigSelection(default = 'mode1' , choices = choiceoptions )
	
	hddchoises = [('/etc/enigma2/', 'Internal Flash')]
	for p in harddiskmanager.getMountedPartitions():
		if os.path.exists(p.mountpoint):
			d = os.path.normpath(p.mountpoint)
			if p.mountpoint != '/':
				hddchoises.append((p.mountpoint, d))
	config.misc.epgcachepath = ConfigSelection(default = '/etc/enigma2/', choices = hddchoises)
	config.misc.epgcachefilename = ConfigText(default='epg', fixed_size=False)
	config.misc.epgcache_filename = ConfigText(default = (config.misc.epgcachepath.getValue() + config.misc.epgcachefilename.getValue().replace('.dat','') + '.dat'))
	def EpgCacheChanged(configElement):
		config.misc.epgcache_filename.setValue(os.path.join(config.misc.epgcachepath.getValue(), config.misc.epgcachefilename.getValue().replace('.dat','') + '.dat'))
		config.misc.epgcache_filename.save()
		enigma.eEPGCache.getInstance().setCacheFile(config.misc.epgcache_filename.getValue())
		from enigma import eEPGCache
		epgcache = eEPGCache.getInstance()
		epgcache.save()
		if not config.misc.epgcache_filename.getValue().startswith("/etc/enigma2/"):
			if os.path.exists('/etc/enigma2/' + config.misc.epgcachefilename.getValue().replace('.dat','') + '.dat'):
				os.remove('/etc/enigma2/' + config.misc.epgcachefilename.getValue().replace('.dat','') + '.dat')
	config.misc.epgcachepath.addNotifier(EpgCacheChanged, immediate_feedback = False)
	config.misc.epgcachefilename.addNotifier(EpgCacheChanged, immediate_feedback = False)

	config.misc.showradiopic = ConfigYesNo(default = True)

	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.network = ConfigSubsection()
	config.network.AFP_autostart = ConfigYesNo(default = True)
	config.network.NFS_autostart = ConfigYesNo(default = True)
	config.network.OpenVPN_autostart = ConfigYesNo(default = True)
	config.network.Samba_autostart = ConfigYesNo(default = True)
	config.network.Inadyn_autostart = ConfigYesNo(default = True)
	config.network.uShare_autostart = ConfigYesNo(default = True)

	config.softwareupdate = ConfigSubsection()
	config.softwareupdate.autosettingsbackup = ConfigYesNo(default = True)
	config.softwareupdate.autoimagebackup = ConfigYesNo(default = False)
	config.softwareupdate.check = ConfigYesNo(default = True)
	config.softwareupdate.checktimer = ConfigSelectionNumber(min = 1, max = 48, stepwidth = 1, default = 1, wraparound = True)
	config.softwareupdate.updatelastcheck = ConfigInteger(default=0)
	config.softwareupdate.updatefound = NoSave(ConfigBoolean(default = False))
	config.softwareupdate.updatebeta = ConfigYesNo(default = True)
	config.softwareupdate.updateisunstable = ConfigInteger(default=0)

	config.timeshift = ConfigSubsection()
	choicelist = [("0", "Disabled")]
	for i in (2, 3, 4, 5, 10, 20, 30):
		choicelist.append(("%d" % i, ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300):
		m = i / 60
		choicelist.append(("%d" % i, ngettext("%d minute", "%d minutes", m) % m))
	config.timeshift.startdelay = ConfigSelection(default = "0", choices = choicelist)
	config.timeshift.showinfobar = ConfigYesNo(default = True)
	config.timeshift.stopwhilerecording = ConfigYesNo(default = False)
	config.timeshift.favoriteSaveAction = ConfigSelection([("askuser", _("Ask user")),("savetimeshift", _("Save and stop")),("savetimeshiftandrecord", _("Save and record")),("noSave", _("Don't save"))], "askuser")
	config.timeshift.permanentrecording = ConfigYesNo(default = False)
	config.timeshift.isRecording = NoSave(ConfigYesNo(default = False))

	config.seek = ConfigSubsection()
	config.seek.baractivation = ConfigSelection([("leftright", _("Long Left/Right")),("ffrw", _("Long << / >>"))], "leftright")
	config.seek.sensibility = ConfigSelectionNumber(min = 1, max = 10, stepwidth = 1, default = 10, wraparound = True)
	config.seek.selfdefined_13 = ConfigSelectionNumber(min = 1, max = 120, stepwidth = 1, default = 15, wraparound = True)
	config.seek.selfdefined_46 = ConfigSelectionNumber(min = 1, max = 240, stepwidth = 1, default = 60, wraparound = True)
	config.seek.selfdefined_79 = ConfigSelectionNumber(min = 1, max = 480, stepwidth = 1, default = 300, wraparound = True)

	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.crash = ConfigSubsection()
	config.crash.details = ConfigYesNo(default = True)
	config.crash.enabledebug = ConfigYesNo(default = False)
	config.crash.debugloglimit = ConfigSelectionNumber(min = 1, max = 10, stepwidth = 1, default = 4, wraparound = True)
	config.crash.daysloglimit = ConfigSelectionNumber(min = 1, max = 30, stepwidth = 1, default = 8, wraparound = True)
	config.crash.sizeloglimit = ConfigSelectionNumber(min = 1, max = 20, stepwidth = 1, default = 10, wraparound = True)

	debugpath = [('/home/root/logs/', '/home/root/')]
	for p in harddiskmanager.getMountedPartitions():
		if os.path.exists(p.mountpoint):
			d = os.path.normpath(p.mountpoint)
			if p.mountpoint != '/':
				debugpath.append((p.mountpoint + 'logs/', d))
	config.crash.debug_path = ConfigSelection(default = "/home/root/logs/", choices = debugpath)

	def updatedebug_path(configElement):
		if not os.path.exists(config.crash.debug_path.getValue()):
			os.mkdir(config.crash.debug_path.getValue(),0755)
	config.crash.debug_path.addNotifier(updatedebug_path, immediate_feedback = 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 updateEraseSpeed(el):
		enigma.eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.getValue()))
	def updateEraseFlags(el):
		enigma.eBackgroundFileEraser.getInstance().setEraseFlags(int(el.getValue()))
	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") or os.path.exists("/proc/stb/video/zapping_mode")
	if SystemInfo["ZapMode"]:
		try:
			if os.path.exists("/proc/stb/video/zapping_mode"):
				zapoptions = [("mute", _("Black screen")), ("hold", _("Hold screen"))]
				zapfile = "/proc/stb/video/zapping_mode"
			else:
				zapoptions = [("mute", _("Black screen")), ("hold", _("Hold screen")), ("mutetilllock", _("Black screen till locked")), ("holdtilllock", _("Hold till locked"))]
				zapfile = "/proc/stb/video/zapmode"
		except:
			zapoptions = [("mute", _("Black screen")), ("hold", _("Hold screen")), ("mutetilllock", _("Black screen till locked")), ("holdtilllock", _("Hold till locked"))]
			zapfile = "/proc/stb/video/zapmode"

		def setZapmode(el):
			try:
				file = open(zapfile, "w")
				file.write(el.getValue())
				file.close()
			except:
				pass
		config.misc.zapmode = ConfigSelection(default = "mute", choices = zapoptions )
		config.misc.zapmode.addNotifier(setZapmode, immediate_feedback = False)
	config.usage.historymode = ConfigSelection(default = "1", choices = [("0", _("Just zap")), ("1", _("Show menu"))])

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

	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(("%d" % 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 = False)
	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 = "0", choices = [
		("0", _("alternative")),
		("1", _("white")),
		("2", _("yellow")) ])
	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")),
		("und", _("Undetermined")),
		("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", _("Dutch")),
		("eng qaa Englisch", _("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", _("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.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_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)
	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.logmanager = ConfigSubsection()
	config.logmanager.showinextensions = ConfigYesNo(default = False)
	config.logmanager.user = ConfigText(default='', fixed_size=False)
	config.logmanager.useremail = ConfigText(default='', fixed_size=False)
	config.logmanager.usersendcopy = ConfigYesNo(default = True)
	config.logmanager.path = ConfigText(default = "/")
	config.logmanager.additionalinfo = NoSave(ConfigText(default = ""))
	config.logmanager.sentfiles = ConfigLocations(default='')

	config.vixsettings = ConfigSubsection()
	config.vixsettings.Subservice = ConfigYesNo(default = True)
	config.vixsettings.ColouredButtons = ConfigYesNo(default = True)
	config.vixsettings.InfoBarEpg_mode = ConfigSelection(default="3", choices = [
					("0", _("as plugin in extended bar")),
					("1", _("with long OK press")),
					("2", _("with exit button")),
					("3", _("with left/right buttons"))])

	config.epgselection = ConfigSubsection()
	config.epgselection.sort = ConfigSelection(default="0", choices = [("0", _("Time")),("1", _("Alphanumeric"))])
	config.epgselection.overjump = ConfigYesNo(default = False)
	config.epgselection.infobar_type_mode = ConfigSelection(choices = [("graphics",_("Multi EPG")), ("single", _("Single EPG"))], default = "graphics")
	if SystemInfo.get("NumVideoDecoders", 1) > 1:
		config.epgselection.infobar_preview_mode = ConfigSelection(choices = [("0",_("Disabled")), ("1", _("Full screen")), ("2", _("PiP"))], default = "1")
	else:
		config.epgselection.infobar_preview_mode = ConfigSelection(choices = [("0",_("Disabled")), ("1", _("Full screen"))], default = "1")
	config.epgselection.infobar_ok = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap")
	config.epgselection.infobar_oklong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap + Exit")
	config.epgselection.infobar_itemsperpage = ConfigSelectionNumber(default = 2, stepwidth = 1, min = 2, max = 4, wraparound = True)
	if SystemInfo.get("NumVideoDecoders", 1) > 1:
		if about.getCPUString() in ('BCM7346B2', 'BCM7425B2'):
			previewdefault = "2"
		else:
			previewdefault = "1"
		config.epgselection.infobar_preview_mode = ConfigSelection(choices = [("0",_("Disabled")), ("1", _("Full screen")), ("2", _("PiP"))], default = previewdefault)
	else:
		config.epgselection.infobar_preview_mode = ConfigSelection(choices = [("0",_("Disabled")), ("1", _("Full screen"))], default = "1")
	config.epgselection.infobar_roundto = ConfigSelection(default = "15", choices = [("15", _("%d minutes") % 15), ("30", _("%d minutes") % 30), ("60", _("%d minutes") % 60)])
	config.epgselection.infobar_prevtime = ConfigClock(default = time())
	config.epgselection.infobar_prevtimeperiod = ConfigSelection(default = "180", choices = [("60", _("%d minutes") % 60), ("90", _("%d minutes") % 90), ("120", _("%d minutes") % 120), ("150", _("%d minutes") % 150), ("180", _("%d minutes") % 180), ("210", _("%d minutes") % 210), ("240", _("%d minutes") % 240), ("270", _("%d minutes") % 270), ("300", _("%d minutes") % 300)])
	config.epgselection.infobar_primetimehour = ConfigSelectionNumber(default = 20, stepwidth = 1, min = 00, max = 23, wraparound = True)
	config.epgselection.infobar_primetimemins = ConfigSelectionNumber(default = 00, stepwidth = 1, min = 00, max = 59, wraparound = True)
	config.epgselection.infobar_servicetitle_mode = ConfigSelection(default = "servicename", choices = [("servicename", _("Service Name")),("picon", _("Picon")),("picon+servicename", _("Picon and Service Name")) ])
	config.epgselection.infobar_servfs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.infobar_eventfs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.infobar_timelinefs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.infobar_servicewidth = ConfigSelectionNumber(default = 250, stepwidth = 1, min = 70, max = 500, wraparound = True)
	config.epgselection.infobar_piconwidth = ConfigSelectionNumber(default = 100, stepwidth = 1, min = 70, max = 500, wraparound = True)
	config.epgselection.enhanced_preview_mode = ConfigYesNo(default = True)
	config.epgselection.enhanced_ok = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap")
	config.epgselection.enhanced_oklong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap + Exit")
	config.epgselection.enhanced_eventfs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.enhanced_itemsperpage = ConfigSelectionNumber(default = 18, stepwidth = 1, min = 12, max = 40, wraparound = True)
	config.epgselection.multi_showbouquet = ConfigYesNo(default = False)
	config.epgselection.multi_preview_mode = ConfigYesNo(default = True)
	config.epgselection.multi_ok = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap")
	config.epgselection.multi_oklong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap + Exit")
	config.epgselection.multi_eventfs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.multi_itemsperpage = ConfigSelectionNumber(default = 18, stepwidth = 1, min = 12, max = 40, wraparound = True)
	config.epgselection.graph_showbouquet = ConfigYesNo(default = False)
	config.epgselection.graph_preview_mode = ConfigYesNo(default = True)
	config.epgselection.graph_type_mode = ConfigSelection(choices = [("graphics",_("Graphics")), ("text", _("Text"))], default = "graphics")
	config.epgselection.graph_ok = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap")
	config.epgselection.graph_oklong = ConfigSelection(choices = [("Zap",_("Zap")), ("Zap + Exit", _("Zap + Exit"))], default = "Zap + Exit")
	config.epgselection.graph_info = ConfigSelection(choices = [("Channel Info", _("Channel Info")), ("Single EPG", _("Single EPG"))], default = "Channel Info")
	config.epgselection.graph_infolong = ConfigSelection(choices = [("Channel Info", _("Channel Info")), ("Single EPG", _("Single EPG"))], default = "Single EPG")
	config.epgselection.graph_roundto = ConfigSelection(default = "15", choices = [("15", _("%d minutes") % 15), ("30", _("%d minutes") % 30), ("60", _("%d minutes") % 60)])
	config.epgselection.graph_prevtime = ConfigClock(default = time())
	config.epgselection.graph_prevtimeperiod = ConfigSelection(default = "180", choices = [("60", _("%d minutes") % 60), ("90", _("%d minutes") % 90), ("120", _("%d minutes") % 120), ("150", _("%d minutes") % 150), ("180", _("%d minutes") % 180), ("210", _("%d minutes") % 210), ("240", _("%d minutes") % 240), ("270", _("%d minutes") % 270), ("300", _("%d minutes") % 300)])
	config.epgselection.graph_primetimehour = ConfigSelectionNumber(default = 20, stepwidth = 1, min = 00, max = 23, wraparound = True)
	config.epgselection.graph_primetimemins = ConfigSelectionNumber(default = 00, stepwidth = 1, min = 00, max = 59, wraparound = True)
	config.epgselection.graph_servicetitle_mode = ConfigSelection(default = "picon+servicename", choices = [("servicename", _("Service Name")),("picon", _("Picon")),("picon+servicename", _("Picon and Service Name")) ])
	config.epgselection.graph_channel1 = ConfigYesNo(default = False)
	config.epgselection.graph_servfs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.graph_eventfs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.graph_timelinefs = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.epgselection.graph_itemsperpage = ConfigSelectionNumber(default = 8, stepwidth = 1, min = 3, max = 16, wraparound = True)
	config.epgselection.graph_pig = ConfigYesNo(default = True)
	config.epgselection.graph_heightswitch = NoSave(ConfigYesNo(default = False))
	config.epgselection.graph_servicewidth = ConfigSelectionNumber(default = 250, stepwidth = 1, min = 70, max = 500, wraparound = True)
	config.epgselection.graph_piconwidth = ConfigSelectionNumber(default = 100, stepwidth = 1, min = 70, max = 500, wraparound = True)

	if not os.path.exists('/usr/emu_scripts/'):
		os.mkdir('/usr/emu_scripts/',0755)
	softcams = os.listdir('/usr/emu_scripts/')
	config.oscaminfo = ConfigSubsection()
	config.oscaminfo.showInExtensions = ConfigYesNo(default=False)
	config.oscaminfo.userdatafromconf = ConfigYesNo(default = False)
	config.oscaminfo.autoupdate = ConfigYesNo(default = False)
	config.oscaminfo.username = ConfigText(default = "username", fixed_size = False, visible_width=12)
	config.oscaminfo.password = ConfigPassword(default = "password", fixed_size = False)
	config.oscaminfo.ip = ConfigIP( default = [ 127,0,0,1 ], auto_jump=True)
	config.oscaminfo.port = ConfigInteger(default = 16002, limits=(0,65536) )
	config.oscaminfo.intervall = ConfigSelectionNumber(min = 1, max = 600, stepwidth = 1, default = 10, wraparound = True)
	SystemInfo["OScamInstalled"] = False

	config.cccaminfo = ConfigSubsection()
	config.cccaminfo.showInExtensions = ConfigYesNo(default=False)
	config.cccaminfo.serverNameLength = ConfigSelectionNumber(min = 10, max = 100, stepwidth = 1, default = 22, wraparound = True)
	config.cccaminfo.name = ConfigText(default="Profile", fixed_size=False)
	config.cccaminfo.ip = ConfigText(default="192.168.2.12", fixed_size=False)
	config.cccaminfo.username = ConfigText(default="", fixed_size=False)
	config.cccaminfo.password = ConfigText(default="", fixed_size=False)
	config.cccaminfo.port = ConfigInteger(default=16001, limits=(1, 65535))
	config.cccaminfo.profile = ConfigText(default="", fixed_size=False)
	config.cccaminfo.ecmInfoEnabled = ConfigYesNo(default=True)
	config.cccaminfo.ecmInfoTime = ConfigSelectionNumber(min = 1, max = 10, stepwidth = 1, default = 5, wraparound = True)
	config.cccaminfo.ecmInfoForceHide = ConfigYesNo(default=True)
	config.cccaminfo.ecmInfoPositionX = ConfigInteger(default=50)
	config.cccaminfo.ecmInfoPositionY = ConfigInteger(default=50)
	config.cccaminfo.blacklist = ConfigText(default="/media/cf/CCcamInfo.blacklisted", fixed_size=False)
	config.cccaminfo.profiles = ConfigText(default="/media/cf/CCcamInfo.profiles", fixed_size=False)
	SystemInfo["CCcamInstalled"] = False
	for softcam in softcams:
		if softcam.lower().startswith('cccam'):
			config.cccaminfo.showInExtensions = ConfigYesNo(default=True)
			SystemInfo["CCcamInstalled"] = True
		elif softcam.lower().startswith('oscam'):
			config.oscaminfo.showInExtensions = ConfigYesNo(default=True)
			SystemInfo["OScamInstalled"] = True

	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)

	config.pluginbrowser = ConfigSubsection()
	config.pluginbrowser.po = ConfigYesNo(default = False)
	config.pluginbrowser.src = ConfigYesNo(default = False)
Example #45
0
    def changeDir(self, directory, select=None):
        self.list = []
        if self.current_directory is None:
            if directory and self.showMountpoints:
                self.current_mountpoint = self.getMountpointLink(directory)
            else:
                self.current_mountpoint = None
        self.current_directory = directory
        directories = []
        files = []
        if directory is None and self.showMountpoints:
            for p in harddiskmanager.getMountedPartitions():
                path = os.path.join(p.mountpoint, '')
                if path not in self.inhibitMounts and not self.inParentDirs(
                        path, self.inhibitDirs):
                    self.list.append(
                        MultiFileSelectEntryComponent(name=p.description,
                                                      absolute=path,
                                                      isDir=True))

            files = []
            directories = []
        elif directory is None:
            files = []
            directories = []
        elif self.useServiceRef:
            root = eServiceReference('2:0:1:0:0:0:0:0:0:0:' + directory)
            if self.additional_extensions:
                root.setName(self.additional_extensions)
            serviceHandler = eServiceCenter.getInstance()
            list = serviceHandler.list(root)
            while 1:
                s = list.getNext()
                if not s.valid():
                    del list
                    break
                if s.flags & s.mustDescent:
                    directories.append(s.getPath())
                else:
                    files.append(s)

            directories.sort()
            files.sort()
        elif fileExists(directory):
            try:
                files = os.listdir(directory)
            except:
                files = []

            files.sort()
            tmpfiles = files[:]
            for x in tmpfiles:
                if os.path.isdir(directory + x):
                    directories.append(directory + x + '/')
                    files.remove(x)

        if directory is not None and self.showDirectories and not self.isTop:
            if directory == self.current_mountpoint and self.showMountpoints:
                self.list.append(
                    MultiFileSelectEntryComponent(
                        name='<' + _('List of storage devices') + '>',
                        absolute=None,
                        isDir=True))
            elif directory != '/' and not (self.inhibitMounts
                                           and self.getMountpoint(directory)
                                           in self.inhibitMounts):
                self.list.append(
                    MultiFileSelectEntryComponent(
                        name='<' + _('Parent directory') + '>',
                        absolute='/'.join(directory.split('/')[:-2]) + '/',
                        isDir=True))
        if self.showDirectories:
            for x in directories:
                if not (self.inhibitMounts and self.getMountpoint(x)
                        in self.inhibitMounts) and not self.inParentDirs(
                            x, self.inhibitDirs):
                    name = x.split('/')[-2]
                    alreadySelected = x in self.selectedFiles or os.path.normpath(
                        x) in self.selectedFiles
                    self.list.append(
                        MultiFileSelectEntryComponent(
                            name=name,
                            absolute=x,
                            isDir=True,
                            selected=alreadySelected))

        if self.showFiles:
            for x in files:
                if self.useServiceRef:
                    path = x.getPath()
                    name = path.split('/')[-1]
                else:
                    path = directory + x
                    name = x
                if self.matchingPattern is None or self.matchingPattern.search(
                        path):
                    alreadySelected = False
                    for entry in self.selectedFiles:
                        if entry == path:
                            alreadySelected = True

                    self.list.append(
                        MultiFileSelectEntryComponent(
                            name=name,
                            absolute=x,
                            isDir=False,
                            selected=alreadySelected))

        self.l.setList(self.list)
        if select is not None:
            i = 0
            self.moveToIndex(0)
            for x in self.list:
                p = x[0][0]
                if isinstance(p, eServiceReference):
                    p = p.getPath()
                if p == select:
                    self.moveToIndex(i)
                i += 1

        return
Example #46
0
 def refreshMountpoints(self):
     self.mountpoints = [
         os_path.join(p.mountpoint, "")
         for p in harddiskmanager.getMountedPartitions()
     ]
     self.mountpoints.sort(reverse=True)
    def updateSwap2(self, result=None, retval=None, extra_args=None):
        self.swapsize = 0
        self.swap_place = ''
        self.swap_active = False
        self.device = False
        if result.find('sd') > 0:
            self['key_green'].setText("")
            for line in result.split('\n'):
                if line.find('sd') > 0:
                    parts = line.strip().split()
                    self.swap_place = parts[0]
                    if self.swap_place == 'sfdisk:':
                        self.swap_place = ''
                    self.device = True
                f = open('/proc/swaps', 'r')
                for line in f.readlines():
                    parts = line.strip().split()
                    if line.find('partition') != -1:
                        self.swap_active = True
                        self.swapsize = parts[2]
                        continue
                f.close()
        else:
            self['key_green'].setText(_("Create"))
            devicelist = []
            for p in harddiskmanager.getMountedPartitions():
                d = path.normpath(p.mountpoint)
                if path.exists(
                        p.mountpoint
                ) and p.mountpoint != "/" and not p.mountpoint.startswith(
                        '/media/net'):
                    devicelist.append((p.description, d))
            if len(devicelist):
                for device in devicelist:
                    for filename in glob(device[1] + '/swap*'):
                        self.swap_place = filename
                        self['key_green'].setText(_("Delete"))
                        info = mystat(self.swap_place)
                        self.swapsize = info[stat.ST_SIZE]
                        continue

        if config.plugins.infopanel.swapautostart.value and self.swap_place:
            self['autostart_off'].hide()
            self['autostart_on'].show()
        else:
            config.plugins.infopanel.swapautostart.value = False
            config.plugins.infopanel.swapautostart.save()
            configfile.save()
            self['autostart_on'].hide()
            self['autostart_off'].show()
        self['labplace'].setText(self.swap_place)
        self['labplace'].show()

        f = open('/proc/swaps', 'r')
        for line in f.readlines():
            parts = line.strip().split()
            if line.find('partition') != -1:
                self.swap_active = True
                continue
            elif line.find('file') != -1:
                self.swap_active = True
                continue
        f.close()

        if self.swapsize > 0:
            if self.swapsize >= 1024:
                self.swapsize = int(self.swapsize) / 1024
                if self.swapsize >= 1024:
                    self.swapsize = int(self.swapsize) / 1024
                self.swapsize = str(self.swapsize) + ' ' + 'MB'
            else:
                self.swapsize = str(self.swapsize) + ' ' + 'KB'
        else:
            self.swapsize = ''

        self['labsize'].setText(self.swapsize)
        self['labsize'].show()

        if self.swap_active == True:
            self['inactive'].hide()
            self['active'].show()
            self['key_red'].setText(_("Deactivate"))
            self['swapactive_summary'].setText(
                _("Current Status:") + ' ' + _("Active"))
        else:
            self['inactive'].show()
            self['active'].hide()
            self['key_red'].setText(_("Activate"))
            self['swapactive_summary'].setText(
                _("Current Status:") + ' ' + _("Inactive"))

        scanning = _("Enable Swap at startup")
        self['lab1'].setText(scanning)
        self['lab1'].show()
        self["actions"].setEnabled(True)

        name = self['labplace'].text
        self['swapname_summary'].setText(name)
Example #48
0
    def changeDir(self, directory, select=None):
        self.list = []

        # if we are just entering from the list of mount points:
        if self.current_directory is None:
            if directory and self.showMountpoints:
                self.current_mountpoint = self.getMountpointLink(directory)
            else:
                self.current_mountpoint = None
        self.current_directory = directory
        directories = []
        files = []

        if directory is None and self.showMountpoints:  # present available mountpoints
            for p in harddiskmanager.getMountedPartitions():
                path = os_path.join(p.mountpoint, "")
                if path not in self.inhibitMounts and not self.inParentDirs(
                        path, self.inhibitDirs):
                    self.list.append(
                        FileEntryComponent(name=p.description,
                                           absolute=path,
                                           isDir=True,
                                           currDir=self.current_directory))
            files = []
            directories = []
        elif directory is None:
            files = []
            directories = []
        elif self.useServiceRef:
            root = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + directory)
            if self.additional_extensions:
                root.setName(self.additional_extensions)
            serviceHandler = eServiceCenter.getInstance()
            list = serviceHandler.list(root)

            while 1:
                s = list.getNext()
                if not s.valid():
                    del list
                    break
                if s.flags & s.mustDescent:
                    directories.append(s.getPath())
                else:
                    files.append(s)
            directories.sort(key=lambda s: s.lower())
            files.sort(key=lambda s: s.lower())
        else:
            if fileExists(directory):
                try:
                    files = listdir(directory)

                except Exception, e:
                    files = []
                if self.sortDate:
                    try:
                        files.sort(key=lambda s: os_path.getmtime(
                            os_path.join(directory, s)))
                    except Exception, e:
                        print "Exception sorting by date!!! ", str(e)
                    files.reverse()
                elif config.plugins.AdvancedFreePlayer.NamesNOfiles.value:
                    try:
                        files.sort(key=lambda s: cleanFile(
                            s, ReturnMovieYear=False).lower())
                    except Exception, e:
                        print "Exception sorting by MovieName!!! ", str(e)
Example #49
0
    def changeDir(self, directory, select=None):
        self.list = []

        # if we are just entering from the list of mount points:
        if self.current_directory is None:
            if directory and self.showMountpoints:
                self.current_mountpoint = self.getMountpointLink(directory)
            else:
                self.current_mountpoint = None
        self.current_directory = directory
        directories = []
        files = []

        if directory is None and self.showMountpoints:  # present available mountpoints
            for p in harddiskmanager.getMountedPartitions():
                path = os_path.join(p.mountpoint, "")
                if path not in self.inhibitMounts and not self.inParentDirs(
                        path, self.inhibitDirs):
                    self.list.append(
                        FileEntryComponent(name=p.description,
                                           absolute=path,
                                           isDir=True))
            files = []
            directories = []
        elif directory is None:
            files = []
            directories = []
        elif self.useServiceRef:
            root = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + directory)
            if self.additional_extensions:
                root.setName(self.additional_extensions)
            serviceHandler = eServiceCenter.getInstance()
            list = serviceHandler.list(root)

            while 1:
                s = list.getNext()
                if not s.valid():
                    del list
                    break
                if s.flags & s.mustDescent:
                    directories.append(s.getPath())
                else:
                    files.append(s)
            directories.sort()
            files.sort()
        else:
            if fileExists(directory):
                try:
                    files = listdir(directory)
                except:
                    files = []
                files.sort()
                tmpfiles = files[:]
                for x in tmpfiles:
                    if os_path.isdir(directory + x):
                        directories.append(directory + x + "/")
                        files.remove(x)

        if directory is not None and self.showDirectories and not self.isTop:
            if directory == self.current_mountpoint and self.showMountpoints:
                self.list.append(
                    FileEntryComponent(name="<" +
                                       _("List of Storage Devices") + ">",
                                       absolute=None,
                                       isDir=True))
            elif (directory != "/") and not (self.inhibitMounts
                                             and self.getMountpoint(directory)
                                             in self.inhibitMounts):
                self.list.append(
                    FileEntryComponent(
                        name="<" + _("Parent Directory") + ">",
                        absolute='/'.join(directory.split('/')[:-2]) + '/',
                        isDir=True))

        if self.showDirectories:
            for x in directories:
                if not (self.inhibitMounts and self.getMountpoint(x)
                        in self.inhibitMounts) and not self.inParentDirs(
                            x, self.inhibitDirs):
                    name = x.split('/')[-2]
                    self.list.append(
                        FileEntryComponent(name=name, absolute=x, isDir=True))

        if self.showFiles:
            for x in files:
                if self.useServiceRef:
                    path = x.getPath()
                    name = path.split('/')[-1]
                else:
                    path = directory + x
                    name = x

                if (self.matchingPattern is None) or re_compile(
                        self.matchingPattern).search(path):
                    self.list.append(
                        FileEntryComponent(name=name, absolute=x, isDir=False))

        if self.showMountpoints and len(self.list) == 0:
            self.list.append(
                FileEntryComponent(name=_("nothing connected"),
                                   absolute=None,
                                   isDir=False))

        self.l.setList(self.list)

        if select is not None:
            i = 0
            self.moveToIndex(0)
            for x in self.list:
                p = x[0][0]

                if isinstance(p, eServiceReference):
                    p = p.getPath()

                if p == select:
                    self.moveToIndex(i)
                i += 1
    def changeDir(self, directory, select=None):
        self.list = []
        if self.current_directory is None:
            if directory and self.showMountpoints:
                self.current_mountpoint = self.getMountpointLink(directory)
            else:
                self.current_mountpoint = None
        self.current_directory = directory
        directories = []
        files = []
        if directory is None and self.showMountpoints:
            for p in harddiskmanager.getMountedPartitions():
                path = os_path.join(p.mountpoint, "")
                if path not in self.inhibitMounts and not self.inParentDirs(
                        path, self.inhibitDirs):
                    self.list.append(
                        FileEntryComponent(name=p.description,
                                           absolute=path,
                                           isDir=True))
            files = []
            directories = []
        elif directory is None:
            files = []
            directories = []
        elif self.useServiceRef:
            root = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + directory)
            if self.additional_extensions:
                root.setName(self.additional_extensions)
            serviceHandler = eServiceCenter.getInstance()
            list = serviceHandler.list(root)
            while True:
                s = list.getNext()
                if not s.valid():
                    del list
                    break
                if s.flags & s.mustDescent:
                    directories.append(s.getPath())
                else:
                    files.append(s)
            directories.sort()
            files.sort()
        else:
            if os_path.exists(directory):
                try:
                    files = listdir(directory)
                except:
                    files = []
                files.sort()
                tmpfiles = files[:]
                for x in tmpfiles:
                    if os_path.isdir(directory + x):
                        directories.append(directory + x + "/")
                        files.remove(x)
        if directory is not None and self.showDirectories and not self.isTop:
            if directory == self.current_mountpoint and self.showMountpoints:
                self.list.append(
                    FileEntryComponent(name="<" +
                                       _("List of Storage Devices") + ">",
                                       absolute=None,
                                       isDir=True))
            elif (directory != "/") and not (self.inhibitMounts
                                             and self.getMountpoint(directory)
                                             in self.inhibitMounts):
                self.list.append(
                    FileEntryComponent(
                        name="<" + _("Parent Directory") + ">",
                        absolute='/'.join(directory.split('/')[:-2]) + '/',
                        isDir=True))
        if self.showDirectories:
            for x in directories:
                if not (self.inhibitMounts and self.getMountpoint(x)
                        in self.inhibitMounts) and not self.inParentDirs(
                            x, self.inhibitDirs):
                    name = x.split('/')[-2]
                    self.list.append(
                        FileEntryComponent(name=name, absolute=x, isDir=True))
        if self.showFiles:
            for x in files:
                if self.useServiceRef:
                    path = x.getPath()
                    name = path.split('/')[-1]
                else:
                    path = directory + x
                    name = x
                    nx = None
#					if (config.plugins.DreamExplorer.MediaFilter.value == "on"):
#						nx = self.getTSInfo(path)
#						if nx is not None:
#							name = nx
                EXext = os_path.splitext(path)[1]
                EXext = EXext.replace(".", "")
                EXext = EXext.lower()
                if (EXext == ""):
                    EXext = "nothing"
                if (self.matchingPattern is None) or (EXext
                                                      in self.matchingPattern):
                    if nx is None:
                        self.list.append(
                            FileEntryComponent(name=name,
                                               absolute=x,
                                               isDir=False))
                    else:
                        res = [(x, False)]
                        res.append(
                            (eListboxPythonMultiContent.TYPE_TEXT, 40, 2, 1000,
                             22, 0, RT_HALIGN_LEFT,
                             name + " [" + self.getTSLength(path) + "]"))
                        #						png = LoadPixmap("/usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/res/movie.png")
                        #						res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 12, 3, 20, 20, png))
                        self.list.append(res)
        self.l.setList(self.list)
        if select is not None:
            i = 0
            self.moveToIndex(0)
            select2 = select
            if select.endswith("/"):
                select2 = os_path.basename(select[:-1])
#			print("dir,select",directory,select,select2)
            for x in self.list:
                #				print("xx",x)
                p = x[0][0]
                #				print("pp",p)
                if isinstance(p, eServiceReference):
                    p = p.getPath()
                if p == select or p == select2:
                    #					print("moveto",i)
                    self.moveToIndex(i)
                i += 1
Example #51
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 = "keep", choices = [
		("standard", _("Standard")),
		("keep", _("Keep service")),
		("reverseB", _("Reverse bouquet buttons")),
		("keep reverseB", _("Keep service") + " + " + _("Reverse bouquet buttons"))])

	choicelist = [("by skin", _("As defined by the skin"))]
	for i in range (5,41):
		choicelist.append((str(i)))
	config.usage.servicelist_number_of_services = ConfigSelection(default = "by skin", choices = choicelist)
	config.usage.servicelist_number_of_services.addNotifier(refreshServiceList)

	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 = "5", choices = [("-1", _("None"))] + choicelist + [("EPG",_("EPG"))])
	config.usage.show_simple_second_infobar = ConfigYesNo(default = False)
	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 = True)
	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.menu_sort_weight = ConfigDictionarySet(default = { "mainmenu" : {"submenu" : {} }})
	config.usage.menu_sort_mode = ConfigSelection(default = "user", choices = [
		("a_z", _("alphabetical")),
		("default", _("Default")),
		("user", _("user defined")),])
	config.usage.menu_show_numbers = ConfigYesNo(default = False)
	config.usage.menu_path = ConfigSelection(default = "off", choices = [
		("off", _("Disabled")),
		("small", _("Small")),
		("large", _("Large")),])
	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.cccaminfo = ConfigSubsection()
	config.cccaminfo.showInExtensions = ConfigYesNo(default=False)
	config.cccaminfo.serverNameLength = ConfigSelectionNumber(min = 10, max = 100, stepwidth = 1, default = 22, wraparound = True)
	config.cccaminfo.name = ConfigText(default="Profile", fixed_size=False)
	config.cccaminfo.ip = ConfigText(default="192.168.2.12", fixed_size=False)
	config.cccaminfo.username = ConfigText(default="", fixed_size=False)
	config.cccaminfo.password = ConfigText(default="", fixed_size=False)
	config.cccaminfo.port = ConfigInteger(default=16001, limits=(1, 65535))
	config.cccaminfo.profile = ConfigText(default="", fixed_size=False)
	config.cccaminfo.ecmInfoEnabled = ConfigYesNo(default=True)
	config.cccaminfo.ecmInfoTime = ConfigSelectionNumber(min = 1, max = 10, stepwidth = 1, default = 5, wraparound = True)
	config.cccaminfo.ecmInfoForceHide = ConfigYesNo(default=True)
	config.cccaminfo.ecmInfoPositionX = ConfigInteger(default=50)
	config.cccaminfo.ecmInfoPositionY = ConfigInteger(default=50)
	config.cccaminfo.blacklist = ConfigText(default="/media/cf/CCcamInfo.blacklisted", fixed_size=False)
	config.cccaminfo.profiles = ConfigText(default="/media/cf/CCcamInfo.profiles", fixed_size=False)

	config.oscaminfo = ConfigSubsection()
	config.oscaminfo.showInExtensions = ConfigYesNo(default=False)
	config.oscaminfo.userdatafromconf = ConfigYesNo(default = False)
	config.oscaminfo.autoupdate = ConfigYesNo(default = False)
	config.oscaminfo.username = ConfigText(default = "username", fixed_size = False, visible_width=12)
	config.oscaminfo.password = ConfigPassword(default = "password", fixed_size = False)
	config.oscaminfo.ip = ConfigIP( default = [ 127,0,0,1 ], auto_jump=True)
	config.oscaminfo.port = ConfigInteger(default = 16002, limits=(0,65536) )
	config.oscaminfo.intervall = ConfigSelectionNumber(min = 1, max = 600, stepwidth = 1, default = 10, wraparound = True)
	SystemInfo["OScamInstalled"] = False

	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")), ("playallvideos", _("Play All Videos (without infos)"))])
	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_enabled = ConfigSelection(default = "no", choices = [
		("no", _("No")),
		("yes", _("Yes")),
		("standby", _("Yes, only from standby")),
		("deepstandby", _("Yes, only from deep standby")) ])
	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))

	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_deep_standby = ConfigSelection(default = "deep", choices = [ ("deep", _("Deep standby")), ("standby",  _("Standby"))] )
	config.usage.inactivity_timer_blocktime = ConfigYesNo(default = False)
	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)))
	config.usage.inactivity_timer_blocktime_by_weekdays = ConfigYesNo(default = False)
	config.usage.inactivity_timer_blocktime_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_begin_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_end_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_begin_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_end_day = ConfigSubDict()
	for i in range(7):
		config.usage.inactivity_timer_blocktime_day[i] = ConfigYesNo(default = False)
		config.usage.inactivity_timer_blocktime_begin_day[i] = ConfigClock(default = time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_end_day[i] = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_extra_day[i] = ConfigYesNo(default = False)
		config.usage.inactivity_timer_blocktime_extra_begin_day[i] = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_extra_end_day[i] = 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 = False)
	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")) ])

	def remote_fallback_changed(configElement):
		if configElement.value:
			configElement.value = "%s%s" % (not configElement.value.startswith("http://") and "http://" or "", configElement.value)
			configElement.value = "%s%s" % (configElement.value, configElement.value.count(":") == 1 and ":8001" or "")
	config.usage.remote_fallback_enabled = ConfigYesNo(default = False)
	config.usage.remote_fallback = ConfigText(default = "", fixed_size = False)
	config.usage.remote_fallback.addNotifier(remote_fallback_changed, immediate_feedback=False)

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

	dvbs_nims = [("-2", _("Disabled"))]
	dvbt_nims = [("-2", _("Disabled"))]
	dvbc_nims = [("-2", _("Disabled"))]
	atsc_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()))
		elif x.isCompatible("ATSC"):
			atsc_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)
	config.usage.frontend_priority_atsc = ConfigSelection(default = "-2", choices = list(atsc_nims))
	atsc_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_atsc = ConfigSelection(default = "-2", choices = atsc_nims)

	SystemInfo["DVB-S_priority_tuner_available"] = len(dvbs_nims) > 3 and any(len(i) > 2 for i in (dvbt_nims, dvbc_nims, atsc_nims))
	SystemInfo["DVB-T_priority_tuner_available"] = len(dvbt_nims) > 3 and any(len(i) > 2 for i in (dvbs_nims, dvbc_nims, atsc_nims))
	SystemInfo["DVB-C_priority_tuner_available"] = len(dvbc_nims) > 3 and any(len(i) > 2 for i in (dvbs_nims, dvbt_nims, atsc_nims))
	SystemInfo["ATSC_priority_tuner_available"] = len(atsc_nims) > 3 and any(len(i) > 2 for i in (dvbs_nims, dvbc_nims, dvbt_nims))

	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)
        config.usage.swap_time_display_on_osd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_media_time_display_on_osd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_time_remaining_on_osd = ConfigSelection(default = "0", choices = [("0", _("Remaining")), ("1", _("Elapsed")), ("2", _("Elapsed & Remaining")), ("3", _("Remaining & Elapsed"))])
	config.usage.elapsed_time_positive_osd = ConfigYesNo(default = False)
	config.usage.swap_time_display_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_media_time_display_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_time_remaining_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Remaining")), ("1", _("Elapsed")), ("2", _("Elapsed & Remaining")), ("3", _("Remaining & Elapsed"))])
	config.usage.elapsed_time_positive_vfd = 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.show_picon_in_display = ConfigYesNo(default = True)
	config.usage.hide_zap_errors = ConfigYesNo(default = False)
	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")][:SystemInfo["HasFullHDSkinSupport"] and 4 or 3])

	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)

	hddchoices = [('/', 'Internal Flash'), ('/hdd', '/hdd')]
	for p in harddiskmanager.getMountedPartitions():
		if os.path.exists(p.mountpoint):
			d = os.path.normpath(p.mountpoint)
			if p.mountpoint != '/':
				hddchoices.append((p.mountpoint, d))
	config.misc.epgcachepath = ConfigSelection(default = '/hdd', choices = hddchoices)
	def EpgCacheChanged(configElement):
		eEPGCache.getInstance().setCacheFile(config.misc.epgcachepath.value + "/epg.dat")
		epgcache = eEPGCache.getInstance()
		epgcache.save()
	config.misc.epgcachepath.addNotifier(EpgCacheChanged, immediate_feedback = False)

	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.seek.withjumps = 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 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["HasForceLNBOn"]:
		def forceLNBPowerChanged(configElement):
			open(SystemInfo["HasForceLNBOn"], "w").write(configElement.value)
		config.misc.forceLnbPower = ConfigSelection(default = "on", choices = [ ("on", _("Yes")), ("off", _("No"))] )
		config.misc.forceLnbPower.addNotifier(forceLNBPowerChanged)

	if SystemInfo["HasForceToneburst"]:
		def forceToneBurstChanged(configElement):
			open(SystemInfo["HasForceToneburst"], "w").write(configElement.value)
		config.misc.forceToneBurst = ConfigSelection(default = "enable", choices = [ ("enable", _("Yes")), ("disable", _("No"))] )
		config.misc.forceToneBurst.addNotifier(forceToneBurstChanged)

	if SystemInfo["HasBypassEdidChecking"]:
		def setHasBypassEdidChecking(configElement):
			open(SystemInfo["HasBypassEdidChecking"], "w").write(configElement.value)
		config.av.bypassEdidChecking = ConfigSelection(default = "00000000", choices = [ ("00000001", _("Yes")), ("00000000", _("No"))] )
		config.av.bypassEdidChecking.addNotifier(setHasBypassEdidChecking)

	if SystemInfo["HasColorspace"]:
		def setHaveColorspace(configElement):
			open(SystemInfo["HasColorspace"], "w").write(configElement.value)
		if SystemInfo["HasColorspaceSimple"]:
			config.av.hdmicolorspace = ConfigSelection(default = "Edid(Auto)", choices={"Edid(Auto)": _("Auto"), "Hdmi_Rgb": _("RGB"), "444": _("YCbCr444"), "422": _("YCbCr422"), "420": _("YCbCr420")})
		else:
			config.av.hdmicolorspace = ConfigSelection(default = "auto", choices={"auto": _("auto"), "rgb": _("rgb"), "420": _("420"), "422": _("422"), "444": _("444")})
		config.av.hdmicolorspace.addNotifier(setHaveColorspace)

	if SystemInfo["HasColordepth"]:
		def setHaveColordepth(configElement):
			open(SystemInfo["HasColordepth"], "w").write(configElement.value)
		config.av.hdmicolordepth = ConfigSelection(default = "auto", choices={"auto": _("Auto"), "8bit": _("8bit"), "10bit": _("10bit"), "12bit": _("12bit")})
		config.av.hdmicolordepth.addNotifier(setHaveColordepth)

	if SystemInfo["HasHDMIpreemphasis"]:
		def setHDMIpreemphasis(configElement):
			open(SystemInfo["HasHDMIpreemphasis"], "w").write(configElement.value)
		config.av.hdmipreemphasis = ConfigSelection(default = "off", choices = [ ("on", _("Yes")), ("off", _("No"))] )
		config.av.hdmipreemphasis.addNotifier(setHDMIpreemphasis)

	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")),
		("chn sgp", _("Simplified Chinese")),
		("twn hkn",_("Traditional Chinese")),
		("ces cze", _("Czech")),
		("dan", _("Danish")),
		("dut ndl nld", _("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 DUB ud1", _("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)

	SystemInfo["GraphMultiEpg"] = os.path.exists("/usr/lib/enigma2/python/Plugins/Extensions/GraphMultiEPG")
	if SystemInfo["GraphMultiEpg"]:
		config.misc.graph_mepg = ConfigSubsection()
		config.misc.graph_mepg.extension_menu = ConfigYesNo(default = True)
		
	config.misc.ci_autopin = ConfigYesNo(default = False)

	config.mediaplayer = ConfigSubsection()
	config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
	config.mediaplayer.alternateUserAgent = ConfigText(default="")
Example #52
0
    def populate_List(self):
        imparts = []
        for p in harddiskmanager.getMountedPartitions():
            if path.exists(p.mountpoint):
                d = path.normpath(p.mountpoint)
                if p.mountpoint != '/':
                    imparts.append((p.mountpoint, d))
        config.imagemanager.backuplocation.setChoices(imparts)

        if config.imagemanager.backuplocation.value.endswith('/'):
            mount = config.imagemanager.backuplocation.value, config.imagemanager.backuplocation.value[:
                                                                                                       -1]
        else:
            mount = config.imagemanager.backuplocation.value + '/', config.imagemanager.backuplocation.value
        hdd = '/media/hdd/', '/media/hdd'
        if mount not in config.imagemanager.backuplocation.choices.choices:
            if hdd in config.imagemanager.backuplocation.choices.choices:
                self['myactions'] = ActionMap(
                    [
                        'ColorActions', 'OkCancelActions', 'DirectionActions',
                        "MenuActions", "HelpActions"
                    ], {
                        "ok": self.keyResstore,
                        'cancel': self.close,
                        'red': self.keyDelete,
                        'green': self.GreenPressed,
                        'yellow': self.doDownload,
                        'blue': self.keyResstore,
                        "menu": self.createSetup,
                        "up": self.refreshUp,
                        "down": self.refreshDown,
                        "displayHelp": self.doDownload,
                    }, -1)

                self.BackupDirectory = '/media/hdd/imagebackups/'
                config.imagemanager.backuplocation.value = '/media/hdd/'
                config.imagemanager.backuplocation.save()
                self['lab1'].setText(
                    _("The chosen location does not exist, using /media/hdd") +
                    "\n" + _("Select an image to restore:"))
            else:
                self['myactions'] = ActionMap([
                    'ColorActions', 'OkCancelActions', 'DirectionActions',
                    "MenuActions"
                ], {
                    'cancel': self.close,
                    "menu": self.createSetup,
                }, -1)

                self['lab1'].setText(
                    _("Device: None available") + "\n" +
                    _("Select an image to restore:"))
        else:
            self['myactions'] = ActionMap(
                [
                    'ColorActions', 'OkCancelActions', 'DirectionActions',
                    "MenuActions", "HelpActions"
                ], {
                    'cancel': self.close,
                    'red': self.keyDelete,
                    'green': self.GreenPressed,
                    'yellow': self.doDownload,
                    'blue': self.keyResstore,
                    "menu": self.createSetup,
                    "up": self.refreshUp,
                    "down": self.refreshDown,
                    "displayHelp": self.doDownload,
                    "ok": self.keyResstore,
                }, -1)

            self.BackupDirectory = config.imagemanager.backuplocation.value + 'imagebackups/'
            s = statvfs(config.imagemanager.backuplocation.value)
            free = (s.f_bsize * s.f_bavail) / (1024 * 1024)
            self['lab1'].setText(
                _("Device: ") + config.imagemanager.backuplocation.value +
                ' ' + _('Free space:') + ' ' + str(free) + _('MB') + "\n" +
                _("Select an image to restore:"))

        try:
            if not path.exists(self.BackupDirectory):
                mkdir(self.BackupDirectory, 0755)
            if path.exists(self.BackupDirectory +
                           config.imagemanager.folderprefix.value +
                           '-swapfile_backup'):
                system('swapoff ' + self.BackupDirectory +
                       config.imagemanager.folderprefix.value +
                       '-swapfile_backup')
                remove(self.BackupDirectory +
                       config.imagemanager.folderprefix.value +
                       '-swapfile_backup')
            self.refreshList()
        except:
            self['lab1'].setText(
                _("Device: ") + config.imagemanager.backuplocation.value +
                "\n" +
                _("there is a problem with this device, please reformat and try again."
                  ))
Example #53
0
def InitUsageConfig():
	try:
		file = open('/etc/image-version', 'r')
		lines = file.readlines()
		file.close()
		for x in lines:
			splitted = x.split('=')
			if splitted[0] == "box_type":
				folderprefix = splitted[1].replace('\n','') # 0 = release, 1 = experimental
				boxtype = splitted[1].replace('\n','') # 0 = release, 1 = experimental
	except:
		folderprefix=""
		boxtype="not detected"
	config.misc.boxtype = ConfigText(default = boxtype)

	config.usage = ConfigSubsection()
	config.usage.showdish = ConfigYesNo(default = False)
	config.usage.subnetwork = ConfigYesNo(default = True)
	config.usage.subnetwork_cable = ConfigYesNo(default = True)
	config.usage.subnetwork_terrestrial = 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.servicelist_twolines = ConfigYesNo(default = False)
	config.usage.servicelist_twolines.addNotifier(refreshServiceList)
	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 = "2", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename")), ("3", _("Red colored"))])
	config.usage.record_indicator_mode.addNotifier(refreshServiceList)

	choicelist = [("-1", _("Disabled"))]
	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.servicelist_eventinfo_delay = ConfigSelectionNumber(50, 1000, 50, default=150)
	config.usage.service_icon_enable = ConfigYesNo(default = False)
	config.usage.service_icon_enable.addNotifier(refreshServiceList)
	config.usage.servicelist_cursor_behavior = ConfigSelection(default = "keep", choices = [
		("standard", _("Standard")),
		("keep", _("Keep service")),
		("reverseB", _("Reverse bouquet buttons")),
		("keep reverseB", _("Keep service") + " + " + _("Reverse bouquet buttons"))])

	choicelist = [("by skin", _("As defined by the skin"))]
	for i in range (5,41):
		choicelist.append((str(i)))
	config.usage.servicelist_number_of_services = ConfigSelection(default = "by skin", choices = choicelist)
	config.usage.servicelist_number_of_services.addNotifier(refreshServiceList)

	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_do_dimming = ConfigYesNo(default = False)
	config.usage.show_infobar_dimming_speed = ConfigSelectionNumber(min = 1, max = 20, stepwidth = 1, default = 3, wraparound = True)
	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 = "0", choices = [("", _("None"))] + choicelist + [("EPG",_("EPG"))])
	config.usage.show_simple_second_infobar = ConfigYesNo(default = False)
	config.usage.infobar_frontend_source = ConfigSelection(default = "settings", 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 = True)
	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.menu_sort_weight = ConfigDictionarySet(default = { "mainmenu" : {"submenu" : {} }})
	config.usage.menu_sort_mode = ConfigSelection(default = "default", choices = [("a_z", _("alphabetical")), ("default", _("Default")), ("user", _("user defined")), ("user_hidden", _("user defined hidden"))])
	config.usage.menu_show_numbers = ConfigSelection(default = "no", choices = [("no", _("no")), ("menu&plugins", _("in menu and plugins")), ("menu", _("in menu only")), ("plugins", _("in plugins only"))])
	config.usage.menu_path = ConfigSelection(default = "off", choices = [
		("off", _("Disabled")),
		("small", _("Small")),
		("large", _("Large")),])
	config.usage.sort_settings = ConfigYesNo(default = False)
	config.usage.sort_pluginlist = 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 = "-1", choices = choicelist)

	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.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_enabled = ConfigSelection(default = "no", choices = [
		("no", _("Disabled")),
		("yes", _("Enabled")),
		("standby", _("Enabled, only from standby")),
		("deepstandby", _("Enabled, only from deep standby")) ])
	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))

	choicelist = [("0", _("Disabled"))]
	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)))
	config.usage.inactivity_timer_blocktime_by_weekdays = ConfigYesNo(default = False)
	config.usage.inactivity_timer_blocktime_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_begin_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_end_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_begin_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_end_day = ConfigSubDict()
	for i in range(7):
		config.usage.inactivity_timer_blocktime_day[i] = ConfigYesNo(default = False)
		config.usage.inactivity_timer_blocktime_begin_day[i] = ConfigClock(default = time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_end_day[i] = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_extra_day[i] = ConfigYesNo(default = False)
		config.usage.inactivity_timer_blocktime_extra_begin_day[i] = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_extra_end_day[i] = 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 [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 = False)
	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")) ])

	def remote_fallback_changed(configElement):
		if configElement.value:
			configElement.value = "%s%s" % (not configElement.value.startswith("http://") and "http://" or "", configElement.value)
			configElement.value = "%s%s" % (configElement.value, configElement.value.count(":") == 1 and ":8001" or "")

	config.usage.remote_fallback_enabled = ConfigYesNo(default = False)
	config.usage.remote_fallback = ConfigText(default = "http://IP-ADRESS:8001", fixed_size = False)
	config.usage.remote_fallback.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_import_url = ConfigText(default = "", fixed_size = False)
	config.usage.remote_fallback_import_url.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_alternative = ConfigYesNo(default = False)
	config.usage.remote_fallback_dvb_t = ConfigText(default = "", fixed_size = False)
	config.usage.remote_fallback_dvb_t.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_dvb_c = ConfigText(default = "", fixed_size = False)
	config.usage.remote_fallback_dvb_c.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_atsc = ConfigText(default = "", fixed_size = False)
	config.usage.remote_fallback_atsc.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_import = ConfigSelection(default = "", choices = [("", _("Disable")), ("channels", _("Enable"))])
	config.usage.remote_fallback_import_restart = ConfigYesNo(default = False)
	config.usage.remote_fallback_import_standby = ConfigYesNo(default = False)
	config.usage.remote_fallback_ok = ConfigYesNo(default = False)
	config.usage.remote_fallback_nok = ConfigYesNo(default = False)
	config.usage.remote_fallback_extension_menu = ConfigYesNo(default = False)
	config.usage.remote_fallback_external_timer = ConfigYesNo(default = False)
	config.usage.remote_fallback_openwebif_customize = ConfigYesNo(default = False)
	config.usage.remote_fallback_openwebif_userid = ConfigText(default = "root")
	config.usage.remote_fallback_openwebif_password = ConfigPassword(default = "default")
	config.usage.remote_fallback_openwebif_port = ConfigInteger(default=80, limits=(0,65535))

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

	dvbs_nims = [("-2", _("Disabled"))]
	dvbt_nims = [("-2", _("Disabled"))]
	dvbc_nims = [("-2", _("Disabled"))]
	atsc_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()))
		elif x.isCompatible("ATSC"):
			atsc_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)
	config.usage.frontend_priority_atsc = ConfigSelection(default = "-2", choices = list(atsc_nims))
	atsc_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_atsc = ConfigSelection(default = "-2", choices = atsc_nims)

	SystemInfo["DVB-S_priority_tuner_available"] = len(dvbs_nims) > 3 and any(len(i) > 2 for i in (dvbt_nims, dvbc_nims, atsc_nims))
	SystemInfo["DVB-T_priority_tuner_available"] = len(dvbt_nims) > 3 and any(len(i) > 2 for i in (dvbs_nims, dvbc_nims, atsc_nims))
	SystemInfo["DVB-C_priority_tuner_available"] = len(dvbc_nims) > 3 and any(len(i) > 2 for i in (dvbs_nims, dvbt_nims, atsc_nims))
	SystemInfo["ATSC_priority_tuner_available"] = len(atsc_nims) > 3 and any(len(i) > 2 for i in (dvbs_nims, dvbc_nims, dvbt_nims))

	config.misc.disable_background_scan = ConfigYesNo(default = False)
	config.misc.use_ci_assignment = 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)
	config.usage.maxchannelnumlen = ConfigSelection(default = "5", choices = [("4", _("4")), ("5", _("5"))])
	config.usage.numzaptimeoutmode = ConfigSelection(default = "standard", choices = [("standard", _("Standard")), ("userdefined", _("User defined")), ("off", _("off"))])

	choicelist = []
	for i in range(750, 5001, 250):
		choicelist.append(("%d" % i, "%d ms" % i))
	config.usage.numzaptimeout1 = ConfigSelection(default = "3000", choices = choicelist)
	config.usage.numzaptimeout2 = ConfigSelection(default = "1000", choices = choicelist)

	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.show_picon_in_display = ConfigYesNo(default = True)
	config.usage.hide_zap_errors = ConfigYesNo(default = True)
	config.misc.use_ci_assignment = ConfigYesNo(default = True)
	config.usage.hide_ci_messages = ConfigYesNo(default = False)
	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")][:SystemInfo["HasFullHDSkinSupport"] and 4 or 3])

	if SystemInfo["Bootvideo"]:
		config.usage.show_bootvideo = ConfigYesNo(default = False)

	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["PowerLED"]:
		def powerLEDChanged(configElement):
			open(SystemInfo["PowerLED"], "w").write(configElement.value and "on" or "off")
		config.usage.powerLED = ConfigYesNo(default = True)
		config.usage.powerLED.addNotifier(powerLEDChanged)

	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["SuspendLED"]:
		def suspendLEDChanged(configElement):
			open(SystemInfo["SuspendLED"], "w").write(configElement.value and "on" or "off")
		config.usage.suspendLED = ConfigYesNo(default = True)
		config.usage.suspendLED.addNotifier(suspendLEDChanged)

	if SystemInfo["PowerOffDisplay"]:
		def powerOffDisplayChanged(configElement):
			open(SystemInfo["PowerOffDisplay"], "w").write(configElement.value and "1" or "0")
		config.usage.powerOffDisplay = ConfigYesNo(default = True)
		config.usage.powerOffDisplay.addNotifier(powerOffDisplayChanged)

	if SystemInfo["LCDshow_symbols"]:
		def lcdShowSymbols(configElement):
			open(SystemInfo["LCDshow_symbols"], "w").write(configElement.value and "1" or "0")
		config.usage.lcd_show_symbols = ConfigYesNo(default = True)
		config.usage.lcd_show_symbols.addNotifier(lcdShowSymbols)

	config.network = ConfigSubsection()
	if SystemInfo["WakeOnLAN"]:
		def wakeOnLANChanged(configElement):
			open(SystemInfo["WakeOnLAN"], "w").write(configElement.value and "on" or "off")
		config.network.wol = ConfigYesNo(default = False)
		config.network.wol.addNotifier(wakeOnLANChanged)

	if SystemInfo["hasXcoreVFD"]:
		def set12to8characterVFD(configElement):
			open(SystemInfo["hasXcoreVFD"], "w").write(not configElement.value and "1" or "0")
		config.usage.toggle12to8characterVFD = ConfigYesNo(default = False)
		config.usage.toggle12to8characterVFD.addNotifier(set12to8characterVFD)

	if SystemInfo["LcdLiveTVMode"]:
		def setLcdLiveTVMode(configElement):
			open(SystemInfo["LcdLiveTVMode"], "w").write(configElement.value)
		config.usage.LcdLiveTVMode = ConfigSelection(default = "0", choices=[str(x) for x in range(0,9)])
		config.usage.LcdLiveTVMode.addNotifier(setLcdLiveTVMode)

	if SystemInfo["LcdLiveDecoder"]:
		def setLcdLiveDecoder(configElement):
			open(SystemInfo["LcdLiveDecoder"], "w").write(configElement.value)
		config.usage.LcdLiveDecoder = ConfigSelection(default = "0", choices=[str(x) for x in range(0,4)])
		config.usage.LcdLiveDecoder.addNotifier(setLcdLiveDecoder)

	config.usage.boolean_graphic = ConfigSelection(default="true", choices={"false": _("no"), "true": _("yes"), "only_bool": _("yes, but not in multi selections")})

	config.epg = ConfigSubsection()
	config.epg.eit = ConfigYesNo(default = True)
	config.epg.mhw = ConfigYesNo(default = False)
	config.epg.freesat = ConfigYesNo(default = False)
	config.epg.viasat = ConfigYesNo(default = False)
	config.epg.netmed = ConfigYesNo(default = False)
	config.epg.virgin = ConfigYesNo(default = False)
	config.epg.saveepg = ConfigYesNo(default = True)
	config.epg.opentv = 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)
		if not config.epg.opentv.value:
			mask &= ~eEPGCache.OPENTV
		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.opentv.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)

	config.epg.cacheloadsched = ConfigYesNo(default = False)
	config.epg.cachesavesched = ConfigYesNo(default = False)
	def EpgCacheLoadSchedChanged(configElement):
		import EpgLoadSave
		EpgLoadSave.EpgCacheLoadCheck()
	def EpgCacheSaveSchedChanged(configElement):
		import EpgLoadSave
		EpgLoadSave.EpgCacheSaveCheck()
	config.epg.cacheloadsched.addNotifier(EpgCacheLoadSchedChanged, immediate_feedback = False)
	config.epg.cachesavesched.addNotifier(EpgCacheSaveSchedChanged, immediate_feedback = False)
	config.epg.cacheloadtimer = ConfigSelectionNumber(default = 6, stepwidth = 1, min = 1, max = 24, wraparound = True)
	config.epg.cachesavetimer = ConfigSelectionNumber(default = 3, stepwidth = 1, min = 1, max = 24, wraparound = True)

	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.usage.timerlist_finished_timer_position = ConfigSelection(default = "end", choices = [("beginning", _("At beginning")), ("end", _("At end"))])

	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.crash = ConfigSubsection()
	config.crash.enabledebug = ConfigYesNo(default = False)
	debugpath = [('/home/root/logs/', '/home/root/')]
	for p in harddiskmanager.getMountedPartitions():
		d = os.path.normpath(p.mountpoint)
		if os.path.exists(p.mountpoint):
			if p.mountpoint != '/':
				debugpath.append((d + '/logs/', p.mountpoint))
	config.crash.debug_path = ConfigSelection(default = "/home/root/logs/", choices = debugpath)
	def updatedebug_path(configElement):
		if not os.path.exists(config.crash.debug_path.getValue()):
			os.mkdir(config.crash.debug_path.getValue(),0755)
	config.crash.debug_path.addNotifier(updatedebug_path, immediate_feedback = False)
	crashlogheader = _("We are really sorry. Your receiver encountered " \
					 "a software problem, and needs to be restarted.\n" \
					 "Please send the logfile %senigma2_crash_xxxxxx.log to www.teamblue.tech.\n" \
					 "Your receiver restarts in 10 seconds!\n" \
					 "Component: enigma2") % config.crash.debug_path.value
	config.crash.debug_text = ConfigText(default=crashlogheader, fixed_size=False)

	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", _("Disabled")),
		("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)

	if SystemInfo["HasBypassEdidChecking"]:
		def setHasBypassEdidChecking(configElement):
			open(SystemInfo["HasBypassEdidChecking"], "w").write(configElement.value)
		config.av.bypassEdidChecking = ConfigSelection(default = "00000000", choices = [ ("00000001", _("yes")), ("00000000", _("no"))] )
		config.av.bypassEdidChecking.addNotifier(setHasBypassEdidChecking)

	if SystemInfo["HasColorspace"]:
		def setHaveColorspace(configElement):
			open(SystemInfo["HasColorspace"], "w").write(configElement.value)
		if SystemInfo["HasColorspaceSimple"]:
			config.av.hdmicolorspace = ConfigSelection(default = "Edid(Auto)", choices={"Edid(Auto)": _("Auto"), "Hdmi_Rgb": _("RGB"), "444": _("YCbCr444"), "422": _("YCbCr422"), "420": _("YCbCr420")})
		else:
			# config.av.hdmicolorspace = ConfigSelection(default = "auto", choices={"auto": _("auto"), "rgb": _("rgb"), "420": _("420"), "422": _("422"), "444": _("444")})
			config.av.hdmicolorspace = ConfigSelection(default = "Edid(Auto)", choices={"Edid(Auto)": _("Auto"), "Hdmi_Rgb": _("RGB"), "Itu_R_BT_709": _("Itu_R_BT_709"), "Unknown": _("Unknown")})
		config.av.hdmicolorspace.addNotifier(setHaveColorspace)

	if SystemInfo["HasColordepth"]:
		def setHaveColordepth(configElement):
			open(SystemInfo["HasColordepth"], "w").write(configElement.value)
		config.av.hdmicolordepth = ConfigSelection(default = "auto", choices={"auto": _("Auto"), "8bit": _("8bit"), "10bit": _("10bit"), "12bit": _("12bit")})
		config.av.hdmicolordepth.addNotifier(setHaveColordepth)

	if SystemInfo["HasHDMIpreemphasis"]:
		def setHDMIpreemphasis(configElement):
			open(SystemInfo["HasHDMIpreemphasis"], "w").write(configElement.value)
		config.av.hdmipreemphasis = ConfigSelection(default = "off", choices = [ ("on", _("yes")), ("off", _("no"))] )
		config.av.hdmipreemphasis.addNotifier(setHDMIpreemphasis)

	if SystemInfo["HasColorimetry"]:
		def setColorimetry(configElement):
			open(SystemInfo["HasColorimetry"], "w").write(configElement.value)
		config.av.hdmicolorimetry = ConfigSelection(default = "auto", choices = [("auto", _("Auto")), ("bt2020ncl", _("BT 2020 NCL")), ("bt2020cl", _("BT 2020 CL")), ("bt709", _("BT 709"))])
		config.av.hdmicolorimetry.addNotifier(setColorimetry)

	if SystemInfo["HasHdrType"]:
		def setHdmiHdrType(configElement):
			open(SystemInfo["HasHdrType"], "w").write(configElement.value)
		config.av.hdmihdrtype = ConfigSelection(default = "auto", choices={"auto": _("Auto"), "none": _("SDR"), "hdr10": _("HDR10"), "hlg": _("HLG"), "dolby": _("Dolby")})
		config.av.hdmihdrtype.addNotifier(setHdmiHdrType)
		
	if SystemInfo["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)

	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 = False)
	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_subtitle_removehi = ConfigYesNo(default = False)
	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")),
		("chn sgp", _("Chinese - Simplified")),
		("twn hkn",_("Chinese - Traditional")),
		("ces cze", _("Czech")),
		("dan", _("Danish")),
		("dut ndl nld", _("Dutch")),
		("eng qaa", _("English")),
		("est", _("Estonian")),
		("fin", _("Finnish")),
		("fra fre", _("French")),
		("deu ger", _("German")),
		("ell gre grc", _("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")),
		("NAR", _("Visual impaired commentary"))]

	epg_language_choices = audio_language_choices[:1] + audio_language_choices [2:]
	def setEpgLanguage(configElement):
		eServiceEvent.setEPGLanguage(configElement.value)
	def setEpgLanguageAlternative(configElement):
		eServiceEvent.setEPGLanguageAlternative(configElement.value)
	def epglanguage(configElement):
		config.autolanguage.audio_epglanguage.setChoices([x for x in epg_language_choices if x[0] and x[0] != config.autolanguage.audio_epglanguage_alternative.value or not x[0] and not config.autolanguage.audio_epglanguage_alternative.value])
		config.autolanguage.audio_epglanguage_alternative.setChoices([x for x in epg_language_choices if x[0] and x[0] != config.autolanguage.audio_epglanguage.value or not x[0]])
	config.autolanguage.audio_epglanguage = ConfigSelection(epg_language_choices, default="")
	config.autolanguage.audio_epglanguage_alternative = ConfigSelection(epg_language_choices, default="")
	config.autolanguage.audio_epglanguage.addNotifier(setEpgLanguage)
	config.autolanguage.audio_epglanguage.addNotifier(epglanguage, initial_call=False)
	config.autolanguage.audio_epglanguage_alternative.addNotifier(setEpgLanguageAlternative)
	config.autolanguage.audio_epglanguage_alternative.addNotifier(epglanguage)

	def getselectedlanguages(range):
		return [eval("config.autolanguage.audio_autoselect%x.value" % x) for x in range]
	def autolanguage(configElement):
		config.autolanguage.audio_autoselect1.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((2,3,4)) or not x[0] and not config.autolanguage.audio_autoselect2.value])
		config.autolanguage.audio_autoselect2.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((1,3,4)) or not x[0] and not config.autolanguage.audio_autoselect3.value])
		config.autolanguage.audio_autoselect3.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((1,2,4)) or not x[0] and not config.autolanguage.audio_autoselect4.value])
		config.autolanguage.audio_autoselect4.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((1,2,3)) or not x[0]])
	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_autoselect1.addNotifier(autolanguage, initial_call=False)
	config.autolanguage.audio_autoselect2.addNotifier(autolanguage, initial_call=False)
	config.autolanguage.audio_autoselect3.addNotifier(autolanguage, initial_call=False)
	config.autolanguage.audio_autoselect4.addNotifier(autolanguage)
	config.autolanguage.audio_defaultac3 = ConfigYesNo(default = True)
	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:]
	def getselectedsublanguages(range):
		return [eval("config.autolanguage.subtitle_autoselect%x.value" % x) for x in range]
	def autolanguagesub(configElement):
		config.autolanguage.subtitle_autoselect1.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((2,3,4)) or not x[0] and not config.autolanguage.subtitle_autoselect2.value])
		config.autolanguage.subtitle_autoselect2.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((1,3,4)) or not x[0] and not config.autolanguage.subtitle_autoselect3.value])
		config.autolanguage.subtitle_autoselect3.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((1,2,4)) or not x[0] and not config.autolanguage.subtitle_autoselect4.value])
		config.autolanguage.subtitle_autoselect4.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((1,2,3)) or not x[0]])
		choicelist = [('0', _("None"))]
		for y in range(1, 15 if config.autolanguage.subtitle_autoselect4.value else (7 if config.autolanguage.subtitle_autoselect3.value else(4 if config.autolanguage.subtitle_autoselect2.value else (2 if config.autolanguage.subtitle_autoselect1.value else 0)))):
			choicelist.append((str(y), ", ".join([eval("config.autolanguage.subtitle_autoselect%x.getText()" % x) for x in (y & 1, y & 2, y & 4 and 3, y & 8 and 4) if x])))
		if config.autolanguage.subtitle_autoselect3.value:
			choicelist.append((str(y+1), "All"))
		config.autolanguage.equal_languages.setChoices(choicelist, default="0")
	config.autolanguage.equal_languages = ConfigSelection(default="0", choices=[str(x) for x in range(0, 16)])
	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_autoselect1.addNotifier(autolanguagesub, initial_call=False)
	config.autolanguage.subtitle_autoselect2.addNotifier(autolanguagesub, initial_call=False)
	config.autolanguage.subtitle_autoselect3.addNotifier(autolanguagesub, initial_call=False)
	config.autolanguage.subtitle_autoselect4.addNotifier(autolanguagesub)
	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.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)

	config.mediaplayer = ConfigSubsection()
	config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
	config.mediaplayer.alternateUserAgent = ConfigText(default="")
    def __init__(self, session):
        Screen.__init__(self, session)
        self.setup_title = _("Configuration save / load EPG")
        self.onChangedEntry = []
        self.prev_lastepgcachepath = config.misc.epgcache_filename.value
        self.current_epgpath = config.plugins.epgrefresh_extra.epgcachepath.value
        hddchoises = []
        if self.current_epgpath != '/etc/enigma2/':
            hddchoises = [('/etc/enigma2/', '/etc/enigma2/')]
        for p in harddiskmanager.getMountedPartitions():
            if os.path.exists(p.mountpoint) and os.access(
                    p.mountpoint, os.F_OK | os.R_OK):
                if p.mountpoint != '/':
                    d = os.path.normpath(p.mountpoint)
                    hddchoises.append((d + '/', p.mountpoint + '/'))
        if self.current_epgpath and self.current_epgpath != '/' and (
                self.current_epgpath, self.current_epgpath) in hddchoises:
            #hddchoises.append((self.current_epgpath, self.current_epgpath))
            default_epg = self.current_epgpath
        else:
            default_epg = None
        config.plugins.epgrefresh_extra.add_epgcachepath = NoSave(
            ConfigSelection(default=default_epg, choices=hddchoises))
        self.list = [
            getConfigListEntry(_("Manual save EPG"),
                               config.plugins.epgrefresh_extra.manual_save,
                               _("Manual saving EPG in current cachefile.")),
            getConfigListEntry(
                _("Manual load EPG"),
                config.plugins.epgrefresh_extra.manual_load,
                _("Manual loading EPG from current cachefile.")),
            getConfigListEntry(
                _("Manual reload EPG"),
                config.plugins.epgrefresh_extra.manual_reload,
                _("Manual saving and loading EPG from current cachefile.")),
            getConfigListEntry(
                _("Manual restore EPG backup"),
                config.plugins.epgrefresh_extra.restore_backup,
                _("Manual restore EPG from backup cachefile and loading.")),
            getConfigListEntry(
                _("Automatic save EPG"),
                config.plugins.epgrefresh_extra.cachesavesched,
                _("Automatic saving EPG in current cachefile after a specified time."
                  )),
            getConfigListEntry(_("Save every (in hours)"),
                               config.plugins.epgrefresh_extra.cachesavetimer,
                               _("Do not set too short period of time.")),
            getConfigListEntry(
                _("Automatic load EPG"),
                config.plugins.epgrefresh_extra.cacheloadsched,
                _("Automatic loading EPG from current cachefile after a specified time."
                  )),
            getConfigListEntry(
                _("Load every (in hours)"),
                config.plugins.epgrefresh_extra.cacheloadtimer,
                _("This option is not recommended to be used only in exceptional cases. Do not set too short period of time."
                  )),
            getConfigListEntry(
                _("EPG cache path"),
                config.plugins.epgrefresh_extra.add_epgcachepath,
                _("Select the path to EPG cache,not recommended to use the internal flash."
                  )),
            getConfigListEntry(
                _("EPG cache filename"),
                config.plugins.epgrefresh_extra.epgcachefilename,
                _("Select the file name EPG cache, if you do not like credit default name."
                  )),
            getConfigListEntry(
                _("Create backup when saving EPG"),
                config.plugins.epgrefresh_extra.save_backup,
                _("Create backup cachefile, after manual or automatic saving EPG."
                  )),
            getConfigListEntry(
                _("Auto restore EPG backup on boot"),
                config.plugins.epgrefresh_extra.autorestore_backup,
                _("Auto restore EPG from backup cachefile and loading on boot."
                  )),
            getConfigListEntry(_("Show manual change EPG in main menu"),
                               config.plugins.epgrefresh_extra.main_menu,
                               _("Changes are needed to restart enigma2.")),
            getConfigListEntry(
                _("Show download exUSSR EPG in list setup"),
                config.plugins.epgrefresh_extra.add_ruepg,
                _("If you want to download from the internet russian ERG, put to yes."
                  )),
            getConfigListEntry(
                _("Show \"AutoZap\" in extension menu"),
                config.plugins.epgrefresh_extra.show_autozap,
                _("Automatic switching of all the services in the current channel list after a specified time. Stop switch can only manually."
                  )),
            getConfigListEntry(
                _("Duration to stay on service (sec) for \"AutoZap\" "),
                config.plugins.epgrefresh_extra.timeout_autozap,
                _("This is the duration each service/channel will stay active during a refresh."
                  )),
        ]
        if config.plugins.epgrefresh_extra.add_ruepg:
            self.list.insert(
                3,
                getConfigListEntry(
                    _("Download internet EPG from exUSSR"),
                    config.plugins.epgrefresh_extra.load_ruepg,
                    _("Press OK to download EPG with http://linux-sat.tv.")))

        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changed)

        def selectionChanged():
            if self["config"].current:
                self["config"].current[1].onDeselect(self.session)
            self["config"].current = self["config"].getCurrent()
            if self["config"].current:
                self["config"].current[1].onSelect(self.session)
            for x in self["config"].onSelectionChanged:
                x()

        self["config"].selectionChanged = selectionChanged
        self["config"].onSelectionChanged.append(self.updateHelp)
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["epgcachelocation"] = StaticText()
        self["help"] = StaticText()
        self["actions"] = ActionMap(["SetupActions", "ColorActions"], {
            "cancel": self.keyCancel,
            "save": self.keySave,
            "ok": self.keyOK,
        })
        self.updateDestination()
        self.changed()
        self.onLayoutFinish.append(self.setCustomTitle)
Example #55
0
def InitUsageConfig():
    try:
        file = open('/etc/image-version', 'r')
        lines = file.readlines()
        file.close()
        for x in lines:
            splitted = x.split('=')
            if splitted[0] == "box_type":
                folderprefix = splitted[1].replace(
                    '\n', '')  # 0 = release, 1 = experimental
                boxtype = splitted[1].replace(
                    '\n', '')  # 0 = release, 1 = experimental
    except:
        folderprefix = ""
        boxtype = "not detected"
    config.misc.boxtype = ConfigText(default=boxtype)

    config.usage = ConfigSubsection()
    config.usage.showdish = ConfigYesNo(default=False)
    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="2",
        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(
            ("%d" % 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.servicelist_eventinfo_delay = ConfigSelectionNumber(
        50, 1000, 50, default=150)
    config.usage.service_icon_enable = ConfigYesNo(default=False)
    config.usage.service_icon_enable.addNotifier(refreshServiceList)
    config.usage.servicelist_cursor_behavior = ConfigSelection(
        default="keep",
        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(
            ("%d" % i, ngettext("%d second", "%d seconds", i) % i))
    config.usage.infobar_timeout = ConfigSelection(default="5",
                                                   choices=choicelist)
    config.usage.show_infobar_do_dimming = ConfigYesNo(default=False)
    config.usage.show_infobar_dimming_speed = ConfigSelectionNumber(
        min=1, max=20, stepwidth=1, default=3, wraparound=True)
    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="10",
        choices=[("", _("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=True)
    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.sort_settings = ConfigYesNo(default=False)
    config.usage.sort_pluginlist = 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"))])
    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(
            ("%d" % 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"))])

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

    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(("%d" % 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(("%d" % 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(("%d" % 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 i in (5, 30, 60, 300, 600, 900, 1200, 1800, 2700, 3600):
        if i < 60:
            m = ngettext("%d second", "%d seconds", i) % i
        else:
            m = abs(i / 60)
            m = ngettext("%d minute", "%d minutes", m) % m
        choicelist.append(("%d" % i, m))
    config.usage.screen_saver = ConfigSelection(default="60",
                                                choices=choicelist)

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

    choicelist = [("0", _("Disabled"))]
    for i in (2, 3, 4, 5, 10, 20, 30):
        choicelist.append(
            ("%d" % i, ngettext("%d second", "%d seconds", i) % i))
    for i in (60, 120, 300):
        m = i / 60
        choicelist.append(
            ("%d" % 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)

    nims = [("-1", _("auto"))]
    for x in nimmanager.nim_slots:
        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.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=True)
    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)

    config.network = ConfigSubsection()
    if SystemInfo["WakeOnLAN"]:

        def wakeOnLANChanged(configElement):
            open(SystemInfo["WakeOnLAN"],
                 "w").write(configElement.value and "on" or "off")

        config.network.wol = ConfigYesNo(default=False)
        config.network.wol.addNotifier(wakeOnLANChanged)

    config.epg = ConfigSubsection()
    config.epg.eit = ConfigYesNo(default=True)
    config.epg.mhw = ConfigYesNo(default=False)
    config.epg.freesat = ConfigYesNo(default=False)
    config.epg.viasat = ConfigYesNo(default=False)
    config.epg.netmed = ConfigYesNo(default=False)
    config.epg.virgin = ConfigYesNo(default=False)
    config.epg.saveepg = 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)
        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.timerlist_finished_timer_position = ConfigSelection(
        default="end",
        choices=[("beginning", _("At beginning")), ("end", _("At end"))])

    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.crash = ConfigSubsection()
    config.crash.enabledebug = ConfigYesNo(default=False)
    debugpath = [('/home/root/logs/', '/home/root/')]
    for p in harddiskmanager.getMountedPartitions():
        d = os.path.normpath(p.mountpoint)
        if os.path.exists(p.mountpoint):
            if p.mountpoint != '/':
                debugpath.append((d + '/logs/', p.mountpoint))
    config.crash.debug_path = ConfigSelection(default="/home/root/logs/",
                                              choices=debugpath)

    def updatedebug_path(configElement):
        if not os.path.exists(config.crash.debug_path.getValue()):
            os.mkdir(config.crash.debug_path.getValue(), 0755)

    config.crash.debug_path.addNotifier(updatedebug_path,
                                        immediate_feedback=False)

    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(("%d" % 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(("%d" % 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(("%d" % 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(("%d" % 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")

    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(
                ("%d" % 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_subtitle_removehi = ConfigYesNo(default=False)
    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", _("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.stream_eit = ConfigYesNo(default=True)
    config.streaming.stream_ait = ConfigYesNo(default=True)
    config.streaming.authentication = ConfigYesNo(default=False)
Example #56
0
def menuHook(menuid):
	if menuid != "mainmenu":
		return [ ]
	from Tools.BoundFunction import boundFunction
	return [(("%s (files)") % r.description, boundFunction(menuEntry, r.description, r.mountpoint), "hotplug_%s" % r.mountpoint, None) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
Example #57
0
	def __init__(self, session):
		Screen.__init__(self, session)

		self.firsttime = True

# [iq
		self.mtdSwap = 0

		self.pathForSwap = None
		if not self.mtdSwap:

#			hddList = harddiskmanager.HDDList()
#			for h in hddList:
#				if "/media/hdd" in h[1].findMount():
#					self.hddForSwap = h[1].findMount()
#					break
#
#				devpath = "/sys/block/" + h[1].device[:3]
#				removable = bool(int(readFile(devpath + "/removable")))
#				if not removable:
#					if not self.hddForSwap:
#					self.hddForSwap = h[1].findMount()

			from Components.Harddisk import isFileSystemSupported
			for partition in harddiskmanager.getMountedPartitions():
				if "/media/hdd" in partition.mountpoint:
					self.pathForSwap = partition.mountpoint
					break

				if partition.device and isFileSystemSupported(partition.filesystem()):
					if not self.pathForSwap:
						self.pathForSwap = partition.mountpoint

		self.Console = SwapConsole()
		self.swapOn()
# iq]

		self["red"] = Label(_("Remove Plugins"))
		self["green"] = Label(_("Download Plugins"))
		
		self.list = []
		self["list"] = PluginList(self.list)
		if config.usage.sort_pluginlist.value:
			self["list"].list.sort() # sort

# NOTE : plugins sort
		
		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.save,
			"back": self.close,
		})
		self["PluginDownloadActions"] = ActionMap(["ColorActions"],
		{
			"red": self.delete,
			"green": self.download
		})

		self.onFirstExecBegin.append(self.checkWarnings)
		self.onShown.append(self.updateList)
		self.onChangedEntry = []
		self["list"].onSelectionChanged.append(self.selectionChanged)
		self.onLayoutFinish.append(self.saveListsize)
# [iq
#		self.onLayoutFinish.append(self.swapOn)
		self.onClose.append(self.swapOff)