Example #1
0
class NetworkConfigGlobal(Screen, ConfigListScreen):
	skin = """
	<screen name="NetworkConfigGlobal" position="center,center" size="520,50" title="Network: General configuration">
		<widget name="config" position="10,10" size="500,30" scrollbarMode="showOnDemand"/>
	</screen>"""

	def __init__(self, session):
		Screen.__init__(self, session)
		ConfigListScreen.__init__(self, [], session=session)

		self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"save": self.close,
			"cancel": self.close,
			"ok" : self.close,
		}, -2)

		self._nm = eNetworkManager.getInstance();

		choices_timeupdates = { eNetworkManager.TIME_UPDATES_AUTO : _("auto"), eNetworkManager.TIME_UPDATES_MANUAL : _("manual") }
		self._config_timeupdates = ConfigSelection(choices_timeupdates, default=self._nm.timeUpdates())
		self._config_timeupdates.addNotifier(self._config_changed, initial_call=False)
		self._createSetup()
		self.onLayoutFinish.append(self._layoutFinished)

	def _layoutFinished(self):
		self.setTitle(_("Network: General configuration"))

	def _config_changed(self, element):
		self._nm.setTimeUpdates(self._config_timeupdates.value)
		self._createSetup()

	def _createSetup(self):
		lst = [getConfigListEntry(_("NTP Time Updates"), self._config_timeupdates)]
		self["config"].list = lst
Example #2
0
 def __init__(self, default="#00149baf"):
     ConfigSelection.__init__(
         self,
         default=default,
         choices=[
             ("#00F0A30A", _("Amber")),
             ("#00ffffff", _("White")),
             ("#00825A2C", _("Brown")),
             ("#000050EF", _("Cobalt")),
             ("#00911d10", _("Crimson")),
             ("#001BA1E2", _("Cyan")),
             ("#00a61d4d", _("Magenta")),
             ("#00A4C400", _("Lime")),
             ("#006A00FF", _("Indigo")),
             ("#0070ad11", _("Green")),
             ("#00008A00", _("Emerald")),
             ("#0076608A", _("Mauve")),
             ("#006D8764", _("Olive")),
             ("#00c3461b", _("Orange")),
             ("#00F472D0", _("Pink")),
             ("#00E51400", _("Red")),
             ("#007A3B3F", _("Sienna")),
             ("#00647687", _("Steel")),
             ("#00149baf", _("Teal")),
             ("#006c0aab", _("Violet")),
             ("#00bf9217", _("Yellow")),
         ],
     )
Example #3
0
	def __init__(self, service):
		self._service = service
		self.onChanged = []
		self.onMethodChanged = []
		method_choices_ip4 = {eNetworkService.METHOD_DHCP : "dhcp", eNetworkService.METHOD_MANUAL : _("manual"), eNetworkService.METHOD_OFF : _("off")}
		#IPv4
		self._config_ip4_method = ConfigSelection(method_choices_ip4, default=eNetworkService.METHOD_DHCP)
		self._config_ip4_address = ConfigIP(default=[0,0,0,0])
		self._config_ip4_mask = ConfigIP(default=[0,0,0,0])
		self._config_ip4_gw = ConfigIP(default=[0,0,0,0])
		#IPv6
		method_choices_ip6 = {eNetworkService.METHOD_AUTO : _("auto"), eNetworkService.METHOD_6TO4 : "6to4", eNetworkService.METHOD_MANUAL : _("manual"), eNetworkService.METHOD_OFF : _("off")}
		choices_privacy_ip6 = {eNetworkService.IPV6_PRIVACY_DISABLED : _("Disabled"), eNetworkService.IPV6_PRIVACY_ENABLED : _("Enabled"), eNetworkService.IPV6_PRIVACY_PREFERRED : _("Preferred")}
		self._config_ip6_method = ConfigSelection(method_choices_ip6, default=eNetworkService.METHOD_DHCP)
		self._config_ip6_address = ConfigIP6()
		self._config_ip6_prefix_length = ConfigInteger(0, limits=(1, 128))
		self._config_ip6_gw = ConfigIP6()
		self._config_ip6_privacy = ConfigSelection(choices_privacy_ip6, default="disabled")

		self._isReloading = False
		self._ipv4Changed = False
		self._ipv6Changed = False
		self._addNotifiers()
		self._service_conn = [
			self._service.ipv4Changed.connect(self._serviceChanged),
			self._service.ipv6Changed.connect(self._serviceChanged),
			self._service.ipv4ConfigChanged.connect(self._serviceChanged),
			self._service.ipv6ConfigChanged.connect(self._serviceChanged),
		]
Example #4
0
	def __init__(self, session):
		self.skin = UI3DSetupScreen.skin
		Screen.__init__(self, session)

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

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

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

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

		self.mode = ConfigSelection(choices = modelist, default = mode)
		self.znorm = ConfigSlider(default = znorm + 50, increment = 1, limits = (0, 100))
		self.setmode = ConfigSelection(choices = setmodelist, default = setmode)
		self.list.append(getConfigListEntry(_("Setup mode"), self.setmode))
		self.list.append(getConfigListEntry(_("3d mode"), self.mode))
		self.list.append(getConfigListEntry(_("Depth"), self.znorm))
		self["config"].list = self.list
		self["config"].l.setList(self.list)
Example #5
0
 def handleKey(self, key):
     if key == KEY_OK:
         debug("[SwitchWidget] KEY_OK pressed")
         self.selectNext()
         self.send_command()
     else:
         ConfigSelection.handleKey(self, key)
Example #6
0
	def createSetup(self):
		default = config.usage.timeshift_path.value
		cooldefault = config.usage.autorecord_path.value
		tmp = config.usage.allowed_timeshift_paths.value
		cooltmp = config.usage.allowed_autorecord_paths.value
		if default not in tmp:
			tmp = tmp[:]
			tmp.append(default)
		if cooldefault not in cooltmp:
			cooltmp = cooltmp[:]
			cooltmp.append(cooldefault)
# 		print "TimeshiftPath: ", default, tmp
		self.timeshift_dirname = ConfigSelection(default = default, choices = tmp)
		self.autorecord_dirname = ConfigSelection(default = cooldefault, choices = cooltmp)
		self.timeshift_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.autorecord_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		list = []
		self.timeshift_entry = getConfigListEntry(_("Timeshift location"), self.timeshift_dirname, _("Set the default location for your timeshift-files. Press 'OK' to add new locations, select left/right to select an existing location."))
		list.append(self.timeshift_entry)
		self.autorecord_entry = getConfigListEntry(_("Autorecord location"), self.autorecord_dirname, _("Set the default location for your autorecord-files. Press 'OK' to add new locations, select left/right to select an existing location."))
		list.append(self.autorecord_entry)

		self.refill(list)
		self["config"].setList(list)
		if config.usage.sort_settings.value:
			self["config"].list.sort()
Example #7
0
	def ReadMenu(self):
		self.whichCam()
		
		for x in self.emuDirlist:
			#// if file contains the string "emu" (then this is a emu config file)
			if x.find("emu") > -1:
				self.emuList.append(emuDir + x)
				em = open(emuDir + x)
				self.emuRgui.append(0)
				#// read the emu config file
				for line in em.readlines():
					line1 = line
					#// emuname
					line = line1
					if line.find("emuname") > -1:
						line = line.split("=")
						self.mlist.append(line[1].strip())
						name = line[1].strip()
				em.close()

		emusel = [_('no cam')]
		for x in self.mlist:
			emusel.append(x)
		self.cam1sel = ConfigSelection(emusel)
		self.cam2sel = ConfigSelection(emusel)
		self.setYellowKey(self.curcam)
Example #8
0
 def handleKey(self, key):
     debug("[ShutterWidget] key pressed: " + str(key))
     if key == KEY_OK:
         self.send_command("STOP")
     elif key == KEY_LEFT:
         self.send_command("UP")
     elif key == KEY_RIGHT:
         self.send_command("DOWN")
     else:
         ConfigSelection.handleKey(self, key)
	def initConfigList(self):
		self.styles = [ ("<default>", _("<Default movie location>")), ("<current>", _("<Current movielist location>")), ("<timer>", _("<Last timer location>")) ]
		styles_keys = [x[0] for x in self.styles]
		tmp = config.movielist.videodirs.value
		default = config.usage.default_path.value
		if default not in tmp:
			tmp = tmp[:]
			tmp.append(default)
		print "DefaultPath: ", default, tmp
		self.default_dirname = ConfigSelection(default = default, choices = tmp)
		tmp = config.movielist.videodirs.value
		default = config.usage.timer_path.value
		if default not in tmp and default not in styles_keys:
			tmp = tmp[:]
			tmp.append(default)
		print "TimerPath: ", default, tmp
		self.timer_dirname = ConfigSelection(default = default, choices = self.styles+tmp)
		tmp = config.movielist.videodirs.value
		default = config.usage.instantrec_path.value
		if default not in tmp and default not in styles_keys:
			tmp = tmp[:]
			tmp.append(default)
		print "InstantrecPath: ", default, tmp
		self.instantrec_dirname = ConfigSelection(default = default, choices = self.styles+tmp)
		default = config.usage.timeshift_path.value
		tmp = config.usage.allowed_timeshift_paths.value
		if default not in tmp:
			tmp = tmp[:]
			tmp.append(default)
		print "TimeshiftPath: ", default, tmp
		self.timeshift_dirname = ConfigSelection(default = default, choices = tmp)
		self.timeshift_dirname.last_value = self.timeshift_dirname.value
		self.default_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.default_dirname.last_value = self.default_dirname.value
		self.timer_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.timer_dirname.last_value = self.timer_dirname.value
		self.instantrec_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.instantrec_dirname.last_value = self.instantrec_dirname.value
		self.timeshift_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.timeshift_dirname.last_value = self.timeshift_dirname.value

		self.list = []
		if config.usage.setup_level.index >= 2:
			self.default_entry = getConfigListEntry(_("Default movie location"), self.default_dirname)
			self.list.append(self.default_entry)
			self.timer_entry = getConfigListEntry(_("Timer record location"), self.timer_dirname)
			self.list.append(self.timer_entry)
			self.instantrec_entry = getConfigListEntry(_("Instant record location"), self.instantrec_dirname)
			self.list.append(self.instantrec_entry)
		else:
			self.default_entry = getConfigListEntry(_("Movie location"), self.default_dirname)
			self.list.append(self.default_entry)
		self.timeshift_entry = getConfigListEntry(_("Timeshift location"), self.timeshift_dirname)
		self.list.append(self.timeshift_entry)
		self["config"].setList(self.list)
Example #10
0
class DiseqcTesterTestTypeSelection(Screen, ConfigListScreen):
	skin = """<screen position="80,95" size="560,412" title="DiSEqC Tester Test Settings">
		<widget name="config" position="10,10" size="540,402" scrollbarMode="showOnDemand" />
	</screen>
	"""
	def __init__(self, session, feid):
		Screen.__init__(self, session)
		self.feid = feid
		
		self.list = []
		ConfigListScreen.__init__(self, self.list)
		
		self["actions"] = ActionMap(["SetupActions"],
		{
			"cancel": self.keyCancel
		}, -2)
		
		self.createSetup()
		
	def createSetup(self):
		self.testtype = ConfigSelection(choices={"quick": _("Quick"), "random": _("Random"), "complete": _("Complete")}, default = "quick")
		self.testtypeEntry = getConfigListEntry(_("Test Type"), self.testtype)
		self.list.append(self.testtypeEntry)
		
		self.loopsfailed = ConfigSelection(choices={"-1": "Every known", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8"}, default = "3")
		self.loopsfailedEntry = getConfigListEntry(_("Stop testing plane after # failed transponders"), self.loopsfailed)
		self.list.append(self.loopsfailedEntry)
		
		self.loopssuccessful = ConfigSelection(choices={"-1": "Every known", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8"}, default = "1")
		self.loopssuccessfulEntry = getConfigListEntry(_("Stop testing plane after # successful transponders"), self.loopssuccessful)
		self.list.append(self.loopssuccessfulEntry)
		
		self.log = ConfigYesNo(False)
		if harddiskmanager.HDDCount() > 0:
			self.logEntry = getConfigListEntry(_("Log results to harddisk"), self.log)
			self.list.append(self.logEntry)
					
		self["config"].list = self.list
		self["config"].l.setList(self.list)
		
	def keyOK(self):
		print self.testtype.getValue()
		testtype = DiseqcTester.TEST_TYPE_QUICK
		if self.testtype.getValue() == "quick":
			testtype = DiseqcTester.TEST_TYPE_QUICK
		elif self.testtype.getValue() == "random":
			testtype = DiseqcTester.TEST_TYPE_RANDOM
		elif self.testtype.getValue() == "complete":
			testtype = DiseqcTester.TEST_TYPE_COMPLETE
		self.session.open(DiseqcTester, feid = self.feid, test_type = testtype, loopsfailed = int(self.loopsfailed.value), loopssuccessful = int(self.loopssuccessful.value), log = self.log.value)
	
	def keyCancel(self):
		self.close()
Example #11
0
    def createSetup(self):
        self.testtype = ConfigSelection(
            choices={"quick": _("Quick"), "random": _("Random"), "complete": _("Complete")}, default="quick"
        )
        self.testtypeEntry = getConfigListEntry(_("Test type"), self.testtype)
        self.list.append(self.testtypeEntry)

        self.loopsfailed = ConfigSelection(
            choices={
                "-1": "Every known",
                "1": "1",
                "2": "2",
                "3": "3",
                "4": "4",
                "5": "5",
                "6": "6",
                "7": "7",
                "8": "8",
            },
            default="3",
        )
        self.loopsfailedEntry = getConfigListEntry(
            _("Stop testing plane after # failed transponders"), self.loopsfailed
        )
        self.list.append(self.loopsfailedEntry)

        self.loopssuccessful = ConfigSelection(
            choices={
                "-1": "Every known",
                "1": "1",
                "2": "2",
                "3": "3",
                "4": "4",
                "5": "5",
                "6": "6",
                "7": "7",
                "8": "8",
            },
            default="1",
        )
        self.loopssuccessfulEntry = getConfigListEntry(
            _("Stop testing plane after # successful transponders"), self.loopssuccessful
        )
        self.list.append(self.loopssuccessfulEntry)

        self.log = ConfigYesNo(False)
        if harddiskmanager.HDDCount() > 0:
            self.logEntry = getConfigListEntry(_("Log results to harddisk"), self.log)
            self.list.append(self.logEntry)

        self["config"].list = self.list
        self["config"].l.setList(self.list)
Example #12
0
	def initConfig(self, pf):
		self.profile = pf
		self.clip = ConfigSubsection()
		self.clip.X = ConfigSlider(default = pf.cliprect.value[0], increment = 5, limits = (0, 719))
		self.clip.Y = ConfigSlider(default = pf.cliprect.value[1], increment = 5, limits = (0, 575))
		self.clip.W = ConfigSlider(default = pf.cliprect.value[2], increment = 5, limits = (0, 720))
		self.clip.H = ConfigSlider(default = pf.cliprect.value[3], increment = 5, limits = (0, 576))
		self.pf_stretch = ConfigSelection([("0",_("no")), ("1", _("yes"))], default = pf.stretch.value)
		self.pf_aspect = ConfigSelection([(0, _("4:3 Letterbox")), (1, _("4:3 PanScan")), (2, _("16:9")), (3, _("16:9 always")), (4, _("16:10 Letterbox")), (5, _("16:10 PanScan")), (6, _("16:9 Letterbox"))], default = pf.aspect.value)
		self.pf_aspect.addNotifier(self.aspectSettingChanged)
		self.pf_stretch.addNotifier(self.stretchSettingChanged)
		for elem in [self.clip.X,self.clip.Y,self.clip.W,self.clip.H]:
			elem.addNotifier(self.videoSettingChanged)
Example #13
0
	def __init__(self, session):
		Screen.__init__(self, session)

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

		nimlist = nimmanager.getNimListOfType("DVB-C")
		nim_list = []
		for x in nimlist:
			nim_list.append((nimmanager.nim_slots[x].slot, nimmanager.nim_slots[x].friendly_full_description))

		self.scan_nims = ConfigSelection(choices = nim_list)

		self.list = []
		self.list.append(getConfigListEntry(_("Tuner"), self.scan_nims))

		self.list.append(getConfigListEntry(_('Frequency'), config.plugins.CableScan.frequency))
		self.list.append(getConfigListEntry(_('Symbol rate'), config.plugins.CableScan.symbolrate))
		self.list.append(getConfigListEntry(_('Modulation'), config.plugins.CableScan.modulation))
		self.list.append(getConfigListEntry(_('Network ID'), config.plugins.CableScan.networkid))
		self.list.append(getConfigListEntry(_("Use official channel numbering"), config.plugins.CableScan.keepnumbering))
		self.list.append(getConfigListEntry(_("HD list"), config.plugins.CableScan.hdlist))

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

		self.finished_cb = None

		self["introduction"] = Label(_("Configure your network settings, and press OK to start the scan"))
Example #14
0
	def __init__(self, session, nimList):
		Screen.__init__(self, session)

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

		providerList = list(x[0] for x in self.providers)

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration or not tuple(x for x in self.providers if x[0] == lastConfiguration[1]):
			lastConfiguration = (nimList[0][0], providerList[0], True, True, False, False)

		self.scan_nims = ConfigSelection(default = lastConfiguration[0], choices = nimList)
		self.scan_provider = ConfigSelection(default = lastConfiguration[1], choices = providerList)
		self.scan_hd = ConfigYesNo(default = lastConfiguration[2])
		self.scan_keepnumbering = ConfigYesNo(default = lastConfiguration[3])
		self.scan_keepsettings = ConfigYesNo(default = lastConfiguration[4])
		self.scan_create_radio_bouquet = ConfigYesNo(default = len(lastConfiguration) > 5 and lastConfiguration[5])
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.config_autoproviders = {}
		auto_providers = config.misc.fastscan.autoproviders.value.split(",")
		for provider in self.providers:
			self.config_autoproviders[provider[0]] = ConfigYesNo(default=provider[0] in auto_providers )
		self.list = []
		ConfigListScreen.__init__(self, self.list)
		self.createSetup()
		self.finished_cb = None
		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))
Example #15
0
	def __init__(self, session):
		Screen.__init__(self, session)

		for btn in ("red","green","yellow","blue"):
			self["key_" + btn] = Button(" ")

		ConfigListScreen.__init__(self, [])
		self.defprofile = ConfigSelection([])
		self.updateConfigList()

		self.pfsList = []
		self["profiles"] = List(self.pfsList)
		self.updateProfileList()

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "ChannelSelectEPGActions"],
			{
				"cancel": self.keyExit,
				"ok": self.keyOk,
				"showEPGList": self.showExamples,
				"red": self.keyRed,
				"green": self.keyGreen,
				"yellow": boundFunction(self.moveEntry, -1),
				"blue": boundFunction(self.moveEntry, +1),
				"up": self.keyUp,
				"down": self.keyDown,
			}, -1)
		
		self.onClose.append(self.__closed)
		self.onLayoutFinish.append(self.__layoutFinished)
		self.onShown.append(self.updateButtonState)
		self.prev_ext_menu = config.plugins.VCS.ext_menu.value
Example #16
0
	def __init__(self, session, args = None):
		Screen.__init__(self, session)

		self.index = args
		self.list = []
		ConfigListScreen.__init__(self, self.list)

		if self.index == self.STATE_UPDATE:
			config.misc.installwizard.hasnetwork.setValue(False)
			config.misc.installwizard.ipkgloaded.setValue(False)
			modes = {0: " "}
			self.enabled = ConfigSelection(choices = modes, default = 0)
			self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()]
			is_found = False
			for x in self.adapters:
				if x[1] == 'eth0':
					if iNetwork.getAdapterAttribute(x[1], 'up'):
						self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip"))
						iNetwork.checkNetworkState(self.checkNetworkCB)
						if_found = True
					else:
						iNetwork.restartNetwork(self.checkNetworkLinkCB)
					break
			if is_found is False:
				self.createMenu()
		elif self.index == self.STATE_CHOISE_CHANNELLIST:
			self.enabled = ConfigYesNo(default = True)
			modes = {"AAF": "AAF default(13e-19e)", "19e": "Astra 1", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird"}
			self.channellist_type = ConfigSelection(choices = modes, default = "AAF")
			self.createMenu()
Example #17
0
	def __init__(self, session):
		Screen.__init__(self, session)

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

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

		self.scan_nims = ConfigSelection(choices = nim_list)
		provider_list = []
		provider_list.append((str(900), 'Canal Digitaal'))
		provider_list.append((str(910), 'TV Vlaanderen'))
		provider_list.append((str(920), 'TéléSAT'))
		provider_list.append((str(930), 'Mobistar NL'))
		provider_list.append((str(940), 'Mobistar FR'))
		provider_list.append((str(950), 'AustriaSat'))
		provider_list.append((str(30),  'Czech Republic'))
		provider_list.append((str(31),  'Slovak Republic'))

		self.scan_provider = ConfigSelection(choices = provider_list)
		self.scan_hd = ConfigYesNo(default = False)
		self.scan_keepnumbering = ConfigYesNo(default = False)
		self.scan_keepsettings = ConfigYesNo(default = False)

		self.list = []
		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.scanProvider = getConfigListEntry(_("Provider"), self.scan_provider)
		self.list.append(self.scanProvider)

		self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
		self.list.append(self.scanHD)

		self.list.append(getConfigListEntry(_("Use fastscan channel numbering"), self.scan_keepnumbering))

		self.list.append(getConfigListEntry(_("Use fastscan channel names"), self.scan_keepsettings))

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

		self.finished_cb = None

		self["introduction"] = Label(_("Select your provider, and press OK to start the scan"))
Example #18
0
    def __init__(self, session):
        self.session = session
        Screen.__init__(self, self.session)
        self.skinName = ['Setup']
        self.setTitle(_('Spark7162 select tuner mode'))
        self['actions'] = ActionMap(['SetupActions', 'ColorActions'], {'cancel': self.cancel,
         'ok': self.ok,
         'green': self.ok,
         'red': self.cancel}, -2)
        t = None
        if os_path.exists(filename):
            settings = open(filename)
            while True:
                s = settings.readline().strip()
                if s == '':
                    break
                if s.startswith(option):
                    try:
                        t = s[len(option)]
                    except IndexError:
                        print '[UnionTunerType] bad format in modprobe config'

                    break

            settings.close()
        if t is None:
            t = 't'
        self.tunerconfig = ConfigSelection(default=t, choices=[('t', _('terrestrial')), ('c', _('cable'))])
        conf = []
        conf.append(getConfigListEntry(_('UnionTunerType'), self.tunerconfig))
        ConfigListScreen.__init__(self, conf, session=self.session)
        self['key_red'] = StaticText(_('Cancel'))
        self['key_green'] = StaticText(_('OK'))
	def createConfig(self):

		def set_avahiselect_seperate(configElement):
			if config.usage.remote_fallback_import_url.value and config.usage.remote_fallback_import_url.value != config.usage.remote_fallback.value:
				peerDefault_sepearate = config.usage.remote_fallback_import_url.value
			else:
				peerDefault_sepearate = "same"
				config.usage.remote_fallback_import_url.value = config.usage.remote_fallback.value
			self.seperateBoxes = [("same", _("Same as stream"))] + self.peerStreamingBoxes
			if configElement.value not in ("url", "ip") and configElement.value in self.seperateBoxes:
				self.seperateBoxes.remove(configElement.value)
			self.avahiselect_seperate = ConfigSelection(default=peerDefault_sepearate, choices=self.seperateBoxes)

		self.peerStreamingBoxes = getPeerStreamingBoxes() + [("ip", _("Enter IP address")), ("url", _("Enter URL"))]
		peerDefault = peerDefault_sepearate = None
		if config.usage.remote_fallback.value:
			peerDefault = peerDefault_sepearate = config.usage.remote_fallback.value
			if config.usage.remote_fallback.value and config.usage.remote_fallback.value not in self.peerStreamingBoxes:
				self.peerStreamingBoxes = [config.usage.remote_fallback.value] + self.peerStreamingBoxes
			if config.usage.remote_fallback_import_url.value and config.usage.remote_fallback_import_url.value not in self.peerStreamingBoxes:
				self.peerStreamingBoxes = [config.usage.remote_fallback_import_url.value] + self.peerStreamingBoxes
		self.avahiselect = ConfigSelection(default=peerDefault, choices=self.peerStreamingBoxes)
		self.avahiselect.addNotifier(set_avahiselect_seperate)
		try:
			ipDefault = [int(x) for x in config.usage.remote_fallback.value.split(":")[1][2:].split(".")]
			portDefault = int( config.usage.remote_fallback.value.split(":")[2])
		except:
			ipDefault = [0, 0, 0, 0]
			portDefault = 8001
		self.ip = ConfigIP(default=ipDefault, auto_jump=True)
		self.port = ConfigInteger(default=portDefault, limits=(1,65535))
		self.ip_seperate = ConfigIP( default=ipDefault, auto_jump=True)
		self.port_seperate = ConfigInteger(default=portDefault, limits=(1,65535))
Example #20
0
	def setToggleSubsFilterKey(self, arg=None):
		if self.settings.menupage.getValue() == PAGE_SUBTITLES:
			cur = self["streams"].getCurrent()
			sel_sub = cur and isinstance(cur[0], SelectionTrackinfoEntry) and cur[0].info
			conflist = self["config"].list
			if sel_sub and (sel_sub.getType() == iSt.DVD or sel_sub.getType() == iSt.GST and sel_sub.getGstSubtype() in [iGSt.stPGS, iGSt.stVOB]):
				forcefilter = str(sel_sub.getFilter())
				choicelist = [(str(iSubtitleFilterType_ENUMS.SUB_FILTER_SHOW_FORCED_ONLY), "forced only"), (str(iSubtitleFilterType_ENUMS.SUB_FILTER_SHOW_ALL), "show all")]
				togglesubsfilter = ConfigSelection(choices = choicelist, default = forcefilter)
				togglesubsfilter.addNotifier(boundFunction(self.toggleSubsFilter, cur[0]), initial_call = False)
				self["key_green"].setBoolean(True)
				conflist[1] = getConfigListEntry(_("Toggle Subtitle Filter"), togglesubsfilter)
			else:
				self["key_green"].setBoolean(False)
				togglesubsfilter = None
				conflist[1] = (('',))
			self["config"].l.setList(conflist)
Example #21
0
	def createSetup(self):
		self.styles = [ ("<default>", _("<Default movie location>")), ("<current>", _("<Current movielist location>")), ("<timer>", _("<Last timer location>")) ]
		styles_keys = [x[0] for x in self.styles]
		tmp = config.movielist.videodirs.value
		default = config.usage.default_path.value
		if default not in tmp:
			tmp = tmp[:]
			tmp.append(default)
# 		print "DefaultPath: ", default, tmp
		self.default_dirname = ConfigSelection(default = default, choices = tmp)
		tmp = config.movielist.videodirs.value
		default = config.usage.timer_path.value
		if default not in tmp and default not in styles_keys:
			tmp = tmp[:]
			tmp.append(default)
# 		print "TimerPath: ", default, tmp
		self.timer_dirname = ConfigSelection(default = default, choices = self.styles+tmp)
		tmp = config.movielist.videodirs.value
		default = config.usage.instantrec_path.value
		if default not in tmp and default not in styles_keys:
			tmp = tmp[:]
			tmp.append(default)
# 		print "InstantrecPath: ", default, tmp
		self.instantrec_dirname = ConfigSelection(default = default, choices = self.styles+tmp)
		self.default_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.timer_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.instantrec_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)

		list = []

		if config.usage.setup_level.index >= 2:
			self.default_entry = getConfigListEntry(_("Default movie location"), self.default_dirname, _("Set the default location for your recordings. Press 'OK' to add new locations, select left/right to select an existing location."))
			list.append(self.default_entry)
			self.timer_entry = getConfigListEntry(_("Timer recording location"), self.timer_dirname, _("Set the default location for your timers. Press 'OK' to add new locations, select left/right to select an existing location."))
			list.append(self.timer_entry)
			self.instantrec_entry = getConfigListEntry(_("Instant recording location"), self.instantrec_dirname, _("Set the default location for your instant recordings. Press 'OK' to add new locations, select left/right to select an existing location."))
			list.append(self.instantrec_entry)
		else:
			self.default_entry = getConfigListEntry(_("Movie location"), self.default_dirname, _("Set the default location for your recordings. Press 'OK' to add new locations, select left/right to select an existing location."))
			list.append(self.default_entry)
			self.timer_entry = self.instantrec_entry = None

		self.refill(list)
		self["config"].setList(list)
		if config.usage.sort_settings.value:
			self["config"].list.sort()
Example #22
0
	def __init__(self, default = "#00000000"):
		ConfigSelection.__init__(self, default=default, choices = BASIC_COLORS+[
				("CUSTOM", _("CUSTOM")),													
				("#00000000", _("Black")),
				("#00111111", _("PreBlack")),
				("#00444444", _("Darkgrey")),
				("#00bbbbbb", _("Lightgrey")),
				("#00999999", _("Grey")),
				("#006f0000", _("Darkred")),
				("#00295c00", _("Darkgreen")),
				("#006b3500", _("Darkbrown")),
				("#00446b00", _("Darklime")),
				("#00006b5b", _("Darkteal")),
				("#00004c6b", _("Darkcyan")),
				("#0000236b", _("Darkcobalt")),
				("#0030006b", _("Darkpurple")),
				("#006b003f", _("Darkmagenta")),
				("#0065006b", _("Darkpink"))])
Example #23
0
 def __init__(self, default="#00000000"):
     ConfigSelection.__init__(
         self,
         default=default,
         choices=[
             ("CUSTOM", _("CUSTOM")),
             ("#00000000", _("Black")),
             ("#00111111", _("PreBlack")),
             ("#00ffffff", _("White")),
             ("#00444444", _("Darkgrey")),
             ("#00bbbbbb", _("Lightgrey")),
             ("#00999999", _("Grey")),
             ("#006f0000", _("Darkred")),
             ("#00295c00", _("Darkgreen")),
             ("#006b3500", _("Darkbrown")),
             ("#00446b00", _("Darklime")),
             ("#00006b5b", _("Darkteal")),
             ("#00004c6b", _("Darkcyan")),
             ("#0000236b", _("Darkcobalt")),
             ("#0030006b", _("Darkpurple")),
             ("#006b003f", _("Darkmagenta")),
             ("#0065006b", _("Darkpink")),
             ("#00F0A30A", _("Amber")),
             ("#00825A2C", _("Brown")),
             ("#000050EF", _("Cobalt")),
             ("#00911d10", _("Crimson")),
             ("#001BA1E2", _("Cyan")),
             ("#00a61d4d", _("Magenta")),
             ("#00A4C400", _("Lime")),
             ("#006A00FF", _("Indigo")),
             ("#0070ad11", _("Green")),
             ("#00008A00", _("Emerald")),
             ("#0076608A", _("Mauve")),
             ("#006D8764", _("Olive")),
             ("#00c3461b", _("Orange")),
             ("#00F472D0", _("Pink")),
             ("#00E51400", _("Red")),
             ("#007A3B3F", _("Sienna")),
             ("#00647687", _("Steel")),
             ("#00149baf", _("Teal")),
             ("#006c0aab", _("Violet")),
             ("#00bf9217", _("Yellow")),
         ],
     )
Example #24
0
	def createConfig(self, foo):
		self.tuning_type = ConfigSelection(default = "predefined_transponder", choices = [("single_transponder", _("User defined transponder")), ("predefined_transponder", _("Predefined transponder"))])
		self.orbital_position = 192
		if self.frontendData and self.frontendData.has_key('orbital_position'):
			self.orbital_position = self.frontendData['orbital_position']
		ScanSetup.createConfig(self, self.frontendData)

		for x in (self.scan_sat.frequency,
			self.scan_sat.inversion, self.scan_sat.symbolrate,
			self.scan_sat.polarization, self.scan_sat.fec, self.scan_sat.pilot,
			self.scan_sat.fec_s2, self.scan_sat.fec, self.scan_sat.modulation,
			self.scan_sat.rolloff, self.scan_sat.system,
			self.scan_ter.channel, self.scan_ter.frequency, self.scan_ter.inversion,
			self.scan_ter.bandwidth, self.scan_ter.fechigh, self.scan_ter.feclow,
			self.scan_ter.modulation, self.scan_ter.transmission,
			self.scan_ter.guard, self.scan_ter.hierarchy, self.scan_ter.plp_id,
			self.scan_cab.frequency, self.scan_cab.inversion, self.scan_cab.symbolrate,
			self.scan_cab.modulation, self.scan_cab.fec):
			x.addNotifier(self.retune, initial_call = False)

		satfinder_nim_list = []
		for n in nimmanager.nim_slots:
			if not (n.isCompatible("DVB-S") or n.isCompatible("DVB-T") or n.isCompatible("DVB-C")):
				continue
			if n.config_mode  in ("loopthrough", "satposdepends", "nothing"):
				continue
			if n.isCompatible("DVB-S") and len(nimmanager.getSatListForNim(n.slot)) < 1:
				continue
			if n.isCompatible("DVB-S") and n.isFBCTuner() and not n.isFBCRoot():
				continue
			satfinder_nim_list.append((str(n.slot), n.friendly_full_description))
		self.satfinder_scan_nims = ConfigSelection(choices = satfinder_nim_list)
		if self.frontendData is not None and len(satfinder_nim_list) > 0: # open the plugin with the currently active NIM as default
			active_nim = self.frontendData.get("tuner_number", int(satfinder_nim_list[0][0]))
			if not nimmanager.nim_slots[active_nim].isFBCLink():
				self.satfinder_scan_nims.setValue(str(active_nim))

		self.feid = int(self.satfinder_scan_nims.value)

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

		if self.frontendData:
			ttype = self.frontendData.get("tuner_type", "UNKNOWN")
			if ttype == "DVB-S" and self.predefinedTranspondersList(self.getSelectedSatIndex(self.feid)) is None and len(nimmanager.getTransponders(self.getSelectedSatIndex(self.feid))) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-T" and self.predefinedTerrTranspondersList() is None and len(nimmanager.getTranspondersTerrestrial(nimmanager.getTerrestrialDescription(self.feid))) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-C" and self.predefinedCabTranspondersList() is None and len(nimmanager.getTranspondersCable(self.feid)) > 0:
				self.tuning_type.value = "single_transponder"
Example #25
0
class UnionTunerType(Screen, ConfigListScreen):

	def __init__(self, session):
		self.session = session
		Screen.__init__(self, self.session)
		self.skinName = ["Setup"]
		self.setTitle(_("Amiko alien2 select tuner mode"))
		self["actions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"cancel": self.cancel,
				"ok": self.ok,
				"green": self.ok,
				"red": self.cancel,
			}, -2)

		t = None
		if os_path.exists(filename):
			settings = open(filename)
			while True:
				s = settings.readline().strip()
				if s == '':
					break
				if s.startswith(option):
					try:
						t = s[len(option)]
					except IndexError:
						print '[UnionTunerType] bad format in modprobe config'
					break
			settings.close()
		if t is None:
			t = 't'

		self.tunerconfig = ConfigSelection(default = t, choices = [ ('t', _("terrestrial")) , ('c', _("cable")) ])
		conf = []
		conf.append(getConfigListEntry(_("UnionTunerType"), self.tunerconfig))
		ConfigListScreen.__init__(self, conf, session = self.session)
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))

	def settingsWrite(self, result):
		if result is not None and result:
			settings = open(filename, 'w')
			settings.write(option + self.tunerconfig.value + '\n')
			settings.close()
			self.session.open(TryQuitMainloop,retvalue=2)
		self.close()

	def ok(self):
		if self.tunerconfig.isChanged():
			self.session.openWithCallback(self.settingsWrite, MessageBox,
			  (_("Are you sure to save the current configuration and reboot your receiver?\n\n") ))
		else:
			self.close()

	def cancel(self):
		self.close()
Example #26
0
 def __init__(self, item, sub_page, mapping=None):
     SitemapWidget.__init__(self, item, sub_page)
     
     if mapping:
         if not isinstance(mapping, list):
             mapping = [mapping]
         choices = map(lambda mi: (mi["command"], mi["label"]), mapping)
         if len(mapping) == 1:
             # button mode
             if mapping[0]["command"] == item["state"]:
                 # disabled: empty text
                 choices = [(item["state"], "")] 
             else:
                 # add ability to send mapped command
                 choices.append((item["state"], mapping[0]["label"]))
     else:
         choices = [("ON", _("on")), ("OFF", _("off"))]
         
     ConfigSelection.__init__(self, choices=choices, default=item["state"])
Example #27
0
	def createConfig(self):
		self.positioner_tune = ConfigNothing()
		self.positioner_move = ConfigNothing()
		self.positioner_finemove = ConfigNothing()
		self.positioner_limits = ConfigNothing()
		self.positioner_goto0 = ConfigNothing()
		storepos = []
		for x in range(1,255):
			storepos.append(str(x))
		self.positioner_storage = ConfigSelection(choices = storepos)
Example #28
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.session = session
		self.skinName = ["SetupInfo", "Setup" ]
		Screen.setTitle(self, _("Keymap Selection") + "...")
		self.setup_title =  _("Keymap Selection") + "..."
		self["HelpWindow"] = Pixmap()
		self["HelpWindow"].hide()
		self["status"] = StaticText()
		self['footnote'] = Label("")
		self["description"] = Label("")
		self["labelInfo"] = Label(_("Copy your keymap to\n/usr/share/enigma2/keymap.usr"))

		mqbkey = eEnv.resolve("${datadir}/enigma2/keymap.mqb")
                usrkey = eEnv.resolve("${datadir}/enigma2/keymap.usr")
		ntrkey = eEnv.resolve("${datadir}/enigma2/keymap.ntr")
		u80key = eEnv.resolve("${datadir}/enigma2/keymap.u80")
		self.actkeymap = self.getKeymap(config.usage.keymap.getValue())
		keySel = [ ('keymap.xml',_("Default  (keymap.xml)"))]
		if os.path.isfile(mqbkey):
			keySel.append(('keymap.mqb',_("ET-MultiQuickButton  (keymap.mqb)")))
                if os.path.isfile(usrkey):
			keySel.append(('keymap.usr',_("User  (keymap.usr)")))
		if os.path.isfile(ntrkey):
			keySel.append(('keymap.ntr',_("Neutrino  (keymap.ntr)")))
		if os.path.isfile(u80key):
			keySel.append(('keymap.u80',_("UP80  (keymap.u80)")))
		if self.actkeymap == usrkey and not os.path.isfile(usrkey):
			setDefaultKeymap()
		if self.actkeymap == ntrkey and not os.path.isfile(ntrkey):
			setDefaultKeymap()
		if self.actkeymap == u80key and not os.path.isfile(u80key):
			setDefaultKeymap()
		self.keyshow = ConfigSelection(keySel)
		self.keyshow.setValue(self.actkeymap)

		self.onChangedEntry = [ ]
		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry)
		self.createSetup()

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

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		if not self.selectionChanged in self["config"].onSelectionChanged:
			self["config"].onSelectionChanged.append(self.selectionChanged)
		self.selectionChanged()
Example #29
0
class UnionTunerType(Screen, ConfigListScreen):

    def __init__(self, session):
        self.session = session
        Screen.__init__(self, self.session)
        self.skinName = ['Setup']
        self.setTitle(_('Spark7162 select tuner mode'))
        self['actions'] = ActionMap(['SetupActions', 'ColorActions'], {'cancel': self.cancel,
         'ok': self.ok,
         'green': self.ok,
         'red': self.cancel}, -2)
        t = None
        if os_path.exists(filename):
            settings = open(filename)
            while True:
                s = settings.readline().strip()
                if s == '':
                    break
                if s.startswith(option):
                    try:
                        t = s[len(option)]
                    except IndexError:
                        print '[UnionTunerType] bad format in modprobe config'

                    break

            settings.close()
        if t is None:
            t = 't'
        self.tunerconfig = ConfigSelection(default=t, choices=[('t', _('terrestrial')), ('c', _('cable'))])
        conf = []
        conf.append(getConfigListEntry(_('UnionTunerType'), self.tunerconfig))
        ConfigListScreen.__init__(self, conf, session=self.session)
        self['key_red'] = StaticText(_('Cancel'))
        self['key_green'] = StaticText(_('OK'))

    def settingsWrite(self, result):
        if result is not None and result:
		for line in fileinput.input(filename, inplace = 1):
			if line.startswith(option):
				print option + self.tunerconfig.value
			else:
				print line,
		fileinput.close()
		self.session.open(TryQuitMainloop, retvalue=2)
        self.close()

    def ok(self):
        if self.tunerconfig.isChanged():
            self.session.openWithCallback(self.settingsWrite, MessageBox, _('Are you sure to save the current configuration and reboot your receiver?\n\n'))
        else:
            self.close()

    def cancel(self):
        self.close()
Example #30
0
	def updateTranspondersList(self, orbpos):
		if orbpos is not None:
			index = 0
			list = []
			tps = nimmanager.getTransponders(orbpos)
			for x in tps:
				if x[0] == 0:	#SAT
					s = str(x[1]/1000) + " " + self.PolToStr(x[3]) + " / " + str(x[2]/1000) + " / " + self.FecToStr(x[4])
					list.append((str(index), s))
					index += 1
			self.scan_transponders = ConfigSelection(choices = list, default = "0")
			self.scan_transponders.addNotifier(self.retune, initial_call = False)
Example #31
0
PACKAGE_PATH = os.path.dirname(str((globals())["__file__"]))
KEYMAPPINGS = {
    "green": os.path.join(PACKAGE_PATH, "keymap-green.xml"),
    "help": os.path.join(PACKAGE_PATH, "keymap-help.xml"),
    "text": os.path.join(PACKAGE_PATH, "keymap-text.xml"),
    "red": os.path.join(PACKAGE_PATH, "keymap-red.xml"),
    "yellow": os.path.join(PACKAGE_PATH, "keymap-yellow.xml")
}

config.plugins.SoftcamMenu = ConfigSubsection()
config.plugins.SoftcamMenu.MenuExt = ConfigYesNo(default=True)
config.plugins.SoftcamMenu.quickButton = ConfigEnableDisable(default=False)
config.plugins.SoftcamMenu.keymapBut = ConfigSelection(
    [("green", _("Green key")),
     ("help", _("Help key")), ("text", _("TEXT key")), ("red", _("RED key")),
     ("yellow", _("YELLOW key"))],
    default="help")
config.plugins.SoftcamMenu.RestartChoice = ConfigSelection(
    [("1", _("restart softcam")), ("2", _("restart cardserver")),
     ("3", _("restart both"))],
    default="1")
config.plugins.SoftcamMenu.showEcm = ConfigYesNo(default=False)
config.plugins.SoftcamMenu.CloseOnRestart = ConfigYesNo(default=True)

quick_softcam_setup = None


class ConfigAction(ConfigElement):
    def __init__(self, action, *args):
        ConfigElement.__init__(self)
Example #32
0
class FastScanScreen(ConfigListScreen, Screen):
    skin = """
	<screen position="100,115" size="520,290" title="Fast Scan">
		<widget name="config" position="10,10" size="500,250" scrollbarMode="showOnDemand" />
		<widget name="introduction" position="10,265" size="500,25" font="Regular;20" halign="center" />
	</screen>"""

    providers = [('Canal Digitaal', (1, 900, True)),
                 ('TV Vlaanderen', (1, 910, True)),
                 ('TéléSAT', (0, 920, True)), ('HD Austria', (0, 950, False)),
                 ('Fast Scan Deutschland', (0, 960, False)),
                 ('Skylink Czech Republic', (1, 30, False)),
                 ('Skylink Slovak Republic', (1, 31, False)),
                 ('TéléSAT Astra3', (1, 920, True)),
                 ('HD Austria Astra3', (1, 950, False)),
                 ('Fast Scan Deutschland Astra3', (1, 960, False)),
                 ('Canal Digitaal Astra 1', (0, 900, True)),
                 ('TV Vlaanderen  Astra 1', (0, 910, True))]

    transponders = ((12515000, 22000000,
                     eDVBFrontendParametersSatellite.FEC_5_6, 192,
                     eDVBFrontendParametersSatellite.Polarisation_Horizontal,
                     eDVBFrontendParametersSatellite.Inversion_Unknown,
                     eDVBFrontendParametersSatellite.System_DVB_S,
                     eDVBFrontendParametersSatellite.Modulation_QPSK,
                     eDVBFrontendParametersSatellite.RollOff_alpha_0_35,
                     eDVBFrontendParametersSatellite.Pilot_Off),
                    (12070000, 27500000,
                     eDVBFrontendParametersSatellite.FEC_3_4, 235,
                     eDVBFrontendParametersSatellite.Polarisation_Horizontal,
                     eDVBFrontendParametersSatellite.Inversion_Unknown,
                     eDVBFrontendParametersSatellite.System_DVB_S,
                     eDVBFrontendParametersSatellite.Modulation_QPSK,
                     eDVBFrontendParametersSatellite.RollOff_alpha_0_35,
                     eDVBFrontendParametersSatellite.Pilot_Off))

    def __init__(self, session, nimList):
        Screen.__init__(self, session)

        self.setTitle(_("Fast Scan"))

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

        providerList = list(x[0] for x in self.providers)

        lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
        if not lastConfiguration or not tuple(
                x for x in self.providers if x[0] == lastConfiguration[1]):
            lastConfiguration = (nimList[0][0], providerList[0], True, True,
                                 False, False)

        self.scan_nims = ConfigSelection(default=lastConfiguration[0],
                                         choices=nimList)
        self.scan_provider = ConfigSelection(default=lastConfiguration[1],
                                             choices=providerList)
        self.scan_hd = ConfigYesNo(default=lastConfiguration[2])
        self.scan_keepnumbering = ConfigYesNo(default=lastConfiguration[3])
        self.scan_keepsettings = ConfigYesNo(default=lastConfiguration[4])
        self.scan_create_radio_bouquet = ConfigYesNo(
            default=len(lastConfiguration) > 5 and lastConfiguration[5])
        self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
        self.scanProvider = getConfigListEntry(_("Provider"),
                                               self.scan_provider)
        self.scanHD = getConfigListEntry(_("HD list"), self.scan_hd)
        self.config_autoproviders = {}
        auto_providers = config.misc.fastscan.autoproviders.value.split(",")
        for provider in self.providers:
            self.config_autoproviders[provider[0]] = ConfigYesNo(
                default=provider[0] in auto_providers)
        self.list = []
        ConfigListScreen.__init__(self, self.list)
        self.createSetup()
        self.finished_cb = None
        self["introduction"] = Label(
            _("Select your provider, and press OK to start the scan"))

    def createSetup(self):
        self.list = []
        self.list.append(self.tunerEntry)
        self.list.append(self.scanProvider)
        self.list.append(self.scanHD)
        self.list.append(
            getConfigListEntry(_("Use fastscan channel numbering"),
                               self.scan_keepnumbering))
        self.list.append(
            getConfigListEntry(_("Use fastscan channel names"),
                               self.scan_keepsettings))
        self.list.append(
            getConfigListEntry(_("Create seperate radio userbouquet"),
                               self.scan_create_radio_bouquet))
        self.list.append(
            getConfigListEntry(_("Enable auto fast scan"),
                               config.misc.fastscan.auto))
        if config.misc.fastscan.auto.value == "multi":
            for provider in self.providers:
                self.list.append(
                    getConfigListEntry(
                        _("Enable auto fast scan for %s") % provider[0],
                        self.config_autoproviders[provider[0]]))
        self["config"].list = self.list
        self["config"].l.setList(self.list)

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

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

    def saveConfiguration(self):
        config.misc.fastscan.last_configuration.value = ` (
            self.scan_nims.value, self.scan_provider.value, self.scan_hd.value,
            self.scan_keepnumbering.value, self.scan_keepsettings.value,
            self.scan_create_radio_bouquet.value) `
        auto_providers = []
        for provider in self.providers:
            if self.config_autoproviders[provider[0]].value:
                auto_providers.append(provider[0])
        config.misc.fastscan.autoproviders.value = ",".join(auto_providers)
        config.misc.fastscan.save()

    def keySave(self):
        self.saveConfiguration()
        self.close()

    def keyGo(self):
        self.saveConfiguration()
        self.startScan()

    def getTransponderParameters(self, number):
        transponderParameters = eDVBFrontendParametersSatellite()
        transponderParameters.frequency = self.transponders[number][0]
        transponderParameters.symbol_rate = self.transponders[number][1]
        transponderParameters.fec = self.transponders[number][2]
        transponderParameters.orbital_position = self.transponders[number][3]
        transponderParameters.polarisation = self.transponders[number][4]
        transponderParameters.inversion = self.transponders[number][5]
        transponderParameters.system = self.transponders[number][6]
        transponderParameters.modulation = self.transponders[number][7]
        transponderParameters.rolloff = self.transponders[number][8]
        transponderParameters.pilot = self.transponders[number][9]
        transponderParameters.is_id = 0  #-1
        transponderParameters.pls_mode = eDVBFrontendParametersSatellite.PLS_Root
        transponderParameters.pls_code = 1
        return transponderParameters

    def startScan(self):
        parameters = tuple(x[1] for x in self.providers
                           if x[0] == self.scan_provider.value)[0]
        pid = parameters[1]
        if self.scan_hd.value and parameters[2]:
            pid += 1
        if self.scan_nims.value:
            self.session.open(
                FastScanStatus,
                scanTuner=int(self.scan_nims.value),
                transponderParameters=self.getTransponderParameters(
                    parameters[0]),
                scanPid=pid,
                keepNumbers=self.scan_keepnumbering.value,
                keepSettings=self.scan_keepsettings.value,
                createRadioBouquet=self.scan_create_radio_bouquet.value,
                providerName=self.scan_provider.getText())

    def keyCancel(self):
        self.close()
Example #33
0
from Components.ConfigList import ConfigListScreen
from Components.NimManager import nimmanager
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.ProgressBar import ProgressBar
from Components.ServiceList import refreshServiceList
from Components.ActionMap import ActionMap

from enigma import eFastScan, eDVBFrontendParametersSatellite, eTimer

import os

config.misc.fastscan = ConfigSubsection()
config.misc.fastscan.last_configuration = ConfigText(default="()")
config.misc.fastscan.auto = ConfigSelection(default="true",
                                            choices=[("true", _("yes")),
                                                     ("false", _("no")),
                                                     ("multi", _("multi"))])
config.misc.fastscan.autoproviders = ConfigText(default="()")


class FastScanStatus(Screen):
    skin = """
	<screen position="150,115" size="420,180" title="Fast Scan">
		<widget name="frontend" pixmap="icons/scan-s.png" position="5,5" size="64,64" transparent="1" alphatest="on" />
		<widget name="scan_state" position="10,120" zPosition="2" size="400,30" font="Regular;18" />
		<widget name="scan_progress" position="10,155" size="400,15" pixmap="progress_big.png" borderWidth="2" borderColor="#cccccc" />
	</screen>"""

    def __init__(self,
                 session,
                 scanTuner=0,
Example #34
0
from urlparse import urljoin
from Components.config import config, ConfigSelection, ConfigText, getConfigListEntry
###################################################

###################################################
# E2 GUI COMMPONENTS
###################################################
from Screens.MessageBox import MessageBox
###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.movieshdco_sortby = ConfigSelection(
    default="date",
    choices=[("date", _("Lastest")), ("views", _("Most viewed")),
             ("duree", _("Longest")), ("rate", _("Top rated")),
             ("random", _("Random"))])
config.plugins.iptvplayer.cartoonhd_login = ConfigText(default="",
                                                       fixed_size=False)
config.plugins.iptvplayer.cartoonhd_password = ConfigText(default="",
                                                          fixed_size=False)


def GetConfigList():
    optionList = []
    optionList.append(
        getConfigListEntry(
            _("login") + ":", config.plugins.iptvplayer.cartoonhd_login))
    optionList.append(
        getConfigListEntry(
Example #35
0
def InitTimeZones():
    config.timezone = ConfigSubsection()
    config.timezone.area = ConfigSelection(
        default=DEFAULT_AREA, choices=timezones.getTimezoneAreaList())
    config.timezone.val = ConfigSelection(default=DEFAULT_ZONE,
                                          choices=timezones.getTimezoneList())
    if config.misc.firstrun.value:
        proxy = geolocation.get("proxy", False)
        tz = geolocation.get("timezone", None)
        if proxy is True or tz is None:
            msg = " - proxy in use" if proxy else ""
            print(
                "[Timezones] Warning: Geolocation not available%s!  (area='%s', zone='%s')"
                % (msg, config.timezone.area.value, config.timezone.val.value))
        else:
            area, zone = tz.split("/", 1)
            if area != DEFAULT_AREA:
                config.timezone.area.value = area
                choices = timezones.getTimezoneList(area=area)
                config.timezone.val.setChoices(
                    choices,
                    default=timezones.getTimezoneDefault(area, choices))
            config.timezone.val.value = zone
            config.timezone.save()
            print(
                "[Timezones] Initial time zone set by geolocation tz='%s'.  (area='%s', zone='%s')"
                % (tz, area, zone))
    else:
        if not config.timezone.area.value and config.timezone.val.value.find(
                "/") == -1:
            config.timezone.area.value = "Generic"
        try:
            tzLink = path.realpath("/etc/localtime")[20:]
            msgs = []
            if config.timezone.area.value == "Classic":
                if config.timezone.val.value != tzLink:
                    msgs.append("time zone '%s' != '%s'" %
                                (config.timezone.val.value, tzLink))
            else:
                tzSplit = tzLink.find("/")
                if tzSplit == -1:
                    tzArea = "Generic"
                    tzVal = tzLink
                else:
                    tzArea = tzLink[:tzSplit]
                    tzVal = tzLink[tzSplit + 1:]
                if config.timezone.area.value != tzArea:
                    msgs.append("area '%s' != '%s'" %
                                (config.timezone.area.value, tzArea))
                if config.timezone.val.value != tzVal:
                    msgs.append("zone '%s' != '%s'" %
                                (config.timezone.val.value, tzVal))
            if len(msgs):
                print(
                    "[Timezones] Warning: Enigma2 time zone does not match system time zone (%s), setting system to Enigma2 time zone!"
                    % ",".join(msgs))
        except (IOError, OSError):
            pass

    def timezoneAreaChoices(configElement):
        choices = timezones.getTimezoneList(area=configElement.value)
        config.timezone.val.setChoices(choices=choices,
                                       default=timezones.getTimezoneDefault(
                                           area=configElement.value,
                                           choices=choices))
        if config.timezone.val.saved_value and config.timezone.val.saved_value in [
                x[0] for x in choices
        ]:
            config.timezone.val.value = config.timezone.val.saved_value

    def timezoneNotifier(configElement):
        timezones.activateTimezone(configElement.value,
                                   config.timezone.area.value)

    config.timezone.area.addNotifier(timezoneAreaChoices,
                                     initial_call=False,
                                     immediate_feedback=True)
    config.timezone.val.addNotifier(timezoneNotifier,
                                    initial_call=True,
                                    immediate_feedback=True)
    config.timezone.val.callNotifiersOnSaveAndCancel = True
Example #36
0
	def createConfig(self, frontendData):
		satlist = nimmanager.getRotorSatListForNim(self.feid)
		orb_pos = self.fe_data.get("orbital_position", None)
		orb_pos_str = str(orb_pos)
		self.tuning = ConfigSubsection()
		self.tuning.type = ConfigSelection(
				default = "manual_transponder",
				choices = { "manual_transponder" : _("Manual transponder"),
							"predefined_transponder" : _("Predefined transponder") } )
		self.tuning.sat = ConfigSatlist(list = satlist)
		if orb_pos is not None:
			for sat in satlist:
				if sat[0] == orb_pos and self.tuning.sat.value != orb_pos_str:
					self.tuning.sat.value = orb_pos_str
		self.updateTransponders()

		defaultSat = {
			"orbpos": 192,
			"system": eDVBFrontendParametersSatellite.System_DVB_S,
			"frequency": 11836,
			"inversion": eDVBFrontendParametersSatellite.Inversion_Unknown,
			"symbolrate": 27500,
			"polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal,
			"fec": eDVBFrontendParametersSatellite.FEC_Auto,
			"fec_s2": eDVBFrontendParametersSatellite.FEC_9_10,
			"modulation": eDVBFrontendParametersSatellite.Modulation_QPSK }
		if frontendData is not None:
			ttype = frontendData.get("tuner_type", "UNKNOWN")
			defaultSat["system"] = frontendData.get("system", eDVBFrontendParametersSatellite.System_DVB_S)
			defaultSat["frequency"] = frontendData.get("frequency", 0) / 1000
			defaultSat["inversion"] = frontendData.get("inversion", eDVBFrontendParametersSatellite.Inversion_Unknown)
			defaultSat["symbolrate"] = frontendData.get("symbol_rate", 0) / 1000
			defaultSat["polarization"] = frontendData.get("polarization", eDVBFrontendParametersSatellite.Polarisation_Horizontal)
			if defaultSat["system"] == eDVBFrontendParametersSatellite.System_DVB_S2:
				defaultSat["fec_s2"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
				defaultSat["rolloff"] = frontendData.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35)
				defaultSat["pilot"] = frontendData.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown)
			else:
				defaultSat["fec"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto)
			defaultSat["modulation"] = frontendData.get("modulation", eDVBFrontendParametersSatellite.Modulation_QPSK)
			defaultSat["orbpos"] = frontendData.get("orbital_position", 0)

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

		config.av.videorate = ConfigSelection(choices = self.rates)
Example #38
0
    def createSetup(self):
        self.styles = [("<default>", _("<Default movie location>")),
                       ("<current>", _("<Current movielist location>")),
                       ("<timer>", _("<Last timer location>"))]
        styles_keys = [x[0] for x in self.styles]
        tmp = config.movielist.videodirs.value
        default = config.usage.default_path.value
        if default not in tmp:
            tmp = tmp[:]
            tmp.append(default)
# 		print "DefaultPath: ", default, tmp
        self.default_dirname = ConfigSelection(default=default, choices=tmp)
        tmp = config.movielist.videodirs.value
        default = config.usage.timer_path.value
        if default not in tmp and default not in styles_keys:
            tmp = tmp[:]
            tmp.append(default)
# 		print "TimerPath: ", default, tmp
        self.timer_dirname = ConfigSelection(default=default,
                                             choices=self.styles + tmp)
        tmp = config.movielist.videodirs.value
        default = config.usage.instantrec_path.value
        if default not in tmp and default not in styles_keys:
            tmp = tmp[:]
            tmp.append(default)
# 		print "InstantrecPath: ", default, tmp
        self.instantrec_dirname = ConfigSelection(default=default,
                                                  choices=self.styles + tmp)
        self.default_dirname.addNotifier(self.checkReadWriteDir,
                                         initial_call=False,
                                         immediate_feedback=False)
        self.timer_dirname.addNotifier(self.checkReadWriteDir,
                                       initial_call=False,
                                       immediate_feedback=False)
        self.instantrec_dirname.addNotifier(self.checkReadWriteDir,
                                            initial_call=False,
                                            immediate_feedback=False)

        list = []

        if config.usage.setup_level.index >= 2:
            self.default_entry = getConfigListEntry(
                _("Default movie location"), self.default_dirname,
                _("Set the default location for your recordings. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.default_entry)
            self.timer_entry = getConfigListEntry(
                _("Timer recording location"), self.timer_dirname,
                _("Set the default location for your timers. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.timer_entry)
            self.instantrec_entry = getConfigListEntry(
                _("Instant recording location"), self.instantrec_dirname,
                _("Set the default location for your instant recordings. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.instantrec_entry)
        else:
            self.default_entry = getConfigListEntry(
                _("Movie location"), self.default_dirname,
                _("Set the default location for your recordings. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.default_entry)

        self.refill(list)
        self["config"].setList(list)
        if config.usage.sort_settings.value:
            self["config"].list.sort()
Example #39
0
                                            p), lambda: True), None))
        return list

    def showMovies(self):
        pass


###################################################

config.plugins.Podcast = ConfigSubsection()
config.plugins.Podcast.buffer = ConfigYesNo(default=True)
config.plugins.Podcast.bufferDevice = ConfigText(default="/media/hdd/",
                                                 fixed_size=False)
config.plugins.Podcast.keepStored = ConfigSelection(choices={
    "delete": _("delete"),
    "keep": _("keep on device"),
    "ask": _("ask me")
},
                                                    default="delete")

###################################################


def encodeUrl(url):
    url = url.replace("&amp;", "&")
    url = url.replace("&lt;", "<")
    url = url.replace("&gt;", ">")
    url = url.replace("&#39;", "'")
    url = url.replace("&quot;", '"')
    url = url.replace("&#42;", "*")
    url = url.replace("&#124;", "|")
    url = url.replace("&#039;", "'")
Example #40
0
from Components.config import config, configfile, ConfigSubsection, getConfigListEntry, ConfigSelection
from Components.ConfigList import ConfigListScreen
from enigma import iPlayableService, eServiceCenter, eTimer, eActionMap
from Components.ServiceEventTracker import ServiceEventTracker
from Components.ServiceList import ServiceList
from Screens.InfoBar import InfoBar
import Screens.Standby
from time import localtime, time
from Tools.Directories import fileExists

import Screens.Standby

config.plugins.SEG = ConfigSubsection()
config.plugins.SEG.showClock = ConfigSelection(
    default="True_Switch",
    choices=[("False", _("Channelnumber in Standby off")),
             ("True", _("Channelnumber in Standby Clock")),
             ("True_Switch", _("Channelnumber/Clock in Standby Clock")),
             ("True_All", _("Clock always")), ("Off", _("Always off"))])
config.plugins.SEG.showCHnumber = ConfigSelection(default="15",
                                                  choices=[("15", _("15 sec")),
                                                           ("30", _("30 sec")),
                                                           ("45", _("45 sec")),
                                                           ("60", _("60 sec"))
                                                           ])
config.plugins.SEG.timeMode = ConfigSelection(default="24h",
                                              choices=[("12h"), ("24h")])


def display_write(text):
    open("/dev/dbox/oled0", "w").write(text)
Example #41
0
class RecordingSettings(Screen, ConfigListScreen):
    def removeNotifier(self):
        config.usage.setup_level.notifiers.remove(self.levelChanged)

    def levelChanged(self, configElement):
        list = []
        self.refill(list)
        self["config"].setList(list)

    def refill(self, list):
        xmldata = setupdom().getroot()
        for x in xmldata.findall("setup"):
            if x.get("key") != self.setup:
                continue
            self.addItems(list, x)
            self.setup_title = x.get("title", "").encode("UTF-8")
            self.seperation = int(x.get('separation', '0'))

    def __init__(self, session, menu_path=""):
        Screen.__init__(self, session)
        self.skinName = "Setup"
        self.menu_path = menu_path
        self["menu_path_compressed"] = StaticText()
        self['footnote'] = Label()

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Save"))
        self["description"] = Label("")

        self.onChangedEntry = []
        self.setup = "recording"
        list = []
        ConfigListScreen.__init__(self,
                                  list,
                                  session=session,
                                  on_change=self.changedEntry)
        self.createSetup()

        self["setupActions"] = ActionMap(
            ["SetupActions", "ColorActions", "MenuActions"], {
                "green": self.keySave,
                "red": self.keyCancel,
                "cancel": self.keyCancel,
                "ok": self.ok,
                "menu": self.closeRecursive,
            }, -2)
        self.onLayoutFinish.append(self.layoutFinished)

    def checkReadWriteDir(self, configele):
        # 		print "checkReadWrite: ", configele.value
        if configele.value in [x[0] for x in self.styles] or fileExists(
                configele.value, "w"):
            configele.last_value = configele.value
            return True
        else:
            dir = configele.value
            configele.value = configele.last_value
            self.session.open(
                MessageBox,
                _("The directory %s is not writable.\nMake sure you select a writable directory instead."
                  ) % dir,
                type=MessageBox.TYPE_ERROR)
            return False

    def createSetup(self):
        self.styles = [("<default>", _("<Default movie location>")),
                       ("<current>", _("<Current movielist location>")),
                       ("<timer>", _("<Last timer location>"))]
        styles_keys = [x[0] for x in self.styles]
        tmp = config.movielist.videodirs.value
        default = config.usage.default_path.value
        if default not in tmp:
            tmp = tmp[:]
            tmp.append(default)
# 		print "DefaultPath: ", default, tmp
        self.default_dirname = ConfigSelection(default=default, choices=tmp)
        tmp = config.movielist.videodirs.value
        default = config.usage.timer_path.value
        if default not in tmp and default not in styles_keys:
            tmp = tmp[:]
            tmp.append(default)
# 		print "TimerPath: ", default, tmp
        self.timer_dirname = ConfigSelection(default=default,
                                             choices=self.styles + tmp)
        tmp = config.movielist.videodirs.value
        default = config.usage.instantrec_path.value
        if default not in tmp and default not in styles_keys:
            tmp = tmp[:]
            tmp.append(default)
# 		print "InstantrecPath: ", default, tmp
        self.instantrec_dirname = ConfigSelection(default=default,
                                                  choices=self.styles + tmp)
        self.default_dirname.addNotifier(self.checkReadWriteDir,
                                         initial_call=False,
                                         immediate_feedback=False)
        self.timer_dirname.addNotifier(self.checkReadWriteDir,
                                       initial_call=False,
                                       immediate_feedback=False)
        self.instantrec_dirname.addNotifier(self.checkReadWriteDir,
                                            initial_call=False,
                                            immediate_feedback=False)

        list = []

        if config.usage.setup_level.index >= 2:
            self.default_entry = getConfigListEntry(
                _("Default movie location"), self.default_dirname,
                _("Set the default location for your recordings. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.default_entry)
            self.timer_entry = getConfigListEntry(
                _("Timer recording location"), self.timer_dirname,
                _("Set the default location for your timers. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.timer_entry)
            self.instantrec_entry = getConfigListEntry(
                _("Instant recording location"), self.instantrec_dirname,
                _("Set the default location for your instant recordings. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.instantrec_entry)
        else:
            self.default_entry = getConfigListEntry(
                _("Movie location"), self.default_dirname,
                _("Set the default location for your recordings. Press 'OK' to add new locations, select left/right to select an existing location."
                  ))
            list.append(self.default_entry)

        self.refill(list)
        self["config"].setList(list)
        if config.usage.sort_settings.value:
            self["config"].list.sort()

    def layoutFinished(self):
        if config.usage.show_menupath.value == 'large' and self.menu_path:
            title = self.menu_path + _(self.setup_title)
            self["menu_path_compressed"].setText("")
        elif config.usage.show_menupath.value == 'small':
            title = _(self.setup_title)
            self["menu_path_compressed"].setText(
                self.menu_path + " >" if not self.menu_path.endswith(' / ')
                else self.menu_path[:-3] + " >" or "")
        else:
            title = _(self.setup_title)
            self["menu_path_compressed"].setText("")
        self.setup_title = title
        self.setTitle(title)

    def changedEntry(self):
        if self["config"].getCurrent()[0] in (_("Default movie location"),
                                              _("Timer record location"),
                                              _("Instant record location"),
                                              _("Movie location")):
            self.checkReadWriteDir(self["config"].getCurrent()[1])

    def ok(self):
        currentry = self["config"].getCurrent()
        self.lastvideodirs = config.movielist.videodirs.value
        self.lasttimeshiftdirs = config.usage.allowed_timeshift_paths.value
        if config.usage.setup_level.index >= 2:
            txt = _("Default movie location")
        else:
            txt = _("Movie location")
        if currentry == self.default_entry:
            self.entrydirname = self.default_dirname
            self.session.openWithCallback(
                self.dirnameSelected, MovieLocationBox, txt,
                preferredPath(self.default_dirname.value))
        elif currentry == self.timer_entry:
            self.entrydirname = self.timer_dirname
            self.session.openWithCallback(
                self.dirnameSelected, MovieLocationBox,
                _("New timers location"),
                preferredPath(self.timer_dirname.value))
        elif currentry == self.instantrec_entry:
            self.entrydirname = self.instantrec_dirname
            self.session.openWithCallback(
                self.dirnameSelected, MovieLocationBox,
                _("Instant recordings location"),
                preferredPath(self.instantrec_dirname.value))

    def dirnameSelected(self, res):
        if res is not None:
            self.entrydirname.value = res
            if config.movielist.videodirs.value != self.lastvideodirs:
                styles_keys = [x[0] for x in self.styles]
                tmp = config.movielist.videodirs.value
                default = self.default_dirname.value
                if default not in tmp:
                    tmp = tmp[:]
                    tmp.append(default)
                self.default_dirname.setChoices(tmp, default=default)
                tmp = config.movielist.videodirs.value
                default = self.timer_dirname.value
                if default not in tmp and default not in styles_keys:
                    tmp = tmp[:]
                    tmp.append(default)
                self.timer_dirname.setChoices(self.styles + tmp,
                                              default=default)
                tmp = config.movielist.videodirs.value
                default = self.instantrec_dirname.value
                if default not in tmp and default not in styles_keys:
                    tmp = tmp[:]
                    tmp.append(default)
                self.instantrec_dirname.setChoices(self.styles + tmp,
                                                   default=default)
                self.entrydirname.value = res
            if self.entrydirname.last_value != res:
                self.checkReadWriteDir(self.entrydirname)

    def saveAll(self):
        currentry = self["config"].getCurrent()
        config.usage.default_path.value = self.default_dirname.value
        config.usage.timer_path.value = self.timer_dirname.value
        config.usage.instantrec_path.value = self.instantrec_dirname.value
        config.usage.default_path.save()
        config.usage.timer_path.save()
        config.usage.instantrec_path.save()
        ConfigListScreen.saveAll(self)

    def createSummary(self):
        return SetupSummary

    def addItems(self, list, parentNode):
        for x in parentNode:
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))

                if not self.levelChanged in config.usage.setup_level.notifiers:
                    config.usage.setup_level.notifiers.append(
                        self.levelChanged)
                    self.onClose.append(self.removeNotifier)

                if item_level > config.usage.setup_level.index:
                    continue

                requires = x.get("requires")
                if requires and requires.startswith('config.'):
                    item = eval(requires or "")
                    if item.value and not item.value == "0":
                        SystemInfo[requires] = True
                    else:
                        SystemInfo[requires] = False

                if requires and not SystemInfo.get(requires, False):
                    continue

                item_text = _(x.get("text", "??").encode("UTF-8"))
                item_description = _(x.get("description", " ").encode("UTF-8"))
                b = eval(x.text or "")
                if b == "":
                    continue
                #add to configlist
                item = b
                # the first b is the item itself, ignored by the configList.
                # the second one is converted to string.
                if not isinstance(item, ConfigNothing):
                    list.append((item_text, item, item_description))
Example #42
0
# FOREIGN import
###################################################
from Components.config import config, ConfigSelection, ConfigYesNo, getConfigListEntry
import re
import urllib
import random
try:
    import simplejson as json
except Exception:
    import json
###################################################
###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.playpuls_defaultformat = ConfigSelection(
    default="999999",
    choices=[("0", "najgorsza"), ("600", "średnia"), ("800", "dobra"),
             ("999999", "najlepsza")])
config.plugins.iptvplayer.playpuls_usedf = ConfigYesNo(default=False)
config.plugins.iptvplayer.playpuls_defaultproto = ConfigSelection(
    default="hls", choices=[("rtmp", "dash (mpd)"), ("hls", "hls (m3u8)")])
config.plugins.iptvplayer.playpuls_proxy = ConfigYesNo(default=False)


def GetConfigList():
    optionList = []
    optionList.append(
        getConfigListEntry("Preferowany protokół:",
                           config.plugins.iptvplayer.playpuls_defaultproto))
    optionList.append(
        getConfigListEntry("Domyślny jakość video:",
                           config.plugins.iptvplayer.playpuls_defaultformat))
Example #43
0
    "EncryptedChannelSetup", "%s%s" %
    (resolveFilename(SCOPE_PLUGINS), "Extensions/EncryptedChannel/locale/"))


def _(txt):
    t = gettext.dgettext("EncryptedChannelSetup", txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t


pluginversion = "1.3"
config.plugins.EncryptedChannel = ConfigSubsection()
config.plugins.EncryptedChannel.enabled = ConfigYesNo(default=False)
config.plugins.EncryptedChannel.mesmode = ConfigSelection(
    default="2",
    choices=[("1", _("Encrypted channel")), ("2", _("Encoded channel")),
             ("3", _("Encrypted channel!")), ("4", _("Encoded channel!"))])
config.plugins.EncryptedChannel.timemode = ConfigSelection(
    default="1",
    choices=[("1", _("1 second")), ("2", _("2 seconds")),
             ("3", _("3 seconds")), ("4", _("4 seconds")),
             ("5", _("5 seconds"))])
config.plugins.EncryptedChannel.minsnrmode = ConfigSelection(default="34",
                                                             choices=[
                                                                 ("5", "5"),
                                                                 ("6", "6"),
                                                                 ("7", "7"),
                                                                 ("8", "8"),
                                                                 ("9", "9"),
                                                                 ("10", "10"),
                                                                 ("12", "12"),
Example #44
0
###################################################


###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer = ConfigSubsection()

from Plugins.Extensions.IPTVPlayer.components.configextmovieplayer import ConfigExtMoviePlayer

config.plugins.iptvplayer.hlsdl_download = ConfigYesNo(default=True)
config.plugins.iptvplayer.set_curr_title = ConfigYesNo(default=False)
config.plugins.iptvplayer.curr_title_file = ConfigText(default="", fixed_size=False)

config.plugins.iptvplayer.showcover = ConfigYesNo(default=True)
config.plugins.iptvplayer.deleteIcons = ConfigSelection(default="3", choices=[("0", _("after closing")), ("1", _("after day")), ("3", _("after three days")), ("7", _("after a week"))])
config.plugins.iptvplayer.allowedcoverformats = ConfigSelection(default="jpeg,png", choices=[("jpeg,png,gif", _("jpeg,png,gif")), ("jpeg,png", _("jpeg,png")), ("jpeg", _("jpeg")), ("all", _("all"))])
config.plugins.iptvplayer.showinextensions = ConfigYesNo(default=True)
config.plugins.iptvplayer.showinMainMenu = ConfigYesNo(default=False)
config.plugins.iptvplayer.ListaGraficzna = ConfigYesNo(default=True)
config.plugins.iptvplayer.group_hosts = ConfigYesNo(default=True)
config.plugins.iptvplayer.NaszaSciezka = ConfigDirectory(default="/hdd/movie/") #, fixed_size = False)
config.plugins.iptvplayer.bufferingPath = ConfigDirectory(default=config.plugins.iptvplayer.NaszaSciezka.value) #, fixed_size = False)
config.plugins.iptvplayer.buforowanie = ConfigYesNo(default=False)
config.plugins.iptvplayer.buforowanie_m3u8 = ConfigYesNo(default=True)
config.plugins.iptvplayer.buforowanie_rtmp = ConfigYesNo(default=False)
config.plugins.iptvplayer.requestedBuffSize = ConfigInteger(2, (1, 120))
config.plugins.iptvplayer.requestedAudioBuffSize = ConfigInteger(256, (1, 10240))

config.plugins.iptvplayer.IPTVDMRunAtStart = ConfigYesNo(default=False)
config.plugins.iptvplayer.IPTVDMShowAfterAdd = ConfigYesNo(default=True)
Example #45
0
profile("config.misc")
config.misc.boxtype = ConfigText(default=boxtype)
config.misc.blackradiopic = ConfigText(
    default=resolveFilename(SCOPE_ACTIVE_SKIN, "black.mvi"))
radiopic = resolveFilename(SCOPE_ACTIVE_SKIN, "radio.mvi")
if os.path.exists(resolveFilename(SCOPE_CONFIG, "radio.mvi")):
    radiopic = resolveFilename(SCOPE_CONFIG, "radio.mvi")
config.misc.radiopic = ConfigText(default=radiopic)
#config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False)
#config.misc.isNextPowerTimerAfterEventActionAuto = ConfigYesNo(default=False)
config.misc.nextWakeup = ConfigText(
    default="-1,-1,-1,0,0,-1,0"
)  #last shutdown time, wakeup time, timer begins, set by (0=rectimer,1=zaptimer, 2=powertimer or 3=plugin), go in standby, next rectimer, force rectimer
config.misc.SyncTimeUsing = ConfigSelection(default="0",
                                            choices=[("0",
                                                      _("Transponder Time")),
                                                     ("1", _("NTP"))])
config.misc.NTPserver = ConfigText(default='pool.ntp.org', fixed_size=False)

config.misc.startCounter = ConfigInteger(default=0)  # number of e2 starts...
config.misc.standbyCounter = NoSave(
    ConfigInteger(default=0))  # number of standby
config.misc.DeepStandby = NoSave(
    ConfigYesNo(default=False))  # detect deepstandby

#demo code for use of standby enter leave callbacks
#def leaveStandby():
#	print "!!!!!!!!!!!!!!!!!leave standby"

#def standbyCountChanged(configelement):
#	print "!!!!!!!!!!!!!!!!!enter standby num", configelement.value
Example #46
0
# Config
from Components.config import config, ConfigSubsection, ConfigEnableDisable, \
 ConfigNumber, ConfigSelection, ConfigYesNo

# Plugin
from Components.PluginComponent import plugins
from Plugins.Plugin import PluginDescriptor

# Initialize Configuration
config.plugins.autotimer = ConfigSubsection()
config.plugins.autotimer.autopoll = ConfigEnableDisable(default=False)
config.plugins.autotimer.interval = ConfigNumber(default=3)
config.plugins.autotimer.refresh = ConfigSelection(choices=[
    ("none", _("None")),
    ("auto", _("Only AutoTimers created during this session")),
    ("all", _("All non-repeating timers"))
],
                                                   default="none")
config.plugins.autotimer.try_guessing = ConfigEnableDisable(default=True)
config.plugins.autotimer.editor = ConfigSelection(choices=[
    ("plain", _("Classic")), ("wizard", _("Wizard"))
],
                                                  default="wizard")
config.plugins.autotimer.addsimilar_on_conflict = ConfigEnableDisable(
    default=False)
config.plugins.autotimer.disabled_on_conflict = ConfigEnableDisable(
    default=False)
config.plugins.autotimer.show_in_extensionsmenu = ConfigYesNo(default=False)
config.plugins.autotimer.fastscan = ConfigYesNo(default=False)
config.plugins.autotimer.notifconflict = ConfigYesNo(default=True)
config.plugins.autotimer.notifsimilar = ConfigYesNo(default=True)
Example #47
0
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.FileList import FileList
from Components.AVSwitch import AVSwitch
from Components.Sources.List import List
from Components.ConfigList import ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSelection, ConfigText, ConfigYesNo, getConfigListEntry
import skin

def getScale():
	return AVSwitch().getFramebufferScale()

config.pic = ConfigSubsection()
config.pic.framesize = ConfigInteger(default=30, limits=(5, 99))
config.pic.slidetime = ConfigInteger(default=10, limits=(1, 60))
config.pic.resize = ConfigSelection(default="1", choices = [("0", _("simple")), ("1", _("better"))])
config.pic.cache = ConfigYesNo(default=True)
config.pic.lastDir = ConfigText(default=resolveFilename(SCOPE_MEDIA))
config.pic.infoline = ConfigYesNo(default=True)
config.pic.loop = ConfigYesNo(default=True)
config.pic.bgcolor = ConfigSelection(default="#00000000", choices = [("#00000000", _("black")), ("#009eb9ff", _("blue")), ("#00ff5a51", _("red")), ("#00ffe875", _("yellow")), ("#0038FF48", _("green"))])
config.pic.textcolor = ConfigSelection(default="#0038FF48", choices = [("#00000000", _("black")), ("#009eb9ff", _("blue")), ("#00ff5a51", _("red")), ("#00ffe875", _("yellow")), ("#0038FF48", _("green"))])

class picshow(Screen):
	skin = """
		<screen name="picshow" position="center,center" size="560,440" title="Picture player" >
			<ePixmap pixmap="buttons/red.png" position="0,0" size="140,40" alphatest="on" />
			<ePixmap pixmap="buttons/green.png" position="140,0" size="140,40" alphatest="on" />
			<ePixmap pixmap="buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
			<widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
			<widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
Example #48
0
class SoftcamPanel(ConfigListScreen, Screen):
    def __init__(self, session):
        global emuDir
        emuDir = "/etc/"
        self.service = None
        Screen.__init__(self, session)

        self.skin = SOFTCAM_SKIN
        self.onShown.append(self.setWindowTitle)
        self.partyfeed = None
        self.YellowAction = REFRESH

        self.mlist = []
        self["key_green"] = Label(_("ReStart"))
        self["key_red"] = Label(_("Stop"))
        self["key_yellow"] = Label(_("Refresh"))
        self.partyfeed = os.path.exists(
            "/etc/opkg/3rdparty-feed.conf") or os.path.exists(
                "/etc/opkg/3rd-party-feed.conf")
        if self.partyfeed:
            self["key_blue"] = Label(_("Install"))
        else:
            self["key_blue"] = Label(_("Exit"))
        self["ecminfo"] = Label(_("No ECM info"))
        self["actifcam"] = Label(_("no CAM 1 active"))
        self["actifcam2"] = Label(_("no CAM 2 active"))

        #// create listings
        self.emuDirlist = []
        self.emuList = []
        self.emuBin = []
        self.emuStart = []
        self.emuStop = []
        self.emuRgui = []
        self.emuDirlist = os.listdir(emuDir)
        self.ecmtel = 0
        self.first = 0
        global count
        count = 0
        #// check emu dir for config files
        print "************ go in the emuloop ************"
        for x in self.emuDirlist:
            #// if file contains the string "emu" (then this is a emu config file)
            if x.find("emu") > -1:
                self.emuList.append(emuDir + x)
                em = open(emuDir + x)
                self.emuRgui.append(0)
                #// read the emu config file
                for line in em.readlines():
                    line1 = line
                    #// startcam
                    line = line1
                    if line.find("startcam") > -1:
                        line = line.split("=")
                        self.emuStart.append(line[1].strip())

                    #// stopcam
                    line = line1
                    if line.find("stopcam") > -1:
                        line = line.split("=")
                        self.emuStop.append(line[1].strip())

                    #// Restart GUI
                    line = line1
                    if line.find("restartgui") > -1:
                        self.emuRgui[count] = 1

                    #// binname
                    line = line1
                    if line.find("binname") > -1:
                        line = line.split("=")
                        self.emuBin.append(line[1].strip())

                em.close()
                count += 1

        self.maxcount = count

        self.onChangedEntry = []
        self.list = []
        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=self.session,
                                  on_change=self.changedEntry)
        self.ReadMenu()
        self.createSetup()
        self["ecminfo"].show()

        self.read_shareinfo()
        self.Timer = eTimer()
        self.Timer.callback.append(self.layoutFinished)
        self.Timer.start(2000, True)
        #// get the remote buttons
        self["actions"] = ActionMap(
            ["OkCancelActions", "DirectionActions", "ColorActions"], {
                "cancel": self.Exit,
                "ok": self.ok,
                "blue": self.Blue,
                "red": self.Red,
                "green": self.Green,
                "yellow": self.Yellow,
            }, -1)
        #// update screen
        self.onLayoutFinish.append(self.layoutFinished)

    def setWindowTitle(self):
        self.setTitle(_("Softcam Panel V2.0"))

    def ReadMenu(self):
        self.whichCam()

        for x in self.emuDirlist:
            #// if file contains the string "emu" (then this is a emu config file)
            if x.find("emu") > -1:
                self.emuList.append(emuDir + x)
                em = open(emuDir + x)
                self.emuRgui.append(0)
                #// read the emu config file
                for line in em.readlines():
                    line1 = line
                    #// emuname
                    line = line1
                    if line.find("emuname") > -1:
                        line = line.split("=")
                        self.mlist.append(line[1].strip())
                        name = line[1].strip()
                em.close()

        emusel = [_('no cam')]
        for x in self.mlist:
            emusel.append(x)
        self.cam1sel = ConfigSelection(emusel)
        self.cam2sel = ConfigSelection(emusel)
        self.setYellowKey(self.curcam)

    def whichCam(self):
        #// check for active cam 1
        cam = config.softcam.actCam.value
        self.curcam = None
        self.curcamIndex = None
        if cam in self.mlist:
            index = self.mlist.index(cam)
            x = self.emuBin[index]
            if self.isCamrunning(x):
                self.curcam = x
                self.curcamIndex = index

        #// check for active cam 2
        cam = config.softcam.actCam2.value
        self.curcam2 = None
        self.curcam2Index = None
        if cam in self.mlist:
            index = self.mlist.index(cam)
            x = self.emuBin[index]
            if self.isCamrunning(x):
                self.curcam2 = x
                self.curcam2Index = index

        if not self.curcam and not self.curcam2 and self.mlist:
            print "[SOFTCAMPANEL] try to find a running cam"
            for cam in self.emuBin:
                index = self.emuBin.index(cam)
                if self.isCamrunning(cam):
                    self.curcam = cam
                    self.curcamIndex = index
                    camname = self.mlist[index]
                    print "[SOFTCAMPANEL] found %s running" % camname
                    self.Save_Settings(camname)
                    break

    def createSetup(self):
        self.editListEntry = None
        self.list = []
        self.list.append(getConfigListEntry(_("Select Cam 1"), self.cam1sel))
        if len(self.emuStart) > 1:
            self["actifcam2"].show()
            if self.cam1sel.value != _(
                    'no cam') or config.softcam.actCam.value != _(
                        "no CAM 1 active"):
                self.list.append(
                    getConfigListEntry(_("Select Cam 2"), self.cam2sel))
                if self.cam2sel.value != _('no cam'):
                    self.list.append(
                        getConfigListEntry(_("Wait time before start Cam 2"),
                                           config.softcam.waittime))
        else:
            self["actifcam2"].hide()
            self.cam2sel.setValue(_('no cam'))

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

    def setYellowKey(self, cam):
        if cam == None or cam == _('no cam'):
            self.YellowAction = REFRESH
            self["key_yellow"].setText(_("Refresh"))
            return
        if cam.upper().startswith('CCCAM'):
            self.YellowAction = CCCAMINFO
            self["key_yellow"].setText(_("CCcamInfo"))
        elif cam.upper().startswith('OSCAM'):
            self.YellowAction = OSCAMINFO
            self["key_yellow"].setText(_("OscamInfo"))
        else:
            self.YellowAction = REFRESH
            self["key_yellow"].setText(_("Refresh"))

    def selectionChanged(self):
        #self["status"].setText(self["config"].getCurrent()[0])
        pass

    def changedEntry(self):
        for x in self.onChangedEntry:
            x()
        self.selectionChanged()
        self.createSetup()

    def getCurrentEntry(self):
        return self["config"].getCurrent()[0]

    def getCurrentValue(self):
        return str(self["config"].getCurrent()[1].getText())

    def getCurrentDescription(self):
        return self["config"].getCurrent() and len(self["config"].getCurrent(
        )) > 2 and self["config"].getCurrent()[2] or ""

    def layoutFinished(self):
        self.Timer.stop()
        if not Check_Softcam():
            self.Exit()
        #// check for active cam
        try:
            self.whichCam()
            global oldcamIndex, oldcam2Index
            oldcamIndex = -1
            oldcam2Index = -1
            tel = 0

            if self.curcam:
                oldcamIndex = self.curcamIndex
                actcam = self.mlist[oldcamIndex]
                if self.first == 0:
                    self.cam1sel.setValue(actcam)
                self["key_green"].setText(_("ReStart"))
                self["actifcam"].setText(_("active CAM 1: ") + actcam)
                print '[SOFTCAM] set active cam 1 to: ' + actcam
            else:
                actcam = _("no CAM 1 active")
                self["actifcam"].setText(actcam)

            if self.curcam2:
                oldcam2Index = self.curcam2Index
                actcam = self.mlist[oldcam2Index]
                if self.first == 0:
                    self.cam2sel.setValue(actcam)
                self["actifcam2"].setText(_("active CAM 2: ") + actcam)
                print '[SOFTCAM] set active cam 2 to: ' + actcam
            else:
                actcam2 = _("no CAM 2 active")
                self["actifcam2"].setText(actcam2)

            if self.first == 0:  # Only update first time or when refresh button was pressed
                self.createSetup()
                self.first = 1

            #// CAM IS NOT RUNNING
            if not self.curcam and not self.curcam2:
                self["key_green"].setText(_("Start"))
                self.YellowAction = REFRESH
                self["key_yellow"].setText(_("Refresh"))
                if os.path.exists('/tmp/ecm.info') is True:
                    os.system("rm /tmp/ecm.info")
                if os.path.exists('/tmp/ecm0.info') is True:
                    os.system("rm /tmp/ecm0.info")

        except:
            pass

        if self["config"].getCurrent()[0] == _("Select Cam 1"):
            self.setYellowKey(self.curcam)
        else:
            self.setYellowKey(self.curcam2)

        #// read ecm.info
        ecmi = ""
        if os.path.exists('/tmp/ecm.info') is True:
            ecmi = self.read_ecm('/tmp/ecm.info')
        elif os.path.exists('/tmp/ecm1.info') is True:
            ecmi = self.read_ecm('/tmp/ecm1.info')
        else:
            ecmi = _("No ECM info")
        ecmold = self["ecminfo"].getText()
        if ecmold == ecmi:
            self.ecmtel += 1
            if self.ecmtel > 5:
                ecmi = _("No new ECM info")
        else:
            self.ecmtel = 0
        self["ecminfo"].setText(ecmi)
        self.Timer.start(2000, True)  #reset timer

    def read_shareinfo(self):
        #// read share.info and put in list
        self.shareinfo = []
        if os.path.exists('/tmp/share.info') is True:
            s = open('/tmp/share.info')
            for x in s.readlines():
                self.shareinfo.append(x)
            s.close()

    def read_ecm(self, ecmpath):
        #// read ecm.info and check for share.info
        ecmi2 = ''
        Caid = ''
        Prov = ''
        f = open(ecmpath)
        for line in f.readlines():
            line = line.replace('=', '')
            line = line.replace(' ', '', 1)
            #// search CaID
            if line.find('ECM on CaID') > -1:
                k = line.find('ECM on CaID') + 14
                Caid = line[k:k + 4]
            #// search Boxid
            if line.find('prov:') > -1:
                tmpprov = line.split(':')
                Prov = tmpprov[1].strip()
                #// search peer in share.info only if share.info exists
                if Caid <> '' and Prov <> '' and len(self.shareinfo) > 0:
                    for x in self.shareinfo:
                        cel = x.split(' ')
                        #// search Boxid and Caid
                        if cel[5][0:4] == Caid and cel[9][3:7] == Prov:
                            line = 'Peer: ' + Prov + ' - ' + cel[
                                3] + ' - ' + cel[8] + '\n'
                            break
            ecmi2 = ecmi2 + line
        f.close()
        return ecmi2

    def Red(self):
        #// Stopping the CAM when pressing the RED button
        self.Timer.stop()
        self.Stopcam()
        self.Timer.start(2000, True)  #reset timer

    def Yellow(self):
        if self.YellowAction == CCCAMINFO:
            self.Timer.stop()
            self.session.openWithCallback(self.ShowSoftcamCallback,
                                          CCcamInfoMain)
        elif self.YellowAction == OSCAMINFO:
            self.Timer.stop()
            self.session.openWithCallback(self.ShowSoftcamCallback,
                                          OscamInfoMenu)
        else:
            self.first = 0
            self.layoutFinished()

    def Green(self):
        #// Start the CAM when pressing the GREEN button
        self.Timer.stop()
        self.Startcam()
        self.Timer.start(2000, True)  #reset timer

    def Exit(self):
        self.Timer.stop()
        self.close()

    def Blue(self):
        if not self.partyfeed:
            self.Exit()
        else:
            self.Timer.stop()
            self.session.openWithCallback(self.ShowSoftcamCallback,
                                          ShowSoftcamPackages)

    def ShowSoftcamCallback(self):
        self.Timer.start(2000, True)

    def ok(self):
        #// Exit Softcam when pressing the OK button
        self.Timer.stop()
        self.Startcam()
        if self.YellowAction == REFRESH:
            self.Yellow()
        self.Timer.start(2000, True)  #reset timer

    def Stopcam(self):
        #// Stopping the CAM
        global oldcamIndex, oldcam2Index
        if oldcamIndex >= 0:
            oldcam = self.emuBin[oldcamIndex]
        else:
            oldcam = None
        if oldcam2Index >= 0:
            oldcam2 = self.emuBin[oldcam2Index]
        else:
            oldcam2 = None
        import time
        self.container = eConsoleAppContainer()

        if config.softcam.camstartMode.value == "0" or not fileExists(
                '/etc/init.d/softcam'):
            if oldcam:
                print '[SOFTCAM] Python stop cam 1: ' + oldcam
                self.container.execute(self.emuStop[oldcamIndex])

                time.sleep(1)  # was 5sec
                t = 0
                while t < 5:
                    p = command('pidof %s |wc -w' % oldcam)
                    if not p.isdigit(): p = 0
                    if int(p) > 0:
                        self.container = eConsoleAppContainer()
                        self.container.execute('killall -9 ' + oldcam)
                        t += 1
                        time.sleep(1)
                    else:
                        t = 5

            if oldcam2:
                print '[SOFTCAM] Python stop cam 2: ' + oldcam2
                self.container.execute(self.emuStop[oldcam2Index])

                time.sleep(1)  # was 5sec
                t = 0
                while t < 5:
                    p = command('pidof %s |wc -w' % oldcam2)
                    if not p.isdigit(): p = 0
                    if int(p) > 0:
                        self.container = eConsoleAppContainer()
                        self.container.execute('killall -9 ' + oldcam2)
                        t += 1
                        time.sleep(1)
                    else:
                        t = 5

        else:
            self.container.execute('/etc/init.d/softcam.cam1 stop')
            self.container.execute('/etc/init.d/softcam.cam2 stop')

        if os.path.exists('/tmp/ecm.info') is True:
            os.system("rm /tmp/ecm.info")
        actcam = _("no CAM 1 active")
        actcam2 = _("no CAM 2 active")
        self["actifcam"].setText(actcam)
        self["actifcam2"].setText(actcam2)
        self["key_green"].setText(_("Start"))
        self["ecminfo"].setText(_("No ECM info"))
        self.Save_Settings(actcam)
        self.Save_Settings2(actcam2)

    def Startcam(self):
        #// Starting the CAM
        try:
            if count > 0:
                if self.cam1sel.value == self.cam2sel.value:
                    self.session.openWithCallback(
                        self.doNothing,
                        MessageBox,
                        _("No Cam started !!\n\nCam 1 must be different from Cam 2"
                          ),
                        MessageBox.TYPE_ERROR,
                        simple=True)
                    return
                if config.softcam.camstartMode.value == "0":
                    self.Stopcam()

                self.camIndex = self.cam1sel.getIndex() - 1
                self.cam2Index = self.cam2sel.getIndex() - 1
                if self.camIndex >= 0:
                    actcam = self.cam1sel.value
                    self["actifcam"].setText(_("active CAM 1: ") + actcam)
                    self.Save_Settings(actcam)
                    start = self.emuStart[self.camIndex]
                    if self.checkBinName(self.emuBin[self.camIndex], start):
                        self.session.openWithCallback(
                            self.startcam2,
                            MessageBox,
                            actcam +
                            _(" Not Started !!\n\nCam binname must be in the start command line\nCheck your emu config file"
                              ),
                            MessageBox.TYPE_ERROR,
                            simple=True)
                        return
                    if config.softcam.camstartMode.value == "0":
                        print '[SOFTCAM] Python start cam 1: ' + actcam
                        self.session.openWithCallback(self.waitTime,
                                                      MessageBox,
                                                      _("Starting Cam 1: ") +
                                                      actcam,
                                                      MessageBox.TYPE_WARNING,
                                                      timeout=5,
                                                      simple=True)
                        self.container = eConsoleAppContainer()
                        self.container.execute(start)
                    else:
                        # Create INIT.D start
                        self.session.openWithCallback(
                            self.doNothing,
                            MessageBox,
                            _("Creating start scripts and starting the cam"),
                            MessageBox.TYPE_WARNING,
                            timeout=10,
                            simple=True)
                        self.Save_Settings2(self.cam2sel.value)

                        camname1 = self.emuBin[self.camIndex]
                        camname2 = self.emuBin[self.cam2Index]
                        self.deleteInit()
                        camname = "/usr/bin/" + camname1
                        startcmd = self.emuStart[self.camIndex]
                        stopcmd = self.emuStop[self.camIndex]
                        self.createInitdscript("cam1", camname, startcmd,
                                               stopcmd)
                        if self.cam2Index >= 0:
                            camname = "/usr/bin/" + camname2
                            startcmd = self.emuStart[self.cam2Index]
                            stopcmd = self.emuStop[self.cam2Index]
                            self.createInitdscript(
                                "cam2", camname, startcmd, stopcmd,
                                config.softcam.waittime.value)

                    self["key_green"].setText(_("ReStart"))

        except:
            pass

    def waitTime(self, ret):
        if self.cam2Index >= 0:
            if config.softcam.waittime.value == '0':
                self.startcam2(None)
            else:
                self.session.openWithCallback(
                    self.startcam2,
                    MessageBox,
                    _("Waiting..."),
                    MessageBox.TYPE_WARNING,
                    timeout=int(config.softcam.waittime.value),
                    simple=True)

    def doNothing(self, ret):
        pass

    def startcam2(self, ret):
        camIndex = self.cam2Index
        if camIndex >= 0:
            actcam = self.cam2sel.value
            self["actifcam2"].setText(_("active CAM 2: ") + actcam)
            self.Save_Settings2(actcam)
            start = self.emuStart[camIndex]
            if self.checkBinName(self.emuBin[self.cam2Index], start):
                self.session.open(
                    MessageBox,
                    actcam +
                    _(" Not Started !!\n\nCam binname must be in the start command line\nCheck your emu config file"
                      ),
                    MessageBox.TYPE_ERROR,
                    simple=True)
                return
            print '[SOFTCAM] Python start cam 2: ' + actcam
            self.session.open(MessageBox,
                              _("Starting Cam 2: ") + actcam,
                              MessageBox.TYPE_WARNING,
                              timeout=5,
                              simple=True)
            self.container = eConsoleAppContainer()
            self.container.execute(start)

    def Save_Settings(self, cam_name):
        #// Save Came Name to Settings file
        config.softcam.actCam.setValue(cam_name)
        config.softcam.save()
        configfile.save()

    def Save_Settings2(self, cam_name):
        #// Save Came Name to Settings file
        config.softcam.actCam2.setValue(cam_name)
        config.softcam.save()
        configfile.save()

    def isCamrunning(self, cam):
        p = command('pidof ' + cam + ' |wc -w')
        if not p.isdigit(): p = 0
        if int(p) > 0:
            return True
        else:
            return False

    def checkBinName(self, binname, start):
        print "[CHECKBINNAME] bin=%s ,start=%s" % (binname, start)
        if start.find(binname + ' ') > -1:
            print "[CHECKBINNAME] OK"
            return False
        else:
            if start[start.rfind('/') + 1:] == binname:
                print "[CHECKBINNAME] OK"
                return False
            else:
                print "[CHECKBINNAME] ERROR"
                return True

    def createInitdscript(self, camname, emubin, start, stop, wait=None):
        Adir = "/etc/init.d/softcam." + camname
        softcamfile = []
        softcamfile.append('#!/bin/sh')
        softcamfile.append('DAEMON=%s' % emubin)
        softcamfile.append('STARTCAM="%s"' % start)
        softcamfile.append('STOPCAM="%s"' % stop)
        softcamfile.append('DESC="Softcam"')
        softcamfile.append('')
        softcamfile.append('test -f $DAEMON || exit 0')
        softcamfile.append('set -e')
        softcamfile.append('')
        softcamfile.append('case "$1" in')
        softcamfile.append('	start)')
        softcamfile.append('		echo -n "starting $DESC: $DAEMON... "')
        if wait:
            softcamfile.append('		sleep ' + wait)
        softcamfile.append('		$STARTCAM')
        softcamfile.append('		echo "done."')
        softcamfile.append('		;;')
        softcamfile.append('	stop)')
        softcamfile.append('		echo -n "stopping $DESC: $DAEMON... "')
        softcamfile.append('		$STOPCAM')
        softcamfile.append('		echo "done."')
        softcamfile.append('		;;')
        softcamfile.append('	restart)')
        softcamfile.append('		echo "restarting $DESC: $DAEMON... "')
        softcamfile.append('		$0 stop')
        softcamfile.append('		echo "wait..."')
        softcamfile.append('		sleep 5')
        softcamfile.append('		$0 start')
        softcamfile.append('		echo "done."')
        softcamfile.append('		;;')
        softcamfile.append('	*)')
        softcamfile.append('		echo "Usage: $0 {start|stop|restart}"')
        softcamfile.append('		exit 1')
        softcamfile.append('		;;')
        softcamfile.append('esac')
        softcamfile.append('')
        softcamfile.append('exit 0')

        f = open(Adir, "w")
        for x in softcamfile:
            f.writelines(x + '\n')
        f.close()

        self.container = eConsoleAppContainer()
        # Set execute rights
        os.chmod(Adir, 0755)
        # Create symbolic link for startup
        if not os.path.exists("/etc/rc2.d/S20softcam." + camname):
            self.container.execute('update-rc.d -f softcam.' + camname +
                                   ' defaults')
        # Wait a few seconds
        import time
        time.sleep(3)

        # Start cam
        if self.isCamrunning(emubin):
            self.container.execute('/etc/init.d/softcam.' + camname +
                                   ' restart')
        else:
            self.container.execute('/etc/init.d/softcam.' + camname + ' start')

    def deleteInit(self):
        if os.path.exists("/etc/rc2.d/S20softcam.cam1"):
            print "Delete Symbolink link"
            self.container = eConsoleAppContainer()
            self.container.execute('update-rc.d -f softcam.cam1 defaults')
        if os.path.exists("/etc/init.d/softcam.cam1"):
            print "Delete softcam init script cam1"
            os.system("rm /etc/init.d/softcam.cam1")

        if os.path.exists("/etc/rc2.d/S20softcam.cam2"):
            print "Delete Symbolink link"
            self.container = eConsoleAppContainer()
            self.container.execute('update-rc.d -f softcam.cam2 defaults')
        if os.path.exists("/etc/init.d/softcam.cam2"):
            print "Delete softcam init script cam2"
            os.system("rm /etc/init.d/softcam.cam2")
Example #49
0
class DiseqcTesterTestTypeSelection(Screen, ConfigListScreen):
    def __init__(self, session, feid):
        Screen.__init__(self, session)
        # for the skin: first try MediaPlayerSettings, then Setup, this allows individual skinning
        self.skinName = ["DiseqcTesterTestTypeSelection", "Setup"]
        self.setup_title = _("DiSEqC-tester settings")
        self.onChangedEntry = []
        self.feid = feid
        self.list = []
        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=self.session,
                                  on_change=self.changedEntry)

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

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))

        self.createSetup()
        self.onLayoutFinish.append(self.__layoutFinished)

    def __layoutFinished(self):
        self.setTitle(self.setup_title)

    def createSetup(self):
        self.testtype = ConfigSelection(choices={
            "quick": _("Quick"),
            "random": _("Random"),
            "complete": _("Complete")
        },
                                        default="quick")
        self.testtypeEntry = getConfigListEntry(_("Test type"), self.testtype)
        self.list.append(self.testtypeEntry)

        self.loopsfailed = ConfigSelection(choices={
            "-1": _("Every known"),
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7",
            "8": "8"
        },
                                           default="3")
        self.loopsfailedEntry = getConfigListEntry(
            _("Stop testing plane after # failed transponders"),
            self.loopsfailed)
        self.list.append(self.loopsfailedEntry)

        self.loopssuccessful = ConfigSelection(choices={
            "-1": _("Every known"),
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7",
            "8": "8"
        },
                                               default="1")
        self.loopssuccessfulEntry = getConfigListEntry(
            _("Stop testing plane after # successful transponders"),
            self.loopssuccessful)
        self.list.append(self.loopssuccessfulEntry)

        self.log = ConfigYesNo(False)
        self.logEntry = getConfigListEntry(_("Log results to /tmp"), self.log)
        self.list.append(self.logEntry)

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

    def keyOK(self):
        print self.testtype.getValue()
        testtype = DiseqcTester.TEST_TYPE_QUICK
        if self.testtype.getValue() == "quick":
            testtype = DiseqcTester.TEST_TYPE_QUICK
        elif self.testtype.getValue() == "random":
            testtype = DiseqcTester.TEST_TYPE_RANDOM
        elif self.testtype.getValue() == "complete":
            testtype = DiseqcTester.TEST_TYPE_COMPLETE
        self.session.open(DiseqcTester,
                          feid=self.feid,
                          test_type=testtype,
                          loopsfailed=int(self.loopsfailed.value),
                          loopssuccessful=int(self.loopssuccessful.value),
                          log=self.log.value)

    def keyCancel(self):
        self.close()

    # for summary:
    def changedEntry(self):
        for x in self.onChangedEntry:
            x()

    def getCurrentEntry(self):
        return self["config"].getCurrent()[0]

    def getCurrentValue(self):
        return str(self["config"].getCurrent()[1].getText())

    def createSummary(self):
        from Screens.Setup import SetupSummary
        return SetupSummary
#  distributed other than under the conditions noted above.
#
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigSubsection, ConfigSelection, getConfigListEntry
from Components.ConfigList import ConfigListScreen
from enigma import eTimer
from time import time, strftime, localtime
from timer import TimerEntry

config.plugins.automatictimerlistcleanup = ConfigSubsection()
config.plugins.automatictimerlistcleanup.type = ConfigSelection(
    default="-1",
    choices=[("-1", _("disabled")), ("0", _("immediately after recording")),
             ("1", _("older than 1 day")), ("3", _("older than 3 days")),
             ("7", _("older than 1 week")), ("14", _("older than 2 weeks")),
             ("28", _("older than 4 weeks")), ("42", _("older than 6 weeks"))])


class AutomaticTimerlistCleanUpSetup(Screen, ConfigListScreen):  # config

    skin = """
		<screen position="center,center" size="620,200" title="%s" >
			<ePixmap pixmap="skin_default/buttons/red.png" position="10,5" size="200,40" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="210,5" size="200,40" alphatest="on" />
			<widget source="key_red" render="Label" position="10,5" size="200,40" zPosition="1" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" shadowColor="black" shadowOffset="-2,-2" />
			<widget source="key_green" render="Label" position="210,5" size="200,40" zPosition="1" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" shadowColor="black" shadowOffset="-2,-2" />
			<eLabel position="10,50" size="600,1" backgroundColor="grey" />
			<widget name="config" position="10,60" size="600,120" enableWrapAround="1" scrollbarMode="showOnDemand" />
		</screen>""" % _("Automatic Timerlist Cleanup Setup")
Example #51
0
# Tools
from Tools.Directories import pathExists, fileExists

#Plugins
from Plugins.Plugin import PluginDescriptor
from mixes import Mixes

mixes = Mixes().read()
choices = sorted([(mixes[x]["key"], mixes[x]["name"]) for x in mixes],
                 key=lambda listItem: listItem[1])

default_mix = "dsayers_vmuk_into_skyuk"
ABMpath = "/usr/lib/enigma2/python/Plugins/SystemPlugins/AutoBouquetsMaker/custom/"

config.plugins.abmImporter = ConfigSubsection()
config.plugins.abmImporter.mix = ConfigSelection(default=default_mix,
                                                 choices=choices)
config.plugins.abmImporter.enableImporter = ConfigYesNo(default=False)
config.plugins.abmImporter.leadTime = ConfigSelection(
    default="5",
    choices=[("1", _("1 minute")), ("2", _("2 minutes")),
             ("3", _("3 minutes")), ("5", _("5 minutes")),
             ("10", _("10 minutes")), ("20", _("20 minutes")),
             ("30", _("30 minutes"))])


class ABMCustomMixImporterScreen(Setup):
    skin = """
		<screen position="340,70" size="600,620">
			<widget source="key_red" render="Label" position="0,0" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" backgroundColor="#9f1313" font="Regular;18" transparent="1"/>
			<widget source="key_green" render="Label" position="150,0" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" backgroundColor="#1f771f" font="Regular;18" transparent="1"/>
			<widget source="key_yellow" render="Label" position="300,0" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" backgroundColor="#a08500" font="Regular;18" transparent="1"/>
class SetupFallbacktuner(ConfigListScreen, Screen):
	def __init__(self, session):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Fallback tuner setup"))
		self.skinName = ["FallbackTunerSetup", "Setup"]
		self.onChangedEntry = []
		self.session = session
		ConfigListScreen.__init__(self, [], session = session, on_change = self.changedEntry)

		self["actions2"] = ActionMap(["SetupActions"],
		{
			"ok": self.run,
			"menu": self.keyCancel,
			"cancel": self.keyCancel,
			"save": self.run,
		}, -2)

		self["key_red"] = StaticText(_("Exit"))
		self["key_green"] = StaticText(_("Save"))

		self["description"] = Label("")
		self["VKeyIcon"] = Boolean(False)
		self["HelpWindow"] = Pixmap()
		self["HelpWindow"].hide()

		self.force_update_list = False
		self.createConfig()
		self.createSetup()
		self.remote_fallback_prev = config.usage.remote_fallback_import.value
		self["config"].onSelectionChanged.append(self.selectionChanged)
		self.selectionChanged()

	def createConfig(self):

		def set_avahiselect_seperate(configElement):
			if config.usage.remote_fallback_import_url.value and config.usage.remote_fallback_import_url.value != config.usage.remote_fallback.value:
				peerDefault_sepearate = config.usage.remote_fallback_import_url.value
			else:
				peerDefault_sepearate = "same"
				config.usage.remote_fallback_import_url.value = config.usage.remote_fallback.value
			self.seperateBoxes = [("same", _("Same as stream"))] + self.peerStreamingBoxes
			if configElement.value not in ("url", "ip") and configElement.value in self.seperateBoxes:
				self.seperateBoxes.remove(configElement.value)
			self.avahiselect_seperate = ConfigSelection(default=peerDefault_sepearate, choices=self.seperateBoxes)

		self.peerStreamingBoxes = getPeerStreamingBoxes() + [("ip", _("Enter IP address")), ("url", _("Enter URL"))]
		peerDefault = peerDefault_sepearate = None
		if config.usage.remote_fallback.value:
			peerDefault = peerDefault_sepearate = config.usage.remote_fallback.value
			if config.usage.remote_fallback.value and config.usage.remote_fallback.value not in self.peerStreamingBoxes:
				self.peerStreamingBoxes = [config.usage.remote_fallback.value] + self.peerStreamingBoxes
			if config.usage.remote_fallback_import_url.value and config.usage.remote_fallback_import_url.value not in self.peerStreamingBoxes:
				self.peerStreamingBoxes = [config.usage.remote_fallback_import_url.value] + self.peerStreamingBoxes
		self.avahiselect = ConfigSelection(default=peerDefault, choices=self.peerStreamingBoxes)
		self.avahiselect.addNotifier(set_avahiselect_seperate)
		try:
			ipDefault = [int(x) for x in config.usage.remote_fallback.value.split(":")[1][2:].split(".")]
			portDefault = int( config.usage.remote_fallback.value.split(":")[2])
		except:
			ipDefault = [0, 0, 0, 0]
			portDefault = 8001
		self.ip = ConfigIP(default=ipDefault, auto_jump=True)
		self.port = ConfigInteger(default=portDefault, limits=(1,65535))
		self.ip_seperate = ConfigIP( default=ipDefault, auto_jump=True)
		self.port_seperate = ConfigInteger(default=portDefault, limits=(1,65535))

	def createSetup(self):
		self.list = []
		self.list.append(getConfigListEntry(_("Enable fallback remote receiver"),
			config.usage.remote_fallback_enabled,
			_("Enable remote enigma2 receiver to be tried to tune into services that cannot be tuned into locally (e.g. tuner is occupied or service type is unavailable on the local tuner. Specify complete URL including http:// and port number (normally ...:8001), e.g. http://second_box:8001.")))
		self.list.append(getConfigListEntry(_("Import from remote receiver URL"),
			config.usage.remote_fallback_import,
			_("Import channels and/or EPG from remote receiver URL when receiver is booted")))
		if config.usage.remote_fallback_enabled.value or config.usage.remote_fallback_import.value:
			self.list.append(getConfigListEntry(_("Enable import timer from fallback tuner"),
				config.usage.remote_fallback_external_timer,
				_("When enabled the timer from the fallback tuner is imported")))
			self.list.append(getConfigListEntry(_("Fallback remote receiver"),
				self.avahiselect,
				_("Destination of fallback remote receiver")))
			if self.avahiselect.value == "ip":
				self.list.append(getConfigListEntry("  %s" % _("Fallback remote receiver IP"),
					self.ip,
					_("IP of fallback remote receiver")))			
				self.list.append(getConfigListEntry("  %s" % _("Fallback remote receiver Port"),
					self.port,
					_("Port of fallback remote receiver")))			
			if self.avahiselect.value == "url":
				self.list.append(getConfigListEntry("  %s" % _("Fallback remote receiver URL"),
					config.usage.remote_fallback,
					_("URL of fallback remote receiver")))
		if config.usage.remote_fallback_enabled.value and config.usage.remote_fallback_import.value and config.usage.remote_fallback.value:
			self.list.append(getConfigListEntry(_("Import remote receiver URL"),
				self.avahiselect_seperate,
				_("URL of fallback remote receiver")))
			if self.avahiselect_seperate.value == "ip":
				self.list.append(getConfigListEntry("  %s" % _("Fallback remote receiver IP"),
					self.ip_seperate,
					_("IP of fallback remote receiver")))			
				self.list.append(getConfigListEntry("  %s" % _("Fallback remote receiver Port"),
					self.port_seperate,
					_("Port of fallback remote receiver")))			
			if self.avahiselect_seperate.value == "url":
				self.list.append(getConfigListEntry("  %s" % _("Fallback remote receiver URL"),
					config.usage.remote_fallback_import_url,
					_("URL of fallback remote receiver")))
		if config.usage.remote_fallback_enabled.value and config.usage.remote_fallback_import.value:
			self.list.append(getConfigListEntry(_("Also import at reboot/restart enigma2"),
				config.usage.remote_fallback_import_restart,
				_("Import channels and/or EPG from remote receiver URL when receiver or enigma2 is restarted")))
			self.list.append(getConfigListEntry(_("Also import when box is leaving standby"),
				config.usage.remote_fallback_import_standby,
				_("Import channels and/or EPG from remote receiver URL also when the receiver is getting out of standby")))
			self.list.append(getConfigListEntry(_("Also import from the extension menu"),
				config.usage.remote_fallback_extension_menu,
				_("Make it possible to manually initiate the channels import and/or EPG via the extension menu")))
			self.list.append(getConfigListEntry(_("Show notification when import channels was successful"),
				config.usage.remote_fallback_ok,
				_("Show notification when import channels and/or EPG from remote receiver URL is completed")))
			self.list.append(getConfigListEntry(_("Show notification when import channels was not successful"),
				config.usage.remote_fallback_nok,
				_("Show notification when import channels and/or EPG from remote receiver URL did not complete")))
			self.list.append(getConfigListEntry(_("Customize OpenWebIF settings for fallback tuner"),
				config.usage.remote_fallback_openwebif_customize,
				_("When enabled you can customize the OpenWebIf settings for the fallback tuner")))
			if config.usage.remote_fallback_openwebif_customize.value:
				self.list.append(getConfigListEntry("  %s" % _("User ID"),
					config.usage.remote_fallback_openwebif_userid,
					_("Set the User ID of the OpenWebif from your fallback tuner")))
				self.list.append(getConfigListEntry("  %s" % _("Password"),
					config.usage.remote_fallback_openwebif_password,
					_("Set the password of the OpenWebif from your fallback tuner")))
				self.list.append(getConfigListEntry("  %s" % _("Port"),
					config.usage.remote_fallback_openwebif_port,
					"  %s" % _("Set the port of the OpenWebif from your fallback tuner")))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def selectionChanged(self):
		if self.force_update_list:
			self["config"].onSelectionChanged.remove(self.selectionChanged)
			self.createSetup()
			self["config"].onSelectionChanged.append(self.selectionChanged)
			self.force_update_list = False
		if not (isinstance(self["config"].getCurrent()[1], ConfigBoolean) or isinstance(self["config"].getCurrent()[1], ConfigSelection)):
			self.force_update_list = True
		self["description"].setText(self.getCurrentDescription())

	def changedEntry(self):
		if isinstance(self["config"].getCurrent()[1], ConfigBoolean) or isinstance(self["config"].getCurrent()[1], ConfigSelection):
			self.createSetup()

	def run(self):
		if self.avahiselect.value == "ip":
			config.usage.remote_fallback.value = "http://%d.%d.%d.%d:%d" % (tuple(self.ip.value) + (self.port.value,))
		elif self.avahiselect.value != "url":
			config.usage.remote_fallback.value = self.avahiselect.value
		if self.avahiselect_seperate.value == "ip":
			config.usage.remote_fallback_import_url.value = "http://%d.%d.%d.%d:%d" % (tuple(self.ip_seperate.value) + (self.port_seperate.value,))
		elif self.avahiselect_seperate.value == "same":
			config.usage.remote_fallback_import_url.value = ""
		elif self.avahiselect_seperate.value != "url":
			config.usage.remote_fallback_import_url.value = self.avahiselect_seperate.value
		if config.usage.remote_fallback_import_url.value == config.usage.remote_fallback.value:
			config.usage.remote_fallback_import_url.value = ""
		config.usage.remote_fallback_enabled.save()
		config.usage.remote_fallback_import.save()
		config.usage.remote_fallback_import_url.save()
		config.usage.remote_fallback_import_restart.save()
		config.usage.remote_fallback_import_standby.save()
		config.usage.remote_fallback_extension_menu.save()
		config.usage.remote_fallback_ok.save()
		config.usage.remote_fallback_nok.save()
		config.usage.remote_fallback.save()
		config.usage.remote_fallback_external_timer.save()
		config.usage.remote_fallback_openwebif_customize.save()
		config.usage.remote_fallback_openwebif_userid.save()
		config.usage.remote_fallback_openwebif_password.save()
		config.usage.remote_fallback_openwebif_port.save()
		configfile.save()
		if not self.remote_fallback_prev and config.usage.remote_fallback_import.value:
			ImportChannels()
		self.close(False)
Example #53
0
from enigma import iPlayableService, eServiceCenter, eTimer, eActionMap, eDBoxLCD
from Components.ServiceEventTracker import ServiceEventTracker
from Screens.InfoBar import InfoBar
from time import localtime, time
import Screens.Standby
from Tools.HardwareInfo import HardwareInfo

use_oled = False
if HardwareInfo().get_device_model() in ("formuler3", "formuler4", "s1", "h3",
                                         "h4", "h5", "lc"):
    use_oled = True

config.plugins.VFD_ini = ConfigSubsection()
config.plugins.VFD_ini.showClock = ConfigSelection(
    default="True_Switch",
    choices=[("False", _("Channelnumber in Standby off")),
             ("True", _("Channelnumber in Standby Clock")),
             ("True_Switch", _("Channelnumber/Clock in Standby Clock")),
             ("True_All", _("Clock always")), ("Off", _("Always off"))])
config.plugins.VFD_ini.timeMode = ConfigSelection(default="24h",
                                                  choices=[("12h", _("12h")),
                                                           ("24h", _("24h"))])
config.plugins.VFD_ini.recDisplay = ConfigSelection(default="False",
                                                    choices=[
                                                        ("True", _("yes")),
                                                        ("False", _("no"))
                                                    ])
config.plugins.VFD_ini.recClockBlink = ConfigSelection(
    default="off",
    choices=[("off", _("Off")), ("on_off", _("On/Off")),
             ("brightness", _("Brightness level"))])
config.plugins.VFD_ini.ClockLevel1 = ConfigSlider(default=1, limits=(0, 10))
Example #54
0
    def __init__(self,
                 session,
                 job,
                 parent=None,
                 cancelable=True,
                 backgroundable=True,
                 afterEventChangeable=True):
        Screen.__init__(self, session, parent)
        InfoBarNotifications.__init__(self)
        ConfigListScreen.__init__(self, [])
        self.parent = parent
        self.job = job
        self.setTitle(_("Job overview"))

        self["job_name"] = StaticText(job.name)
        self["job_progress"] = Progress()
        self["job_task"] = StaticText()
        self["summary_job_name"] = StaticText(job.name)
        self["summary_job_progress"] = Progress()
        self["summary_job_task"] = StaticText()
        self["job_status"] = StaticText()

        self.cancelable = cancelable
        self.backgroundable = backgroundable

        self["key_green"] = StaticText("")

        if self.cancelable:
            self["key_red"] = StaticText(_("Cancel"))
        else:
            self["key_red"] = StaticText("")

        if self.backgroundable:
            self["key_blue"] = StaticText(_("Background"))
        else:
            self["key_blue"] = StaticText("")

        self.onShow.append(self.windowShow)
        self.onHide.append(self.windowHide)

        self["setupActions"] = ActionMap(
            ["ColorActions", "SetupActions"], {
                "green": self.ok,
                "red": self.abort,
                "blue": self.background,
                "cancel": self.abort,
                "ok": self.ok,
            }, -2)

        self.settings = ConfigSubsection()
        if SystemInfo["DeepstandbySupport"]:
            shutdownString = _("go to deep standby")
        else:
            shutdownString = _("shut down")
        self.settings.afterEvent = ConfigSelection(choices=[
            ("nothing", _("do nothing")), ("close", _("Close")),
            ("standby", _("go to standby")), ("deepstandby", shutdownString)
        ],
                                                   default=self.job.afterEvent
                                                   or "nothing")
        self.job.afterEvent = self.settings.afterEvent.getValue()
        self.afterEventChangeable = afterEventChangeable
        self.setupList()
        self.state_changed()
Example #55
0
list = []
list.append("Unencrypted")
list.append("WEP")
list.append("WPA")
list.append("WPA/WPA2")
list.append("WPA2")

weplist = []
weplist.append("ASCII")
weplist.append("HEX")

config.plugins.wlan = ConfigSubsection()
config.plugins.wlan.essid = NoSave(ConfigText(default="", fixed_size=False))
config.plugins.wlan.hiddenessid = NoSave(ConfigYesNo(default=False))
config.plugins.wlan.encryption = NoSave(ConfigSelection(list, default="WPA2"))
config.plugins.wlan.wepkeytype = NoSave(
    ConfigSelection(weplist, default="ASCII"))
config.plugins.wlan.psk = NoSave(ConfigPassword(default="", fixed_size=False))


def existBcmWifi(iface):
    return os.path.exists("/tmp/bcm/" + iface)


def getWlConfName(iface):
    return "/etc/wl.conf.%s" % iface


def getWlanConfigName(iface):
    return '/etc/wpa_supplicant.' + iface + '.conf'
Example #56
0
    def buildMy_rec(self, device):
        try:
            if device.find('1') > 1:
                device2 = device.replace('1', '')
        except:
            device2 = ''
        try:
            if device.find('2') > 1:
                device2 = device.replace('2', '')
        except:
            device2 = ''
        try:
            if device.find('3') > 1:
                device2 = device.replace('3', '')
        except:
            device2 = ''
        try:
            if device.find('4') > 1:
                device2 = device.replace('4', '')
        except:
            device2 = ''
        try:
            if device.find('5') > 1:
                device2 = device.replace('5', '')
        except:
            device2 = ''
        try:
            if device.find('6') > 1:
                device2 = device.replace('6', '')
        except:
            device2 = ''
        try:
            if device.find('7') > 1:
                device2 = device.replace('7', '')
        except:
            device2 = ''
        try:
            if device.find('8') > 1:
                device2 = device.replace('8', '')
        except:
            device2 = ''
        try:
            if device.find('p1') > 1:
                device2 = device.replace('p1', '')
        except:
            device2 = ''
        try:
            if device.find('p2') > 1:
                device2 = device.replace('p2', '')
        except:
            device2 = ''
        try:
            if device.find('p3') > 1:
                device2 = device.replace('p3', '')
        except:
            device2 = ''
        try:
            if device.find('p4') > 1:
                device2 = device.replace('p4', '')
        except:
            device2 = ''
        try:
            if device.find('p5') > 1:
                device2 = device.replace('p5', '')
        except:
            device2 = ''
        try:
            if device.find('p6') > 1:
                device2 = device.replace('p6', '')
        except:
            device2 = ''
        try:
            if device.find('p7') > 1:
                device2 = device.replace('p7', '')
        except:
            device2 = ''
        try:
            if device.find('p8') > 1:
                device2 = device.replace('p8', '')
        except:
            device2 = ''
        devicetype = path.realpath('/sys/block/' + device2 + '/device')
        d2 = device
        name = 'USB: '
        mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/dev_usbstick.png'
        if device2.startswith('mmcblk'):
            model = file('/sys/block/' + device2 + '/device/name').read()
            mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/dev_mmc.png'
            name = 'MMC: '
        else:
            model = file('/sys/block/' + device2 + '/device/model').read()
        model = str(model).replace('\n', '')
        des = ''
        print "test:"
        if devicetype.find('/devices/pci') != -1 or devicetype.find(
                'ahci') != -1:
            name = _("HARD DISK: ")
            mypixmap = '/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/dev_hdd.png'
        name = name + model
        f = open('/proc/mounts', 'r')
        for line in f.readlines():
            if line.find(device) != -1:
                parts = line.strip().split()
                d1 = parts[1]
                dtype = parts[2]
                break
                continue
            else:
                d1 = _("None")
                dtype = _("unavailable")
        f.close()
        f = open('/proc/partitions', 'r')
        for line in f.readlines():
            if line.find(device) != -1:
                parts = line.strip().split()
                size = int(parts[2])
                if (((float(size) / 1024) / 1024) / 1024) > 1:
                    des = _("Size: ") + str(
                        round(((
                            (float(size) / 1024) / 1024) / 1024), 2)) + _("TB")
                elif ((size / 1024) / 1024) > 1:
                    des = _("Size: ") + str((size / 1024) / 1024) + _("GB")
                else:
                    des = _("Size: ") + str(size / 1024) + _("MB")
            else:
                try:
                    size = file('/sys/block/' + device2 + '/' + device +
                                '/size').read()
                    size = str(size).replace('\n', '')
                    size = int(size)
                except:
                    size = 0
                if ((((float(size) / 2) / 1024) / 1024) / 1024) > 1:
                    des = _("Size: ") + str(
                        round(((((float(size) / 2) / 1024) / 1024) / 1024),
                              2)) + _("TB")
                elif (((size / 2) / 1024) / 1024) > 1:
                    des = _("Size: ") + str(
                        ((size / 2) / 1024) / 1024) + _("GB")
                else:
                    des = _("Size: ") + str((size / 2) / 1024) + _("MB")
        f.close()
        item = NoSave(
            ConfigSelection(default='/media/' + device,
                            choices=[('/media/' + device, '/media/' + device),
                                     ('/media/hdd', '/media/hdd'),
                                     ('/media/hdd2', '/media/hdd2'),
                                     ('/media/hdd3', '/media/hdd3'),
                                     ('/media/usb', '/media/usb'),
                                     ('/media/usb2', '/media/usb2'),
                                     ('/media/usb3', '/media/usb3'),
                                     ('/media/mmc', '/media/mmc'),
                                     ('/media/mmc2', '/media/mmc2'),
                                     ('/media/mmc3', '/media/mmc3'),
                                     ('/usr', '/usr')]))
        if dtype == 'Linux':
            dtype = 'ext3'
        else:
            dtype = 'auto'
        item.value = d1.strip()
        text = name + ' ' + des + ' /dev/' + device
        res = getConfigListEntry(text, item, device, dtype)

        if des != '' and self.list.append(res):
            pass
Example #57
0
from os import urandom as os_urandom

###################################################

###################################################
# E2 GUI COMMPONENTS
###################################################

###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.ekstraklasa_defaultformat = ConfigSelection(
    default="450",
    choices=[("0", "bitrate: najgorszy"), ("200", "bitrate: 200p"),
             ("450", "bitrate: 450p"), ("900", "bitrate: 900"),
             ("1800", "bitrate: 1800"), ("9999", "bitrate: najlepszy")])
config.plugins.iptvplayer.ekstraklasa_usedf = ConfigYesNo(default=False)
config.plugins.iptvplayer.ekstraklasa_proxy = ConfigYesNo(default=False)


def GetConfigList():
    optionList = []
    optionList.append(
        getConfigListEntry(
            "Domyślny format video:",
            config.plugins.iptvplayer.ekstraklasa_defaultformat))
    optionList.append(
        getConfigListEntry("Używaj domyślnego format video:",
                           config.plugins.iptvplayer.ekstraklasa_usedf))
Example #58
0
import re
from Components.config import config, ConfigText, ConfigSelection, getConfigListEntry
###################################################

###################################################
# E2 GUI COMMPONENTS
###################################################
from Screens.MessageBox import MessageBox
###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.mediayou_language = ConfigSelection(
    default="pol",
    choices=[("pol", _("Polish")), ("eng", _("English")),
             ("ger", _("Deutsch")), ("rus", _("Russian")),
             ("ita", _("Italian")), ("fre", _("French"))])


def GetConfigList():
    optionList = []
    optionList.append(
        getConfigListEntry(_("Language"),
                           config.plugins.iptvplayer.mediayou_language))
    return optionList


###################################################

Example #59
0
session = None
ElektroWakeUpTime = -1
elektro_pluginversion = "3.4.5b"
elektrostarttime = 60
elektrosleeptime = 5
elektroShutdownThreshold = 60 * 20
###############################################################################

#Configuration
if debug:
    print pluginPrintname, "Setting config defaults"
config.plugins.elektro = ConfigSubsection()
config.plugins.elektro.nextday = ConfigClock(default=((6 * 60 + 0) * 60))
config.plugins.elektro.nextday2 = ConfigClock(default=((6 * 60 + 0) * 60))
config.plugins.elektro.profile = ConfigSelection(choices=[("1", "Profile 1"),
                                                          ("2", "Profile 2")],
                                                 default="1")
config.plugins.elektro.profileShift = ConfigYesNo(default=False)

config.plugins.elektro.sleep = ConfigSubDict()
for i in range(7):
    config.plugins.elektro.sleep[i] = ConfigClock(default=((1 * 60 + 0) * 60))

config.plugins.elektro.wakeup = ConfigSubDict()
for i in range(7):
    config.plugins.elektro.wakeup[i] = ConfigClock(default=((9 * 60 + 0) * 60))

config.plugins.elektro.sleep2 = ConfigSubDict()
for i in range(7):
    config.plugins.elektro.sleep2[i] = ConfigClock(default=((1 * 60 + 0) * 60))
def InitOsd():
    SystemInfo["CanChange3DOsd"] = (access('/proc/stb/fb/3dmode', R_OK)
                                    or access('/proc/stb/fb/primary/3d',
                                              R_OK)) and True or False

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

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

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

    config.osd.threeDmode.addNotifier(set3DMode)

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

    config.osd.threeDznorm.addNotifier(set3DZnorm)