当前位置: 首页>>代码示例>>Python>>正文


Python config.ConfigYesNo类代码示例

本文整理汇总了Python中Components.config.ConfigYesNo的典型用法代码示例。如果您正苦于以下问题:Python ConfigYesNo类的具体用法?Python ConfigYesNo怎么用?Python ConfigYesNo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConfigYesNo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

	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.value = False
			config.misc.installwizard.ipkgloaded.value = 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 = {"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 = "19e")
			self.createMenu()
开发者ID:SIFTeam,项目名称:enigma2-old,代码行数:30,代码来源:InstallWizard.py

示例2: __init__

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

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

		self.session.postScanService = session.nav.getCurrentlyPlayingServiceOrGroup()

		self.list = []
		tlist = []

		known_networks = [ ]
		nims_to_scan = [ ]
		self.finished_cb = None

		for nim in nimmanager.nim_slots:
			# collect networks provided by this tuner

			need_scan = False
			networks = self.getNetworksForNim(nim)

			print "nim %d provides" % nim.slot, networks
			print "known:", known_networks

			# we only need to scan on the first tuner which provides a network.
			# this gives the first tuner for each network priority for scanning.
			for x in networks:
				if x not in known_networks:
					need_scan = True
					print x, "not in ", known_networks
					known_networks.append(x)

			# don't offer to scan nims if nothing is connected
			if not nimmanager.somethingConnected(nim.slot):
				need_scan = False

			if need_scan:
				nims_to_scan.append(nim)

		# we save the config elements to use them on keyGo
		self.nim_enable = [ ]

		if len(nims_to_scan):
			self.scan_clearallservices = ConfigSelection(default = "yes", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
			self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))

			for nim in nims_to_scan:
				nimconfig = ConfigYesNo(default = True)
				nimconfig.nim_index = nim.slot
				self.nim_enable.append(nimconfig)
				self.list.append(getConfigListEntry(_("Scan ") + nim.slot_name + " (" + nim.friendly_type + ")", nimconfig))

		ConfigListScreen.__init__(self, self.list)
		self["header"] = Label(_("Automatic scan"))
		self["footer"] = Label(_("Press OK to scan"))
开发者ID:zveyisoglu,项目名称:stbgui,代码行数:60,代码来源:ScanSetup.py

示例3: startservicescan

	def startservicescan(self, postScanService=None, wasinstandby=False):
		self.wasinstandby = wasinstandby
		self.postScanService = postScanService

		tlist = []
		known_networks = [ ]
		nims_to_scan = [ ]

		for nim in nimmanager.nim_slots:
			# collect networks provided by this tuner
			need_scan = False
			networks = self.getNetworksForNim(nim)

			# we only need to scan on the first tuner which provides a network.
			# this gives the first tuner for each network priority for scanning.
			for x in networks:
				if x not in known_networks:
					need_scan = True
					print x, "not in ", known_networks
					known_networks.append(x)

# 			print "nim %d provides" % nim.slot, networks
# 			print "known:", known_networks
#
			# don't offer to scan nims if nothing is connected
			if not nimmanager.somethingConnected(nim.slot):
				need_scan = False

			if need_scan:
				nims_to_scan.append(nim)

		# we save the config elements to use them on keyGo
		self.nim_enable = [ ]

		if len(nims_to_scan):
			for nim in nims_to_scan:
				nimconfig = ConfigYesNo(default = True)
				nimconfig.nim_index = nim.slot
				self.nim_enable.append(nimconfig)

		self.scanList = []
		self.known_networks = set()
		self.nim_iter=0
		self.buildTransponderList()
开发者ID:mcquaim,项目名称:oe-alliance-plugins,代码行数:44,代码来源:plugin.py

示例4: 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)
开发者ID:Tron3,项目名称:enigma2,代码行数:52,代码来源:plugin.py

示例5: InstallWizard

class InstallWizard(Screen, ConfigListScreen):

	STATE_UPDATE = 0
	STATE_CHOISE_CHANNELLIST = 1
# 	STATE_CHOISE_SOFTCAM = 2

	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.value = False
			config.misc.installwizard.ipkgloaded.value = 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 = {"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 = "19e")
			self.createMenu()
# 		elif self.index == self.STATE_CHOISE_SOFTCAM:
# 			self.enabled = ConfigYesNo(default = True)
# 			modes = {"cccam": _("default") + " (CCcam)", "scam": "scam"}
# 			self.softcam_type = ConfigSelection(choices = modes, default = "cccam")
# 			self.createMenu()

	def checkNetworkCB(self, data):
		if data < 3:
			config.misc.installwizard.hasnetwork.value = True
		self.createMenu()

	def checkNetworkLinkCB(self, retval):
		if retval:
			iNetwork.checkNetworkState(self.checkNetworkCB)
		else:
			self.createMenu()

	def createMenu(self):
		try:
			test = self.index
		except:
			return
		self.list = []
		if self.index == self.STATE_UPDATE:
			if config.misc.installwizard.hasnetwork.getValue():
				self.list.append(getConfigListEntry(_("Your internet connection is working (ip: %s)") % (self.ipConfigEntry.getText()), self.enabled))
			else:
				self.list.append(getConfigListEntry(_("Your receiver does not have an internet connection"), self.enabled))
		elif self.index == self.STATE_CHOISE_CHANNELLIST:
			self.list.append(getConfigListEntry(_("Install channel list"), self.enabled))
			if self.enabled.getValue():
				self.list.append(getConfigListEntry(_("Channel list type"), self.channellist_type))
# 		elif self.index == self.STATE_CHOISE_SOFTCAM:
# 			self.list.append(getConfigListEntry(_("Install softcam"), self.enabled))
# 			if self.enabled.getValue():
# 				self.list.append(getConfigListEntry(_("Softcam type"), self.softcam_type))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		if self.index == 0:
			return
		ConfigListScreen.keyLeft(self)
		self.createMenu()

	def keyRight(self):
		if self.index == 0:
			return
		ConfigListScreen.keyRight(self)
		self.createMenu()

	def run(self):
		if self.index == self.STATE_UPDATE:
			if config.misc.installwizard.hasnetwork.getValue():
				self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (updating packages)'), IpkgComponent.CMD_UPDATE)
		elif self.index == self.STATE_CHOISE_CHANNELLIST and self.enabled.getValue():
			self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (downloading channel list)'), IpkgComponent.CMD_REMOVE, {'package': 'enigma2-plugin-settings-henksat-' + self.channellist_type.value})
# 		elif self.index == self.STATE_CHOISE_SOFTCAM and self.enabled.getValue():
# 			self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (downloading softcam)'), IpkgComponent.CMD_INSTALL, {'package': 'enigma2-plugin-softcams-' + self.softcam_type.value})
		return
开发者ID:SIFTeam,项目名称:enigma2-old,代码行数:96,代码来源:InstallWizard.py

示例6: __init__

	def __init__(self, session, nimList):
		Screen.__init__(self, session)
		self.setTitle(_("Fast Scan"))

		self.providers = {}
		self.providers['Canal Digitaal'] = (1, 900, True)
		self.providers['TV Vlaanderen'] = (1, 910, True)
		self.providers['TéléSAT'] = (0, 920, True)
		self.providers['AustriaSat'] = (0, 950, False)
		self.providers['Skylink Czech Republic'] = (1, 30, False)
		self.providers['Skylink Slovak Republic'] = (1, 31, False)
		self.providers['TéléSAT Astra3'] = (1, 920, True)
		self.providers['AustriaSat Astra3'] = (1, 950, False)
		self.providers['Canal Digitaal Astra 1'] = (0, 900, True)
		self.providers['TV Vlaanderen  Astra 1'] = (0, 910, True)

		self.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))

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

		providerList = list(x[0] for x in sorted(self.providers.iteritems(), key = operator.itemgetter(1)))

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration:
			lastConfiguration = (nimList[0][0], providerList[0], True, True, 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.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"))
开发者ID:grantor,项目名称:enigma2,代码行数:66,代码来源:plugin.py

示例7: FastScanScreen

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

	def __init__(self, session, nimList):
		Screen.__init__(self, session)
		self.setTitle(_("Fast Scan"))

		self.providers = {}
		self.providers['Canal Digitaal'] = (1, 900, True)
		self.providers['TV Vlaanderen'] = (1, 910, True)
		self.providers['TéléSAT'] = (0, 920, True)
		self.providers['AustriaSat'] = (0, 950, False)
		self.providers['Skylink Czech Republic'] = (1, 30, False)
		self.providers['Skylink Slovak Republic'] = (1, 31, False)
		self.providers['TéléSAT Astra3'] = (1, 920, True)
		self.providers['AustriaSat Astra3'] = (1, 950, False)
		self.providers['Canal Digitaal Astra 1'] = (0, 900, True)
		self.providers['TV Vlaanderen  Astra 1'] = (0, 910, True)

		self.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))

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

		providerList = list(x[0] for x in sorted(self.providers.iteritems(), key = operator.itemgetter(1)))

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration:
			lastConfiguration = (nimList[0][0], providerList[0], True, True, 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.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"))

	def keyGo(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)`
		config.misc.fastscan.save()
		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]
		return transponderParameters

	def startScan(self):
		pid = self.providers[self.scan_provider.getValue()][1]
		if self.scan_hd.getValue() and self.providers[self.scan_provider.value][2]:
			pid += 1
		if self.scan_nims.value:
			self.session.open(FastScanStatus, scanTuner = int(self.scan_nims.getValue()),
				transponderParameters = self.getTransponderParameters(self.providers[self.scan_provider.getValue()][0]),
#.........这里部分代码省略.........
开发者ID:grantor,项目名称:enigma2,代码行数:101,代码来源:plugin.py

示例8: __init__

	def __init__(self, session, infobar):
		Screen.__init__(self, session)
		self.infobar = infobar or self.session.infobar
		self.wait = eTimer()
		self.wait.timeout.get().append(self.resyncSubtitles)
		self.service = self.session.nav.getCurrentlyPlayingServiceReference()
		servicepath = self.service and self.service.getPath()
		if servicepath and servicepath.startswith("/") and self.service.toString().startswith("1:"):
			info = eServiceCenter.getInstance().info(self.service)
			self.service_string = info and info.getInfoString(self.service, iServiceInformation.sServiceref)
		else:
			self.service_string = self.service.toString()
		self.center_dvb_subs = ConfigYesNo(default = (eDVBDB.getInstance().getFlag(eServiceReference(self.service_string)) & self.FLAG_CENTER_DVB_SUBS) and True)
		self.center_dvb_subs.addNotifier(self.setCenterDvbSubs)
		self["videofps"] = Label("")

		sub = self.infobar.selected_subtitle
		if sub[0] == 0:  # dvb
			menu = [
				getConfigMenuItem("config.subtitles.dvb_subtitles_yellow"),
				getConfigMenuItem("config.subtitles.dvb_subtitles_backtrans"),
				getConfigMenuItem("config.subtitles.dvb_subtitles_original_position"),
				(_("Center DVB subtitles"), self.center_dvb_subs),
				getConfigMenuItem("config.subtitles.subtitle_position"),
				getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"),
				getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"),
			]
		elif sub[0] == 1: # teletext
			menu = [
				getConfigMenuItem("config.subtitles.ttx_subtitle_colors"),
				getConfigMenuItem("config.subtitles.ttx_subtitle_original_position"),
				getConfigMenuItem("config.subtitles.subtitle_fontsize"),
				getConfigMenuItem("config.subtitles.subtitle_position"),
				getConfigMenuItem("config.subtitles.subtitle_rewrap"),
				getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
				getConfigMenuItem("config.subtitles.showbackground"),
				getConfigMenuItem("config.subtitles.subtitle_alignment"),
				getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"),
				getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"),
			]
		else: 		# pango
			menu = [
				getConfigMenuItem("config.subtitles.pango_subtitles_delay"),
				getConfigMenuItem("config.subtitles.pango_subtitle_colors"),
				getConfigMenuItem("config.subtitles.pango_subtitle_fontswitch"),
				getConfigMenuItem("config.subtitles.colourise_dialogs"),
				getConfigMenuItem("config.subtitles.subtitle_fontsize"),
				getConfigMenuItem("config.subtitles.subtitle_position"),
				getConfigMenuItem("config.subtitles.subtitle_alignment"),
				getConfigMenuItem("config.subtitles.subtitle_rewrap"),
				getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
				getConfigMenuItem("config.subtitles.showbackground"),
				getConfigMenuItem("config.subtitles.pango_subtitles_fps"),
			]
			self["videofps"].setText(_("Video: %s fps") % (self.getFps().rstrip(".000")))

		ConfigListScreen.__init__(self, menu, self.session, on_change = self.changedEntry)

		self["actions"] = NumberActionMap(["SetupActions"],
		{
			"cancel": self.cancel,
			"ok": self.ok,
		},-2)

		self.onLayoutFinish.append(self.layoutFinished)
开发者ID:rimasx,项目名称:enigma2,代码行数:65,代码来源:AudioSelection.py

示例9: QuickSubtitlesConfigMenu

class QuickSubtitlesConfigMenu(ConfigListScreen, Screen):

	FLAG_CENTER_DVB_SUBS = 2048

	def __init__(self, session, infobar):
		Screen.__init__(self, session)
		self.infobar = infobar or self.session.infobar
		self.wait = eTimer()
		self.wait.timeout.get().append(self.resyncSubtitles)
		self.service = self.session.nav.getCurrentlyPlayingServiceReference()
		servicepath = self.service and self.service.getPath()
		if servicepath and servicepath.startswith("/") and self.service.toString().startswith("1:"):
			info = eServiceCenter.getInstance().info(self.service)
			self.service_string = info and info.getInfoString(self.service, iServiceInformation.sServiceref)
		else:
			self.service_string = self.service.toString()
		self.center_dvb_subs = ConfigYesNo(default = (eDVBDB.getInstance().getFlag(eServiceReference(self.service_string)) & self.FLAG_CENTER_DVB_SUBS) and True)
		self.center_dvb_subs.addNotifier(self.setCenterDvbSubs)
		self["videofps"] = Label("")

		sub = self.infobar.selected_subtitle
		if sub[0] == 0:  # dvb
			menu = [
				getConfigMenuItem("config.subtitles.dvb_subtitles_yellow"),
				getConfigMenuItem("config.subtitles.dvb_subtitles_backtrans"),
				getConfigMenuItem("config.subtitles.dvb_subtitles_original_position"),
				(_("Center DVB subtitles"), self.center_dvb_subs),
				getConfigMenuItem("config.subtitles.subtitle_position"),
				getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"),
				getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"),
			]
		elif sub[0] == 1: # teletext
			menu = [
				getConfigMenuItem("config.subtitles.ttx_subtitle_colors"),
				getConfigMenuItem("config.subtitles.ttx_subtitle_original_position"),
				getConfigMenuItem("config.subtitles.subtitle_fontsize"),
				getConfigMenuItem("config.subtitles.subtitle_position"),
				getConfigMenuItem("config.subtitles.subtitle_rewrap"),
				getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
				getConfigMenuItem("config.subtitles.showbackground"),
				getConfigMenuItem("config.subtitles.subtitle_alignment"),
				getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"),
				getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"),
			]
		else: 		# pango
			menu = [
				getConfigMenuItem("config.subtitles.pango_subtitles_delay"),
				getConfigMenuItem("config.subtitles.pango_subtitle_colors"),
				getConfigMenuItem("config.subtitles.pango_subtitle_fontswitch"),
				getConfigMenuItem("config.subtitles.colourise_dialogs"),
				getConfigMenuItem("config.subtitles.subtitle_fontsize"),
				getConfigMenuItem("config.subtitles.subtitle_position"),
				getConfigMenuItem("config.subtitles.subtitle_alignment"),
				getConfigMenuItem("config.subtitles.subtitle_rewrap"),
				getConfigMenuItem("config.subtitles.subtitle_borderwidth"),
				getConfigMenuItem("config.subtitles.showbackground"),
				getConfigMenuItem("config.subtitles.pango_subtitles_fps"),
			]
			self["videofps"].setText(_("Video: %s fps") % (self.getFps().rstrip(".000")))

		ConfigListScreen.__init__(self, menu, self.session, on_change = self.changedEntry)

		self["actions"] = NumberActionMap(["SetupActions"],
		{
			"cancel": self.cancel,
			"ok": self.ok,
		},-2)

		self.onLayoutFinish.append(self.layoutFinished)

	def setCenterDvbSubs(self, configElement):
		if configElement.value:
			eDVBDB.getInstance().addFlag(eServiceReference(self.service_string), self.FLAG_CENTER_DVB_SUBS)
			config.subtitles.dvb_subtitles_centered.value = True
		else:
			eDVBDB.getInstance().removeFlag(eServiceReference(self.service_string), self.FLAG_CENTER_DVB_SUBS)
			config.subtitles.dvb_subtitles_centered.value = False

	def layoutFinished(self):
		if not self["videofps"].text:
			self.instance.resize(eSize(self.instance.size().width(), self["config"].l.getItemSize().height()*len(self["config"].getList()) + 10))

	def changedEntry(self):
		if self["config"].getCurrent() in [getConfigMenuItem("config.subtitles.pango_subtitles_delay"),getConfigMenuItem("config.subtitles.pango_subtitles_fps")]:
			self.wait.start(500, True)

	def resyncSubtitles(self):
		self.infobar.setSeekState(self.infobar.SEEK_STATE_PAUSE)
		self.infobar.setSeekState(self.infobar.SEEK_STATE_PLAY)

	def getFps(self):
		service = self.session.nav.getCurrentService()
		info = service and service.info()
		if not info:
			return ""
		fps = info.getInfo(iServiceInformation.sFrameRate)
		if fps > 0:
			return "%6.3f" % (fps/1000.)
		return ""

#.........这里部分代码省略.........
开发者ID:rimasx,项目名称:enigma2,代码行数:101,代码来源:AudioSelection.py

示例10: createConfig

	def createConfig(self, frontendData):
		defaultSat = {
			"orbpos": 192,
			"system": eDVBFrontendParametersSatellite.System_DVB_S,
			"frequency": 11836,
			"inversion": eDVBFrontendParametersSatellite.Inversion_Unknown,
			"symbolrate": 27500,
			"polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal,
			"fec": eDVBFrontendParametersSatellite.FEC_Auto,
			"fec_s2": eDVBFrontendParametersSatellite.FEC_9_10,
			"modulation": eDVBFrontendParametersSatellite.Modulation_QPSK }
		defaultCab = {
			"frequency": 466,
			"inversion": eDVBFrontendParametersCable.Inversion_Unknown,
			"modulation": eDVBFrontendParametersCable.Modulation_QAM64,
			"fec": eDVBFrontendParametersCable.FEC_Auto,
			"symbolrate": 6900,
			"system": eDVBFrontendParametersCable.System_DVB_C_ANNEX_A }
		defaultTer = {
			"frequency" : 466000,
			"inversion" : eDVBFrontendParametersTerrestrial.Inversion_Unknown,
			"bandwidth" : 7000000,
			"fechigh" : eDVBFrontendParametersTerrestrial.FEC_Auto,
			"feclow" : eDVBFrontendParametersTerrestrial.FEC_Auto,
			"modulation" : eDVBFrontendParametersTerrestrial.Modulation_Auto,
			"transmission_mode" : eDVBFrontendParametersTerrestrial.TransmissionMode_Auto,
			"guard_interval" : eDVBFrontendParametersTerrestrial.GuardInterval_Auto,
			"hierarchy": eDVBFrontendParametersTerrestrial.Hierarchy_Auto,
			"system": eDVBFrontendParametersTerrestrial.System_DVB_T,
			"plp_id": 0 }

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

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

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

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

		self.scan_nims = ConfigSelection(choices = nim_list)

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

#.........这里部分代码省略.........
开发者ID:TELE-TWIN,项目名称:enigma2-1,代码行数:101,代码来源:ScanSetup.py

示例11: FastScanScreen

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

    def __init__(self, session):
        Screen.__init__(self, session)
        self.setTitle(_("Fast Scan"))

        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.getValue()))
                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=True)
        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"))

    def keyGo(self):
        self.startScan()

    def startScan(self):
        pid = int(self.scan_provider.getValue())
        if self.scan_hd.getValue() and pid >= 900 and pid < 930:
            pid += 1
        if self.scan_nims.getValue():
            self.session.open(
                FastScanStatus,
                scanTuner=int(self.scan_nims.getValue()),
                scanPid=pid,
                keepNumbers=self.scan_keepnumbering.getValue(),
                keepSettings=self.scan_keepsettings.getValue(),
                providerName=self.scan_provider.getText(),
            )

    def keyCancel(self):
        self.close()
开发者ID:torac,项目名称:enigma2,代码行数:89,代码来源:plugin.py

示例12: DiseqcTesterTestTypeSelection

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)
		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.getValue()), loopssuccessful = int(self.loopssuccessful.getValue()), log = self.log.getValue())

	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
开发者ID:HasBahCa,项目名称:enigma2,代码行数:79,代码来源:plugin.py

示例13: FastScanScreen

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

	def __init__(self, session, nimList):
		Screen.__init__(self, session)
		self.setTitle(_("Fast Scan"))
		
		self.providers = {}
		
		#hacky way
		self.providers['Kontinent'] = (0, 900, True)
		self.providers['Ntvplus'] = (0, 900, True)
		self.providers['Raduga'] = (0, 900, True)
		self.providers['Telekarta'] = (0, 900, True)
		self.providers['Tricolor'] = (0, 900, True)
		
		#orgin
		self.providers['Canal Digitaal'] = (1, 900, True)
		self.providers['TV Vlaanderen'] = (1, 910, True)
		self.providers['TéléSAT'] = (0, 920, True)
		self.providers['AustriaSat'] = (0, 950, False)
		self.providers['Skylink Czech Republic'] = (1, 30, False)
		self.providers['Skylink Slovak Republic'] = (1, 31, False)
		self.providers['TéléSAT Astra3'] = (1, 920, True)
		self.providers['AustriaSat Astra3'] = (1, 950, False)
		self.providers['Canal Digitaal Astra 1'] = (0, 900, True)
		self.providers['TV Vlaanderen  Astra 1'] = (0, 910, True)
		
		self.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))

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

		providerList = list(x[0] for x in sorted(self.providers.iteritems(), key = operator.itemgetter(1)))

		lastConfiguration = eval(config.misc.fastscan.last_configuration.value)
		if not lastConfiguration:
			lastConfiguration = (nimList[0][0], providerList[0], True, True, 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.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"))


	def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation, rolloff, pilot):
		print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) + " rolloff" + str(rolloff) + " pilot" + str(pilot)
		print "orbpos: " + str(orbital_position)
		parm = eDVBFrontendParametersSatellite()
		parm.modulation = modulation
		parm.system = system
		parm.frequency = frequency * 1000
		parm.symbol_rate = symbol_rate * 1000
		parm.polarisation = polarisation
		parm.fec = fec
		parm.inversion = inversion
		parm.orbital_position = orbital_position
		parm.rolloff = rolloff
		parm.pilot = pilot
		tlist.append(parm)
		
#.........这里部分代码省略.........
开发者ID:Venom83,项目名称:openNFR-gui,代码行数:101,代码来源:plugin.py

示例14: __init__

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

		self.logfile			= open("/tmp/satscan.log", "w+", 0)
		self.executable			= None
		self.vuplus_quirks		= False

		for tryname in ("avl_azbox_blindscan", "avl_xtrend_blindscan", "vuplus_blindscan"):
			print "try:", tryname

			try:
				subprocess.check_call((tryname))
				self.executable = tryname
				break
			except OSError:
				print tryname + ": OSError"
				None
			except subprocess.CalledProcessError:
				# vuplus_blindscan returns -1 when called with no arguments
				print tryname + ": CalledProcessError"
				self.executable = tryname
				break

		print "executable = ", self.executable

		if self.executable == "vuplus_blindscan":
			self.vuplus_quirks = True

		self.scan_circular		= ConfigYesNo(default = False)
		self.scan_transponders	= ConfigYesNo(default = False)
		self.scan_clearservices	= ConfigYesNo(default = False)
		self.scan_fta			= ConfigYesNo(default = False)

		self.current_service		= self.session.nav.getCurrentlyPlayingServiceReference()
		self.all_pos_per_dvbs_nim	= []

		nimmanager.enumerateNIMs()

		for nim_slot in nimmanager.nim_slots:
			if nim_slot.isCompatible("DVB-S"):
				self.all_pos_per_dvbs_nim.append(nimmanager.getSatListForNim(nim_slot.slot))
			else:
				self.all_pos_per_dvbs_nim.append(None)

		#print "*** all_pos_per_dvbs_nim: ", self.all_pos_per_dvbs_nim

		self.current_orb_pos = 192
		current_service = self.session.nav.getCurrentService()

		if current_service is not None:
			feinfo = current_service.frontendInfo()
			if feinfo is not None:
				fedata = feinfo.getAll(True)
				if fedata.get("tuner_type", "UNKNOWN") == "DVB-S":
					self.current_orb_pos = fedata.get("orbital_position", 0);

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

		self.select_nim = ConfigSelection(choices = selectable_nims)

		self.positions_config_list = []
		for nim_slot in nimmanager.nim_slots:
			if nim_slot.isCompatible("DVB-S"):
				self.positions_config_list.append(getConfigSatlist(self.current_orb_pos, self.all_pos_per_dvbs_nim[nim_slot.slot]))

		self.config_list = []
		ConfigListScreen.__init__(self, self.config_list)

		if self.select_nim.value != None and self.select_nim.value != "" :
			self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "ColorActions" ],
			{
				"red":		self.keyCancel,
				"green":	self.keyGo,
				"ok":		self.keyGo,
				"cancel":	self.keyCancel,
			}, -2)

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

			if self.vuplus_quirks:
				disclaimer = _("WARNING! Blindscan may make the tuner malfunction on a VU+ receiver. A reboot afterwards may be required to return to proper tuner function.\n\n")
			else:
				disclaimer = ""

			self["text"] = Label(disclaimer + _("Press OK to start scanning"))

			self.FillConfigList()
		else:
#.........这里部分代码省略.........
开发者ID:E2OpenPlugins,项目名称:e2openplugin-Satscan,代码行数:101,代码来源:plugin.py

示例15: Satscan

class Satscan(ConfigListScreen, Screen):
	skin = 	"""
		<screen position="center,center" size="500,320" title="Satscan">
			<widget name="config"	position="0,0"		font="Regular;20" size="500,150" scrollbarMode="showOnDemand" />
			<widget name="text"		position="0,158"	font="Regular;20" size="500,120" halign="center" />

			<ePixmap pixmap="skin_default/buttons/red.png" position="0,278" size="140,40" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="150,278" size="140,40" alphatest="on" />

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

		</screen>
		"""

	def KeyNone(self):
		None

	def callbackNone(self, *retval):
		None

	def OpenFrontend(self):
		frontend = None
		resource_manager = eDVBResourceManager.getInstance()
		if resource_manager is None:
			print "get resource manager instance failed"
		else:
			self.raw_channel = resource_manager.allocateRawChannel(int(self.select_nim.value))

			if self.raw_channel is None:
				print "allocateRawChannel failed"
			else:
				frontend = self.raw_channel.getFrontend()
				if frontend is None:
					print "getFrontend failed"
		return(frontend)

	def GetI2CBusFromSlot(self, slot_number):
		self.i2c_mapping_table = [2, 3, 1, 0]

		i2cbus = nimmanager.getI2CDevice(slot_number)

		if i2cbus is not None and i2cbus >= 0:
			return i2cbus

		# hack for VU+
		if slot_number >= 0 and slot_number < 4:
			i2cbus = self.i2c_mapping_table[slot_number]
		else:
			i2cbus = -1

		return i2cbus

	def SelectedNimToList(self, selected):
		current		= 0
		disabled	= 0

		for all_dvbs_pos in self.all_pos_per_dvbs_nim:
			if self.all_pos_per_dvbs_nim[current] == None:
				disabled = disabled + 1
			if current == int(selected):
				return current - disabled
			current = current + 1
		return -1

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

		self.logfile			= open("/tmp/satscan.log", "w+", 0)
		self.executable			= None
		self.vuplus_quirks		= False

		for tryname in ("avl_azbox_blindscan", "avl_xtrend_blindscan", "vuplus_blindscan"):
			print "try:", tryname

			try:
				subprocess.check_call((tryname))
				self.executable = tryname
				break
			except OSError:
				print tryname + ": OSError"
				None
			except subprocess.CalledProcessError:
				# vuplus_blindscan returns -1 when called with no arguments
				print tryname + ": CalledProcessError"
				self.executable = tryname
				break

		print "executable = ", self.executable

		if self.executable == "vuplus_blindscan":
			self.vuplus_quirks = True

		self.scan_circular		= ConfigYesNo(default = False)
		self.scan_transponders	= ConfigYesNo(default = False)
		self.scan_clearservices	= ConfigYesNo(default = False)
		self.scan_fta			= ConfigYesNo(default = False)

		self.current_service		= self.session.nav.getCurrentlyPlayingServiceReference()
		self.all_pos_per_dvbs_nim	= []
#.........这里部分代码省略.........
开发者ID:E2OpenPlugins,项目名称:e2openplugin-Satscan,代码行数:101,代码来源:plugin.py


注:本文中的Components.config.ConfigYesNo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。