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


Python Settings.getPinLength方法代码示例

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


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

示例1: setUserPin

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getPinLength [as 别名]
def setUserPin(pinId):
    # Prompt the user for the pin
    numberpad = NumberPad.createNumberPad(32106)
    numberpad.doModal()

    # Get the code that the user entered
    enteredPin = numberpad.getPin()
    del numberpad

    # Check to ensure the user has either set no password or one the correct length
    if (len(enteredPin) > 0) and (Settings.getPinLength() > len(enteredPin)):
        log("SetPin: Incorrect length pin entered, expecting %d digits" % Settings.getPinLength())
        xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32109).encode('utf-8'))
    elif Settings.checkUserPinClash(enteredPin, pinId):
        # This pin clashes with an existing pin
        log("SetPin: Entered pin clashes with an existing pin")
        xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32112).encode('utf-8'))
    else:
        # Now double check the value the user entered
        numberpad = NumberPad.createNumberPad(32107)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin2 = numberpad.getPin()
        del numberpad

        if enteredPin == enteredPin2:
            Settings.setUserPinValue(enteredPin, pinId)
        else:
            log("SetPin: Pin entry different, first: %s, second %s" % (enteredPin, enteredPin2))
            xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32108).encode('utf-8'))
开发者ID:Stevie-Bs,项目名称:repository.xvbmc,代码行数:33,代码来源:setpin.py

示例2: setPin

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getPinLength [as 别名]
def setPin(pinLevel=1):
    okToChangePin = True

    # Check if the pin is already set, if it is, then we need to prompt for that first
    # before we allow the user to just change it
    if Settings.isPinSet(pinLevel):
        log("SetPin: Existing pin set, prompting for it")
        # Prompt the user for the pin
        numberpad = NumberPad.createNumberPad(32105)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        if not Settings.isPinCorrect(enteredPin, pinLevel):
            log("SetPin: Incorrect Existing Pin Entered")
            okToChangePin = False
            xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32104).encode('utf-8'))
        else:
            log("SetPin: Correct Existing Pin Entered")

    # If we are OK to change the pin, prompt the user
    if okToChangePin:
        # Prompt the user for the pin
        numberpad = NumberPad.createNumberPad(32106)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        # Check to ensure the user has either set no password or one the correct length
        if (len(enteredPin) > 0) and (Settings.getPinLength() > len(enteredPin)):
            log("SetPin: Incorrect length pin entered, expecting %d digits" % Settings.getPinLength())
            xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32109).encode('utf-8'))
        elif Settings.checkPinClash(enteredPin, pinLevel):
            # This pin clashes with an existing pin
            log("SetPin: Entered pin clashes with an existing pin")
            xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32112).encode('utf-8'))
        else:
            # Now double check the value the user entered
            numberpad = NumberPad.createNumberPad(32107)
            numberpad.doModal()

            # Get the code that the user entered
            enteredPin2 = numberpad.getPin()
            del numberpad

            if enteredPin == enteredPin2:
                Settings.setPinValue(enteredPin, pinLevel)
            else:
                log("SetPin: Pin entry different, first: %s, second %s" % (enteredPin, enteredPin2))
                xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32108).encode('utf-8'))
开发者ID:Stevie-Bs,项目名称:repository.xvbmc,代码行数:56,代码来源:setpin.py

示例3: _numberEntered

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getPinLength [as 别名]
    def _numberEntered(self, numValue):
        log("NumberPad: Entered number %d" % numValue)
        self.code += str(numValue)
        # Sets the correct number of stars on the display
        self.stars = self.stars + "*"
        self.getControl(4).setLabel(self.stars)

        # Check if we have 4 numbers, if we do, then we can close the dialog
        # automatically
        if len(self.code) == Settings.getPinLength():
            self.close()
开发者ID:MrMC,项目名称:script.pinsentry,代码行数:13,代码来源:numberpad.py

示例4: log

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getPinLength [as 别名]
            xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32104).encode('utf-8'))
        else:
            log("SetPin: Correct Existing Pin Entered")

    # If we are OK to change the pin, prompt the user
    if okToChangePin:
        # Prompt the user for the pin
        numberpad = NumberPad.createNumberPad(32106)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        # Check to ensure the user has either set no password or one the correct length
        if (len(enteredPin) > 0) and (Settings.getPinLength() > len(enteredPin)):
            log("SetPin: Incorrect length pin entered, expecting %d digits" % Settings.getPinLength())
            xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32109).encode('utf-8'))
        else:
            # Now double check the value the user entered
            numberpad = NumberPad.createNumberPad(32107)
            numberpad.doModal()

            # Get the code that the user entered
            enteredPin2 = numberpad.getPin()
            del numberpad

            if enteredPin == enteredPin2:
                Settings.setPinValue(enteredPin)
            else:
                log("SetPin: Pin entry different, first: %s, second %s" % (enteredPin, enteredPin2))
开发者ID:ryanjrose,项目名称:sualfreds-repo,代码行数:33,代码来源:setpin.py

示例5: getPin

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getPinLength [as 别名]
 def getPin(self):
     # Only return the pin value if it meets the required length
     if Settings.getPinLength() < len(self.code):
         return ""
     return self.code
开发者ID:MrMC,项目名称:script.pinsentry,代码行数:7,代码来源:numberpad.py


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