예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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,
        )
예제 #4
0
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)
예제 #5
0
    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
        )
예제 #6
0
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)
예제 #7
0
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):
        from Components.ParentalControl import parentalControl
        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()
예제 #8
0
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()