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


Python ParentalControlList.toggleSelectedLock方法代码示例

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


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

示例1: ParentalControlBouquetEditor

# 需要导入模块: from Components.ParentalControlList import ParentalControlList [as 别名]
# 或者: from Components.ParentalControlList.ParentalControlList import toggleSelectedLock [as 别名]
class ParentalControlBouquetEditor(Screen):
	#This new class allows adding complete bouquets to black- and whitelists
	#The servicereference that is stored for bouquets is their refstr as listed in bouquets.tv
	def __init__(self, session):
		Screen.__init__(self, session)
		self.skinName = "ParentalControlEditor"
		self.list = []
		self.bouquetslist = ParentalControlList(self.list)
		self["servicelist"] = self.bouquetslist;
		self.readBouquetList()
		self.onLayoutFinish.append(self.selectBouquet)

		self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"],
		{
			"ok": self.select,
			"cancel": self.cancel
		}, -1)

	def cancel(self):
		from Components.ParentalControl import parentalControl
		parentalControl.save()
		self.close()

	def select(self):
		self.bouquetslist.toggleSelectedLock()

	def readBouquetList(self):
		serviceHandler = eServiceCenter.getInstance()
		refstr = '1:134:1:0:0:0:0:0:0:0:FROM BOUQUET \"bouquets.tv\" ORDER BY bouquet'
		bouquetroot = eServiceReference(refstr)
		self.bouquetlist = {}
		list = serviceHandler.list(bouquetroot)
		if list is not None:
			self.bouquetlist = list.getContent("CN", True)
	
	def selectBouquet(self):
		from Components.ParentalControl import parentalControl
		self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0])) for x in self.bouquetlist]
		self.bouquetslist.setList(self.list)
开发者ID:4doe,项目名称:enigma2-old,代码行数:41,代码来源:ParentalControlSetup.py

示例2: ParentalControlEditor

# 需要导入模块: from Components.ParentalControlList import ParentalControlList [as 别名]
# 或者: from Components.ParentalControlList.ParentalControlList import toggleSelectedLock [as 别名]
class ParentalControlEditor(Screen):
    def __init__(self, session):
        Screen.__init__(self, session)
        self.list = []
        self.servicelist = ParentalControlList(self.list)
        self["servicelist"] = self.servicelist
        # self.onShown.append(self.chooseLetter)
        self.currentLetter = chr(SPECIAL_CHAR)
        self.readServiceList()
        self.chooseLetterTimer = eTimer()
        self.chooseLetterTimer.callback.append(self.chooseLetter)
        self.onLayoutFinish.append(self.LayoutFinished)

        self["actions"] = NumberActionMap(
            ["DirectionActions", "ColorActions", "OkCancelActions", "NumberActions"],
            {
                "ok": self.select,
                "cancel": self.cancel,
                # "left": self.keyLeft,
                # "right": self.keyRight,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
                "0": self.keyNumberGlobal,
            },
            -1,
        )

    def LayoutFinished(self):
        self.chooseLetterTimer.start(0, True)

    def cancel(self):
        self.chooseLetter()

    def select(self):
        self.servicelist.toggleSelectedLock()

    def keyNumberGlobal(self, number):
        pass

    def readServiceList(self):
        serviceHandler = eServiceCenter.getInstance()
        refstr = "%s ORDER BY name" % (service_types_tv)
        self.root = eServiceReference(refstr)
        self.servicesList = {}
        list = serviceHandler.list(self.root)
        if list is not None:
            services = list.getContent("CN", True)  # (servicecomparestring, name)
            for s in services:
                key = s[1].lower()[0]
                if key < "a" or key > "z":
                    key = chr(SPECIAL_CHAR)
                    # key = str(key)
                if not self.servicesList.has_key(key):
                    self.servicesList[key] = []
                self.servicesList[key].append(s)

    def chooseLetter(self):
        print "choose letter"
        mylist = []
        for x in self.servicesList.keys():
            if x == chr(SPECIAL_CHAR):
                x = (_("special characters"), x)
            else:
                x = (x, x)
            mylist.append(x)
        mylist.sort(key=itemgetter(1))
        sel = ord(self.currentLetter) - SPECIAL_CHAR
        self.session.openWithCallback(
            self.letterChosen, ChoiceBox, title=_("Show services beginning with"), list=mylist, keys=[], selection=sel
        )

    def letterChosen(self, result):
        if result is not None:
            print "result:", result
            self.currentLetter = result[1]
            # Replace getProtectionLevel by new getProtectionType
            self.list = [
                ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionType(x[0]))
                for x in self.servicesList[result[1]]
            ]
            self.servicelist.setList(self.list)
        else:
            parentalControl.save()
            self.close()
开发者ID:gusax,项目名称:enigma2mod,代码行数:93,代码来源:ParentalControlSetup.py


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