本文整理汇总了Python中Components.SelectionList.SelectionList.getSelectionsList方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionList.getSelectionsList方法的具体用法?Python SelectionList.getSelectionsList怎么用?Python SelectionList.getSelectionsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.SelectionList.SelectionList
的用法示例。
在下文中一共展示了SelectionList.getSelectionsList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CAidSelect
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
class CAidSelect(Screen):
skin = '\n\t\t<screen name="CAidSelect" position="center,center" size="450,440" title="select CAId\'s" >\n\t\t\t<ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />\n\t\t\t<ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />\n\t\t\t<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" />\n\t\t\t<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" />\n\t\t\t<widget name="list" position="5,50" size="440,330" scrollbarMode="showOnDemand" />\n\t\t\t<ePixmap pixmap="skin_default/div-h.png" position="0,390" zPosition="1" size="450,2" />\n\t\t\t<widget source="introduction" render="Label" position="0,400" size="450,40" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />\n\t\t</screen>'
def __init__(self, session, list, selected_caids):
Screen.__init__(self, session)
self.list = SelectionList()
self['list'] = self.list
for listindex in range(len(list)):
if find_in_list(selected_caids, list[listindex][0], 0):
self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True)
else:
self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False)
self['key_red'] = StaticText(_('Cancel'))
self['key_green'] = StaticText(_('Save'))
self['introduction'] = StaticText(_('Press OK to select/deselect a CAId.'))
self['actions'] = ActionMap(['ColorActions', 'SetupActions'], {'ok': self.list.toggleSelection,
'cancel': self.cancel,
'green': self.greenPressed,
'red': self.cancel}, -1)
self.onShown.append(self.setWindowTitle)
def setWindowTitle(self):
self.setTitle(_("select CAId's"))
def greenPressed(self):
list = self.list.getSelectionsList()
print list
self.close(list)
def cancel(self):
self.close()
示例2: IpkgInstaller
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
class IpkgInstaller(Screen):
def __init__(self, session, list):
Screen.__init__(self, session)
Screen.setTitle(self, _("IPK Installer"))
self.list = SelectionList()
self["list"] = self.list
for listindex in range(len(list)):
if not list[listindex].split('/')[-1].startswith('._'):
self.list.addSelection(list[listindex].split('/')[-1], list[listindex], listindex, False)
self["key_red"] = StaticText(_("Close"))
self["key_green"] = StaticText(_("Install"))
self["key_yellow"] = StaticText()
self["key_blue"] = StaticText(_("Invert"))
self["introduction"] = StaticText(_("Press OK to toggle the selection."))
self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
{
"ok": self.list.toggleSelection,
"cancel": self.close,
"red": self.close,
"green": self.install,
"blue": self.list.toggleAllSelection
}, -1)
def install(self):
list = self.list.getSelectionsList()
cmdList = []
for item in list:
cmdList.append((IpkgComponent.CMD_INSTALL, {"package": item[1]}))
self.session.open(Ipkg, cmdList=cmdList)
示例3: IpkgInstaller
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
class IpkgInstaller(Screen):
def __init__(self, session, list):
Screen.__init__(self, session)
Screen.setTitle(self, _('IPK Installer'))
self.list = SelectionList()
self['list'] = self.list
for listindex in range(len(list)):
if not list[listindex].split('/')[-1].startswith('._'):
self.list.addSelection(list[listindex].split('/')[-1], list[listindex], listindex, False)
self['key_red'] = StaticText(_('Close'))
self['key_green'] = StaticText(_('Install'))
self['key_yellow'] = StaticText()
self['key_blue'] = StaticText(_('Invert'))
self['introduction'] = StaticText(_('Press OK to toggle the selection.'))
self['actions'] = ActionMap(['OkCancelActions', 'ColorActions'], {'ok': self.list.toggleSelection,
'cancel': self.close,
'red': self.close,
'green': self.install,
'blue': self.list.toggleAllSelection}, -1)
def install(self):
list = self.list.getSelectionsList()
cmdList = []
for item in list:
cmdList.append((IpkgComponent.CMD_INSTALL, {'package': item[1]}))
self.session.open(Ipkg, cmdList=cmdList)
示例4: CAidSelect
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
class CAidSelect(Screen):
skin = """
<screen name="CAidSelect" position="center,120" size="820,520" title="select CAId'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="800,1" backgroundColor="grey" />
<widget name="list" position="10,55" size="800,420" enableWrapAround="1" scrollbarMode="showOnDemand" />
<eLabel position="10,480" size="800,1" backgroundColor="grey" />
<widget source="introduction" render="Label" position="10,488" size="800,25" font="Regular;22" halign="center" />
</screen>"""
def __init__(self, session, list, selected_caids):
Screen.__init__(self, session)
self.list = SelectionList()
self["list"] = self.list
for listindex in range(len(list)):
if find_in_list(selected_caids,list[listindex][0],0):
self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True)
else:
self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False)
self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("Save"))
self["introduction"] = StaticText(_("Press OK to select/deselect a CAId."))
self["actions"] = ActionMap(["ColorActions","SetupActions"],
{
"ok": self.list.toggleSelection,
"cancel": self.cancel,
"green": self.greenPressed,
"red": self.cancel
}, -1)
self.onShown.append(self.setWindowTitle)
def setWindowTitle(self):
self.setTitle(_("select CAId's"))
def greenPressed(self):
list = self.list.getSelectionsList()
print list
self.close(list)
def cancel(self):
self.close()
示例5: CAidSelect
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
class CAidSelect(Screen):
skin = """
<screen name="CAidSelect" position="center,center" size="450,440" title="select CAId's" >
<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" />
<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" />
<widget name="list" position="5,50" size="440,330" scrollbarMode="showOnDemand" />
<ePixmap pixmap="div-h.png" position="0,390" zPosition="1" size="450,2" />
<widget source="introduction" render="Label" position="0,400" size="450,40" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
</screen>"""
def __init__(self, session, list, selected_caids):
Screen.__init__(self, session)
self.list = SelectionList()
self["list"] = self.list
for listindex in range(len(list)):
if find_in_list(selected_caids,list[listindex][0],0):
self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True)
else:
self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False)
self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("Save"))
self["introduction"] = StaticText(_("Press OK to select/deselect a CAId."))
self["actions"] = ActionMap(["ColorActions","SetupActions"],
{
"ok": self.list.toggleSelection,
"cancel": self.cancel,
"green": self.greenPressed,
"red": self.cancel
}, -1)
self.onShown.append(self.setWindowTitle)
def setWindowTitle(self):
self.setTitle(_("select CAId's"))
def greenPressed(self):
list = self.list.getSelectionsList()
self.close(list)
def cancel(self):
self.close()
示例6: LiveStreamingLinks
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
class LiveStreamingLinks(Screen):
LIST_NAME = 0
LIST_CAT = 1
LIST_TYPE = 2
LIST_URL = 3
LEVEL_FILES = 0
LEVEL_XML = 1
DIR_ENIGMA2 = '/etc/enigma2/'
URL_BASE = 'http://et-live-links.googlecode.com/svn/trunk/'
skin = """
<screen position="c-300,c-210" size="600,420" title="">
<widget name="list" position="10,10" size="e-20,205" scrollbarMode="showOnDemand" />
<widget source="info" render="Label" position="10,215" size="e-20,200" halign="center" valign="top" font="Regular;17" />
<ePixmap pixmap="skin_default/buttons/red.png" position="c-150,e-45" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/green.png" position="c-0,e-45" size="140,40" alphatest="on" />
<widget source="key_red" render="Label" position="c-150,e-45" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
<widget source="key_green" render="Label" position="c-0,e-45" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
</screen>"""
def __init__(self, session):
self.skin = LiveStreamingLinks.skin
Screen.__init__(self, session)
self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("Download"))
self["actions"] = ActionMap(["SetupActions", "ColorActions"],
{
"ok": self.keyOk,
"save": self.keyGo,
"cancel": self.keyCancel,
"green": self.keyGo,
"red": self.keyCancel,
}, -2)
self.list = SelectionList()
self["list"] = self.list
self["info"] = StaticText("")
self.doExit = False
self.level = self.LEVEL_FILES
self.subMenuName = ''
self.subMenuDescrName = ''
self.xmlFiles = []
self.xmlCategories = []
self.lastchanged = ''
self.lastchanges = ''
self.onLayoutFinish.append(self.createTopMenu)
def initSelectionList(self):
list = []
self.list.setList(list)
def createTopMenu(self):
self.setTitle(_("ET-Livestream importer"))
self.initSelectionList()
self.subMenuName = ''
self.subMenuDescrName = ''
self.level = self.LEVEL_FILES
self.readMainXml()
count = 0
for x in self.xmlFiles:
self.list.addSelection(x[self.LIST_CAT], x[self.LIST_NAME], count, False)
count += 1
self["info"].setText("")
def readXmlSubFile(self, fileName, descrName):
self.initSelectionList()
self.xmlList = []
self.subMenuName = fileName
self.subMenuDescrName = descrName
self.level = self.LEVEL_XML
self.readChannelXml(self.xmlList, fileName)
tmp = _('Last update') + ': %s\n\n%s' % (self.lastchanged, self.lastchanges)
self["info"].setText(tmp)
count = 0
for x in self.xmlCategories:
self.list.addSelection(x, x, count, False)
count += 1
def keyOk(self):
if self.level == self.LEVEL_FILES:
self.keyGo()
elif self.level == self.LEVEL_XML:
if len(self.xmlCategories) > 0:
self.list.toggleSelection()
def keyGo(self):
if self.level == self.LEVEL_FILES:
self.readXmlSubFile(self.xmlFiles[self.list.getSelectedIndex()][self.LIST_NAME], self.xmlFiles[self.list.getSelectedIndex()][self.LIST_CAT])
return
self.doExit = False
tmpList = []
tmpList = self.list.getSelectionsList()
if len(tmpList) == 0:
self.session.openWithCallback(self.infoCallback, MessageBox, _("Nothing selected"), MessageBox.TYPE_INFO)
return
self.xmlList.sort()
#.........这里部分代码省略.........
示例7: StreamingChannelFromServerScreen
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
#.........这里部分代码省略.........
prefix = '%s%s.' % (RCSC_PREFIX, self.getRemoteAdress().replace('.', '_'))
self.removeFiles(DIR_ENIGMA2, prefix)
fp = open(target, 'w')
try:
fp2 = open(source)
lines = fp2.readlines()
fp2.close()
for line in lines:
if prefix not in line:
tmpFile.append(line)
fp.write(line)
for item in self.workList:
if typestr in item:
tmp = matchstr + item + '" ORDER BY bouquet\n'
match = False
for x in tmpFile:
if tmp in x:
match = True
if match is not True:
fp.write(tmp)
fp.close()
self.copyFile(target, source)
except:
pass
def keyGreen(self):
if not self.hasFiles:
return
self.workList = []
tmpList = []
tmpList = self.list.getSelectionsList()
if len(tmpList) == 0:
self['statusbar'].setText(_('No bouquets selected'))
return
for item in tmpList:
self.workList.append(item[1])
fileValid = False
state = 0
fp = open(DIR_TMP + 'tmp_lamedb', 'w')
try:
fp2 = open(DIR_ENIGMA2 + 'lamedb')
lines = fp2.readlines()
fp2.close()
for line in lines:
if 'eDVB services' in line:
fileValid = True
if state == 0:
if 'transponders' in line[:12]:
fp.write(line)
elif 'end' in line[:3]:
self.getTransponders(fp)
state = 1
else:
fp.write(line)
elif state == 1:
if 'services' in line[:8]:
fp.write(line)
elif 'end' in line[:3]:
self.getServices(fp)
state = 2
else:
fp.write(line)
示例8: IPTVStreams
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
#.........这里部分代码省略.........
count = 0
for x in self.xmlCategories:
self.list.addSelection(x, x, count, False)
count += 1
def wgetUrl2(self, url2):
std_headers = {'User-Agent': 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.6) Gecko/20100627 Firefox/3.6.6',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-us,en;q=0.5'}
outtxt = Request(url2, None, std_headers)
try:
outtxt = urlopen(url2).read()
except (URLError, HTTPException) as err:
return ''
return outtxt
def keyOk(self):
if self.level == self.LEVEL_FILES:
print 'in Keyok 1'
self.keyGo()
elif self.level == self.LEVEL_XML:
print 'in Keyok 2'
if len(self.xmlCategories) > 0:
self.list.toggleSelection()
def keyGo(self):
if self.level == self.LEVEL_FILES:
self.readXmlSubFile(self.xmlFiles[self.list.getSelectedIndex()][self.LIST_NAME], self.xmlFiles[self.list.getSelectedIndex()][self.LIST_CAT])
return
self.doExit = False
tmpList = []
tmpList = self.list.getSelectionsList()
if len(tmpList) == 0:
self.session.openWithCallback(self.infoCallback, MessageBox, _('Nothing selected'), MessageBox.TYPE_INFO)
return
self.xmlList.sort()
tvFileList = []
radioFileList = []
for item in tmpList:
if self.createUserBouquetFile(item[1], 'tv') > 0:
tvFileList.append(item[1])
if self.createUserBouquetFile(item[1], 'radio') > 0:
radioFileList.append(item[1])
if len(tvFileList) > 0:
self.createBouquetFile(tvFileList, 'tv')
if len(radioFileList) > 0:
self.createBouquetFile(radioFileList, 'radio')
db = eDVBDB.getInstance()
db.reloadServicelist()
db.reloadBouquets()
self.doExit = True
self.session.openWithCallback(self.infoCallback, MessageBox, _('Successfully Imported:\nChannels Now Available in your bouquet/Favorite list'), MessageBox.TYPE_INFO)
def infoCallback(self, confirmed):
if self.doExit:
self.createTopMenu()
def createBouquetFile(self, catNames, fileType):
newFileContent = ''
fileContent = self.readFile(self.DIR_ENIGMA2 + 'bouquets.' + fileType)
if fileContent == '':
return
for x in fileContent:
示例9: StreamingChannelFromServerScreen
# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import getSelectionsList [as 别名]
#.........这里部分代码省略.........
if item in x:
return True
return False
def createBouquetFile(self, target, source, matchstr, typestr):
tmpFile = []
fp = open(target, 'w')
try:
lines = open(source).readlines()
for line in lines:
tmpFile.append(line)
fp.write(line)
for item in self.workList:
if typestr in item:
if self.checkBouquetAllreadyInList(typestr, item) is True:
item = item.replace('userbouquet.', 'userbouquet.remote_')
tmp = matchstr + item + '\" ORDER BY bouquet\n'
match = False
for x in tmpFile:
if tmp in x:
match = True
if match is not True:
fp.write(tmp)
fp.close()
self.copyFile(target, source)
except:
pass
def keyGreen(self):
if not self.hasFiles:
return
self.workList = []
tmpList = []
tmpList = self.list.getSelectionsList()
if len(tmpList) == 0:
self["statusbar"].setText(_("No bouquets selected"))
return
for item in tmpList:
self.workList.append(item[1])
fileValid = False
state = 0
fp = open(DIR_TMP + 'tmp_lamedb', 'w')
try:
lines = open(DIR_ENIGMA2 + 'lamedb').readlines()
for line in lines:
if 'eDVB services' in line:
fileValid = True
if state == 0:
if 'transponders' in line[:12]:
fp.write(line)
elif 'end' in line[:3]:
self.getTransponders(fp)
state = 1
else:
fp.write(line)
elif state == 1:
if 'services' in line[:8]:
fp.write(line)
elif 'end' in line[:3]:
self.getServices(fp)
state = 2
else:
fp.write(line)
elif state == 2:
fp.write(line)
except: