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


Python SelectionList.setList方法代码示例

本文整理汇总了Python中Components.SelectionList.SelectionList.setList方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionList.setList方法的具体用法?Python SelectionList.setList怎么用?Python SelectionList.setList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Components.SelectionList.SelectionList的用法示例。


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

示例1: LiveStreamingLinks

# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import setList [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()
#.........这里部分代码省略.........
开发者ID:et-plugins,项目名称:et-live-links,代码行数:103,代码来源:plugin.py

示例2: IPTVStreams

# 需要导入模块: from Components.SelectionList import SelectionList [as 别名]
# 或者: from Components.SelectionList.SelectionList import setList [as 别名]
class IPTVStreams(Screen):
    LIST_NAME = 0
    LIST_CAT = 1
    LIST_TYPE = 2
    LIST_URL = 3
    LEVEL_FILES = 0
    LEVEL_XML = 1
    DIR_ENIGMA2 = '/etc/enigma2/'
    url2 = 'http://et-live-links.googlecode.com/svn/trunk/'
    
    main1 = 'http://'
    main2 = 'livestream'
    main3 = '.et-view-support.com'
    main4 = '/testing/'
    
    skin = '''<screen position="c-300,c-210" size="600,420" title="">
	    <widget name="list" position="10,10" size="e-20,210" scrollbarMode="showOnDemand" />
	    <widget source="info" render="Label" position="10,250" size="e-20,80" halign="center" valign="top" font="Regular;17" />
	    <ePixmap pixmap="skin_default/buttons/green.png" position="c-150,e-45" size="140,40" alphatest="on" />
	    <ePixmap pixmap="skin_default/buttons/yellow.png" position="c-0,e-45" size="140,40" alphatest="on" />
	    <ePixmap pixmap="skin_default/buttons/red.png" position="c-300,e-45" size="140,40" alphatest="on" />
	    <widget source="key_green" render="Label" position="c-150,e-45" zPosition="1" size="140,40" font="Regular;16" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
	    <widget source="key_red" render="Label" position="c-300,e-45" zPosition="1" size="140,40" font="Regular;16" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
	    <widget source="key_yellow" render="Label" position="c-0,e-45" zPosition="1" size="140,40" font="Regular;16" halign="center" valign="center" backgroundColor="#a58b00" transparent="1" />
	    </screen>'''
    

    def __init__(self, session):
        self.skin = IPTVStreams.skin
        Screen.__init__(self, session)
        self['key_red'] = StaticText(_('Cancel'))
        self['key_yellow'] = StaticText(_('Change\nStreams'))
        self['key_green'] = StaticText(_('Download'))
        self['actions'] = ActionMap(['SetupActions', 'NumberActions', 'ColorActions'], {'ok': self.keyOk,
         'save': self.keyGo,
         'cancel': self.keyCancel,
         'yellow': self.changeMenu,
         '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 changeMenu(self):
        global STREAM
        if STREAM == 1:
            self.createTopMenu2()
        elif STREAM == 2:
            self.createTopMenu3()
        elif STREAM == 3:
            self.createTopMenu()

    def initSelectionList(self):
        list = []
        self.list.setList(list)

    def createTopMenu(self):
        global STREAM
        STREAM = 1
        self.setTitle(_('IPTV Streams'))
        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('Streamlinks 1')

    def createTopMenu2(self):
        global STREAM
        STREAM = 2
        self.setTitle(_('IPTV Streams'))
        self.initSelectionList()
        self.subMenuName = ''
        self.subMenuDescrName = ''
        self.level = self.LEVEL_FILES
        self.readMainXml2()
        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('Streamslinks 2')

    def createTopMenu3(self):
        global STREAM
        STREAM = 3
#.........这里部分代码省略.........
开发者ID:mcron,项目名称:enigma2,代码行数:103,代码来源:plugin.py


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