本文整理汇总了Python中Components.config.ConfigYesNo.getValue方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigYesNo.getValue方法的具体用法?Python ConfigYesNo.getValue怎么用?Python ConfigYesNo.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.config.ConfigYesNo
的用法示例。
在下文中一共展示了ConfigYesNo.getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InstallWizard
# 需要导入模块: from Components.config import ConfigYesNo [as 别名]
# 或者: from Components.config.ConfigYesNo import getValue [as 别名]
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
示例2: FastScanScreen
# 需要导入模块: from Components.config import ConfigYesNo [as 别名]
# 或者: from Components.config.ConfigYesNo import getValue [as 别名]
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]),
#.........这里部分代码省略.........
示例3: ScanSetup
# 需要导入模块: from Components.config import ConfigYesNo [as 别名]
# 或者: from Components.config.ConfigYesNo import getValue [as 别名]
class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
def __init__(self, session):
Screen.__init__(self, session)
Screen.setTitle(self, _("Manual Scan"))
self.finished_cb = None
self.updateSatList()
self.service = session.nav.getCurrentService()
self.feinfo = None
self.networkid = 0
frontendData = None
if self.service is not None:
self.feinfo = self.service.frontendInfo()
frontendData = self.feinfo and self.feinfo.getAll(True)
self.createConfig(frontendData)
del self.feinfo
del self.service
self.session.postScanService = session.nav.getCurrentlyPlayingServiceOrGroup()
self["key_red"] = StaticText(_("Close"))
self["key_green"] = StaticText(_("Scan"))
self["actions"] = NumberActionMap(["SetupActions", "MenuActions", "ColorActions"],
{
"ok": self.keyGo,
"save": self.keyGo,
"cancel": self.keyCancel,
"red": self.keyCancel,
"green": self.keyGo,
"menu": self.doCloseRecursive,
}, -2)
self.statusTimer = eTimer()
self.statusTimer.callback.append(self.updateStatus)
#self.statusTimer.start(5000, True)
self.list = []
ConfigListScreen.__init__(self, self.list)
self["header"] = Label(_("Manual Scan"))
if not self.scan_nims.getValue() == "":
self.createSetup()
self["introduction"] = Label(_("Press OK to start the scan"))
else:
self["introduction"] = Label(_("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."))
def runAsync(self, finished_cb):
self.finished_cb = finished_cb
self.keyGo()
def updateSatList(self):
self.satList = []
for slot in nimmanager.nim_slots:
if slot.isCompatible("DVB-S"):
self.satList.append(nimmanager.getSatListForNim(slot.slot))
else:
self.satList.append(None)
def createSetup(self):
self.list = []
self.multiscanlist = []
index_to_scan = int(self.scan_nims.getValue())
print "ID: ", index_to_scan
self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
self.list.append(self.tunerEntry)
if self.scan_nims == [ ]:
return
self.typeOfScanEntry = None
self.systemEntry = None
self.modulationEntry = None
nim = nimmanager.nim_slots[index_to_scan]
if nim.isCompatible("DVB-S"):
self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_type)
self.list.append(self.typeOfScanEntry)
elif nim.isCompatible("DVB-C"):
self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typecable)
self.list.append(self.typeOfScanEntry)
elif nim.isCompatible("DVB-T"):
self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typeterrestrial)
self.list.append(self.typeOfScanEntry)
self.scan_networkScan.setValue(False)
if nim.isCompatible("DVB-S"):
if self.scan_type.getValue() == "single_transponder":
self.updateSatList()
if nim.isCompatible("DVB-S2"):
self.systemEntry = getConfigListEntry(_('System'), self.scan_sat.system)
self.list.append(self.systemEntry)
else:
# downgrade to dvb-s, in case a -s2 config was active
self.scan_sat.system.setValue(eDVBFrontendParametersSatellite.System_DVB_S)
self.list.append(getConfigListEntry(_('Satellite'), self.scan_satselection[index_to_scan]))
self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
self.list.append(getConfigListEntry(_('Symbol rate'), self.scan_sat.symbolrate))
#.........这里部分代码省略.........
示例4: DiseqcTesterTestTypeSelection
# 需要导入模块: from Components.config import ConfigYesNo [as 别名]
# 或者: from Components.config.ConfigYesNo import getValue [as 别名]
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
示例5: FastScanScreen
# 需要导入模块: from Components.config import ConfigYesNo [as 别名]
# 或者: from Components.config.ConfigYesNo import getValue [as 别名]
#.........这里部分代码省略.........
pol = 2
elif pol == "R":
pol = 3
self.polarization = pol # 0 - H, 1 - V, 2- CL, 3 - CR
if fec == "Auto":
fec = 0
elif fec == "1/2":
fec = 1
elif fec == "2/3":
fec = 2
elif fec == "3/4":
fec = 3
elif fec == "3/5":
fec = 4
elif fec == "4/5":
fec = 5
elif fec == "5/6":
fec = 6
elif fec == "7/8":
fec = 7
elif fec == "8/9":
fec = 8
elif fec == "9/10":
fec = 9
self.fec = fec # 0 - Auto, 1 - 1/2, 2 - 2/3, 3 - 3/4, 4 - 3/5, 5 - 4/5, 6 - 5/6, 7 - 7/8, 8 - 8/9 , 9 - 9/10,
self.inversion = 2 # 0 - off, 1 -on, 2 - AUTO
self.orbpos = orbpos
if system == "DVBS":
system = 0
elif system == "DVBS2":
system = 1
self.system = system # DVB-S = 0, DVB-S2 = 1
if modulation == "QPSK":
modulation = 0
elif modulation == "8PSK":
modulation = 1
self.modulation = modulation # 0- QPSK, 1 -8PSK
self.rolloff = 0 #
self.pilot = 2 # 0 - off, 1 - on 2 - AUTO
print "add sat transponder"
self.addSatTransponder(tlist, int(self.frequency),
int(self.symbolrate),
int(self.polarization),
int(fec),
int(self.inversion),
int(orbpos),
int(self.system),
int(self.modulation),
int(self.rolloff),
int(self.pilot))
self.session.open(ServiceScan, [{"transponders": tlist, "feid": int(self.scan_nims.getValue()), "flags": 0, "networkid": 0}])
def keyGo(self):
prov = self.scan_provider.value.lower()
if prov == "tricolor" or prov == "kontinent" or prov == "telekarta" or prov == "ntvplus" or prov == "raduga":
self.readXML(self.scan_provider.value.lower())
else:
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]),
scanPid = pid, keepNumbers = self.scan_keepnumbering.getValue(), keepSettings = self.scan_keepsettings.getValue(),
providerName = self.scan_provider.getText())
def keyCancel(self):
self.close()
示例6: FastScanScreen
# 需要导入模块: from Components.config import ConfigYesNo [as 别名]
# 或者: from Components.config.ConfigYesNo import getValue [as 别名]
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()