本文整理汇总了Python中Components.config.ConfigPIN.addEndNotifier方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigPIN.addEndNotifier方法的具体用法?Python ConfigPIN.addEndNotifier怎么用?Python ConfigPIN.addEndNotifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.config.ConfigPIN
的用法示例。
在下文中一共展示了ConfigPIN.addEndNotifier方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ParentalControlChangePin
# 需要导入模块: from Components.config import ConfigPIN [as 别名]
# 或者: from Components.config.ConfigPIN import addEndNotifier [as 别名]
class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen):
def __init__(self, session, pin, pinname):
Screen.__init__(self, session)
self.pin = pin
self.list = []
self.pin1 = ConfigPIN(default = 1111, censor = "*")
self.pin2 = ConfigPIN(default = 1112, censor = "*")
self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
self.list.append(getConfigListEntry(_("New pin"), NoSave(self.pin1)))
self.list.append(getConfigListEntry(_("Reenter new pin"), NoSave(self.pin2)))
ConfigListScreen.__init__(self, self.list)
# print "old pin:", pin
#if pin.value != "aaaa":
#self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.pin.value], title = _("please enter the old pin"), windowTitle = _("Change pin code")))
ProtectedScreen.__init__(self)
self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"],
{
"cancel": self.cancel,
}, -1)
def valueChanged(self, pin, value):
if pin == 1:
self["config"].setCurrentIndex(1)
elif pin == 2:
self.keyOK()
def getPinText(self):
return _("Please enter the old pin code")
def isProtected(self):
return (self.pin.value != "aaaa")
def protectedWithPin(self):
return self.pin.value
# def pinEntered(self, result):
#if result[0] is None:
#self.close()
#if not result[0]:
#print result, "-", self.pin.value
#self.session.openWithCallback(self.close, MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR)
def keyOK(self):
if self.pin1.value == self.pin2.value:
self.pin.value = self.pin1.value
self.pin.save()
self.session.openWithCallback(self.close, MessageBox, _("The pin code has been changed successfully."), MessageBox.TYPE_INFO)
else:
self.session.open(MessageBox, _("The pin codes you entered are different."), MessageBox.TYPE_ERROR)
def cancel(self):
self.close(None)
def keyNumberGlobal(self, number):
ConfigListScreen.keyNumberGlobal(self, number)
示例2: addEntry
# 需要导入模块: from Components.config import ConfigPIN [as 别名]
# 或者: from Components.config.ConfigPIN import addEndNotifier [as 别名]
def addEntry(self, list, entry):
if entry[0] == "TEXT": #handle every item (text / pin only?)
list.append( (entry[1], ConfigNothing(), entry[2]) )
if entry[0] == "PIN":
pinlength = entry[1]
if entry[3] == 1:
# masked pins:
x = ConfigPIN(0, len = pinlength, censor = "*")
else:
# unmasked pins:
x = ConfigPIN(0, len = pinlength)
x.addEndNotifier(self.pinEntered)
self["subtitle"].setText(entry[2])
list.append( getConfigListEntry("", x) )
self["bottom"].setText(_("please press OK when ready"))
示例3: addEntry
# 需要导入模块: from Components.config import ConfigPIN [as 别名]
# 或者: from Components.config.ConfigPIN import addEndNotifier [as 别名]
def addEntry(self, list, entry):
if entry[0] == 'TEXT':
list.append((entry[1], ConfigNothing(), entry[2]))
if entry[0] == 'PIN':
pinlength = entry[1]
pin = config.cipin.pin1.value
if len(str(config.cipin.pin1.value)) == 3:
pin = '0' + str(config.cipin.pin1.value)
pinlength = 4
if entry[3] == 1:
x = ConfigPIN(int(pin), len=pinlength, censor='*')
else:
x = ConfigPIN(int(pin), len=pinlength)
x.addEndNotifier(self.pinEntered)
self['subtitle'].setText(entry[2])
list.append(getConfigListEntry('', x))
self['bottom'].setText(_('please press OK when ready'))
if config.cipin.pin1autook.value:
self.okbuttonClick()
示例4: addEntry
# 需要导入模块: from Components.config import ConfigPIN [as 别名]
# 或者: from Components.config.ConfigPIN import addEndNotifier [as 别名]
def addEntry(self, list, entry):
if entry[0] == "TEXT": #handle every item (text / pin only?)
list.append( (entry[1], ConfigNothing(), entry[2]) )
if entry[0] == "PIN":
pinlength = entry[1]
pin = config.cipin.pin1.value
if len(str(config.cipin.pin1.value)) == 3:
pin = "0" + str(config.cipin.pin1.value)
pinlength = 4
if entry[3] == 1:
# masked pins:
x = ConfigPIN(int(pin), len = pinlength, censor = "*")
else:
# unmasked pins:
x = ConfigPIN(int(pin), len = pinlength)
x.addEndNotifier(self.pinEntered)
self["subtitle"].setText(entry[2])
list.append( getConfigListEntry("", x) )
self["bottom"].setText(_("please press OK when ready"))
if config.cipin.pin1autook.value:
self.okbuttonClick()
示例5: PermanentPinEntry
# 需要导入模块: from Components.config import ConfigPIN [as 别名]
# 或者: from Components.config.ConfigPIN import addEndNotifier [as 别名]
class PermanentPinEntry(Screen, ConfigListScreen):
def __init__(self, session, pin, pin_slot):
Screen.__init__(self, session)
self.skinName = ["ParentalControlChangePin", "Setup" ]
self.setup_title = _("Enter pin code")
self.onChangedEntry = [ ]
self.slot = pin_slot
self.pin = pin
self.list = []
self.pin1 = ConfigPIN(default = 0, censor = "*")
self.pin2 = ConfigPIN(default = 0, censor = "*")
self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
self.list.append(getConfigListEntry(_("Enter PIN"), NoSave(self.pin1)))
self.list.append(getConfigListEntry(_("Reenter PIN"), NoSave(self.pin2)))
ConfigListScreen.__init__(self, self.list)
self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"],
{
"cancel": self.cancel,
"red": self.cancel,
"save": self.keyOK,
}, -1)
self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("OK"))
self.onLayoutFinish.append(self.layoutFinished)
def layoutFinished(self):
self.setTitle(self.setup_title)
def valueChanged(self, pin, value):
if pin == 1:
self["config"].setCurrentIndex(1)
elif pin == 2:
self.keyOK()
def keyOK(self):
if self.pin1.value == self.pin2.value:
self.pin.value = self.pin1.value
self.pin.save()
self.session.openWithCallback(self.close, MessageBox, _("The PIN code has been saved successfully."), MessageBox.TYPE_INFO)
else:
self.session.open(MessageBox, _("The PIN codes you entered are different."), MessageBox.TYPE_ERROR)
def cancel(self):
self.close(None)
def keyNumberGlobal(self, number):
ConfigListScreen.keyNumberGlobal(self, number)
# 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
示例6: ParentalControlChangePin
# 需要导入模块: from Components.config import ConfigPIN [as 别名]
# 或者: from Components.config.ConfigPIN import addEndNotifier [as 别名]
class ParentalControlChangePin(Screen, ConfigListScreen, ProtectedScreen):
def __init__(self, session, pin, pinname):
Screen.__init__(self, session)
# for the skin: first try ParentalControlChangePin, then Setup, this allows individual skinning
self.skinName = ["ParentalControlChangePin", "Setup"]
self.setup_title = _("Change pin code")
self.onChangedEntry = []
self.pin = pin
self.list = []
self.pin1 = ConfigPIN(default=1111, censor="*")
self.pin2 = ConfigPIN(default=1112, censor="*")
self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
self.list.append(getConfigListEntry(_("New PIN"), NoSave(self.pin1)))
self.list.append(getConfigListEntry(_("Reenter new PIN"), NoSave(self.pin2)))
ConfigListScreen.__init__(self, self.list)
# print "old pin:", pin
# if pin.value != "aaaa":
# self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.pin.value], title = _("please enter the old pin"), windowTitle = _("Change pin code")))
ProtectedScreen.__init__(self)
self["actions"] = NumberActionMap(
["DirectionActions", "ColorActions", "OkCancelActions"],
{"cancel": self.cancel, "red": self.cancel, "save": self.keyOK},
-1,
)
self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("OK"))
self.onLayoutFinish.append(self.layoutFinished)
def layoutFinished(self):
self.setTitle(self.setup_title)
def valueChanged(self, pin, value):
if pin == 1:
self["config"].setCurrentIndex(1)
elif pin == 2:
self.keyOK()
def getPinText(self):
return _("Please enter the old PIN code")
def isProtected(self):
return self.pin.value != "aaaa"
def protectedWithPin(self):
return self.pin.value
# def pinEntered(self, result):
# if result[0] is None:
# self.close()
# if not result[0]:
# print result, "-", self.pin.value
# self.session.openWithCallback(self.close, MessageBox, _("The pin code you entered is wrong."), MessageBox.TYPE_ERROR)
def keyOK(self):
if self.pin1.value == self.pin2.value:
self.pin.value = self.pin1.value
self.pin.save()
self.session.openWithCallback(
self.close, MessageBox, _("The PIN code has been changed successfully."), MessageBox.TYPE_INFO
)
else:
self.session.open(MessageBox, _("The PIN codes you entered are different."), MessageBox.TYPE_ERROR)
def cancel(self):
self.close(None)
def keyNumberGlobal(self, number):
ConfigListScreen.keyNumberGlobal(self, number)
# 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
示例7: PermanentPinEntry
# 需要导入模块: from Components.config import ConfigPIN [as 别名]
# 或者: from Components.config.ConfigPIN import addEndNotifier [as 别名]
class PermanentPinEntry(Screen, ConfigListScreen):
def __init__(self, session, pin, pin_slot):
Screen.__init__(self, session)
self.skinName = ['ParentalControlChangePin', 'Setup']
self.setup_title = _('Enter pin code')
self.onChangedEntry = []
self.slot = pin_slot
self.pin = pin
self.list = []
self.pin1 = ConfigPIN(default=0, censor='*')
self.pin2 = ConfigPIN(default=0, censor='*')
self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
self.list.append(getConfigListEntry(_('Enter PIN'), NoSave(self.pin1)))
self.list.append(getConfigListEntry(_('Reenter PIN'), NoSave(self.pin2)))
ConfigListScreen.__init__(self, self.list)
self['actions'] = NumberActionMap(['DirectionActions', 'ColorActions', 'OkCancelActions'], {'cancel': self.cancel,
'red': self.cancel,
'save': self.keyOK}, -1)
self['key_red'] = StaticText(_('Cancel'))
self['key_green'] = StaticText(_('OK'))
self.onLayoutFinish.append(self.layoutFinished)
def layoutFinished(self):
self.setTitle(self.setup_title)
def valueChanged(self, pin, value):
if pin == 1:
self['config'].setCurrentIndex(1)
elif pin == 2:
self.keyOK()
def keyOK(self):
if self.pin1.value == self.pin2.value:
self.pin.value = self.pin1.value
self.pin.save()
self.session.openWithCallback(self.close, MessageBox, _('The PIN code has been saved successfully.'), MessageBox.TYPE_INFO)
else:
self.session.open(MessageBox, _('The PIN codes you entered are different.'), MessageBox.TYPE_ERROR)
def cancel(self):
self.close(None)
return
def keyNumberGlobal(self, number):
ConfigListScreen.keyNumberGlobal(self, number)
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