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


Python Settings.getNumberOfLevels方法代码示例

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


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

示例1: displayInvalidPinMessage

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getNumberOfLevels [as 别名]
 def displayInvalidPinMessage(level=1):
     # Invalid Key Notification: Dialog, Popup Notification, None
     notifType = Settings.getInvalidPinNotificationType()
     if notifType == Settings.INVALID_PIN_NOTIFICATION_POPUP:
         cmd = ""
         if Settings.getNumberOfLevels() > 1:
             cmd = 'Notification("{0}", "{1} {2}", 3000, "{3}")'.format(__addon__.getLocalizedString(32104).encode('utf-8'), __addon__.getLocalizedString(32211).encode('utf-8'), str(level), __icon__)
         else:
             cmd = 'Notification("{0}", "{1}", 3000, "{2}")'.format(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32104).encode('utf-8'), __icon__)
         xbmc.executebuiltin(cmd)
     elif notifType == Settings.INVALID_PIN_NOTIFICATION_DIALOG:
         line3 = None
         if Settings.getNumberOfLevels() > 1:
             line3 = "%s %d" % (__addon__.getLocalizedString(32211), level)
         xbmcgui.Dialog().ok(__addon__.getLocalizedString(32001).encode('utf-8'), __addon__.getLocalizedString(32104).encode('utf-8'), line3)
开发者ID:MrMC,项目名称:script.pinsentry,代码行数:17,代码来源:service.py

示例2: log

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getNumberOfLevels [as 别名]
##################################
# Main of the PinSentry Setter
##################################
if __name__ == '__main__':
    log("Starting Pin Sentry Setter")

    # Before setting the pin we need to ensure that all dialog boxes are closed
    xbmc.executebuiltin("Dialog.Close(all, true)", True)

    numArgs = len(sys.argv)
    log("SetPin: Number of arguments %d" % numArgs)

    # If there are no arguments, then the pins are for default pin access per video
    if numArgs < 2:
        # Get the number of pins that have been set
        numLevels = Settings.getNumberOfLevels()
        log("SetPin: number of pins is %d" % numLevels)

        if numLevels < 2:
            # Only one pin to set
            setPin()
        else:
            # Need to prompt the user to see which pin they are trying to set
            displayNameList = []
            for i in range(1, numLevels + 1):
                notSetMsg = ""
                if not Settings.isPinSet(i):
                    notSetMsg = " %s" % __addon__.getLocalizedString(32024)

                displayString = "%s %d%s" % (__addon__.getLocalizedString(32021), i, notSetMsg)
                displayNameList.append(displayString)
开发者ID:Stevie-Bs,项目名称:repository.xvbmc,代码行数:33,代码来源:setpin.py

示例3: setSecurity

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getNumberOfLevels [as 别名]
    def setSecurity(self, type, title, id, oldLevel, classBlocked=False, forceLevel=None):
        log("Setting security for (id:%s) %s" % (id, title))

        level = 1

        # Check if we need to prompt the user or the new security level has been supplied
        if forceLevel is None:
            # Set the new security level to be used
            if oldLevel > 0:
                # Default is to disable it if it was enabled
                level = 0

            numLevels = Settings.getNumberOfLevels()
            if numLevels > 1 or classBlocked:
                # Need to prompt the user to see which pin they are trying to set
                displayNameList = []
                # Add the option to turn it off
                displayNameList.append("%s %s" % (__addon__.getLocalizedString(32211), __addon__.getLocalizedString(32013)))
                for i in range(1, numLevels + 1):
                    secLevStr = str(i)
                    if numLevels < 2:
                        # If there is only one security level, use "On" rather than the number
                        secLevStr = __addon__.getLocalizedString(32014)
                    displayString = "%s %s" % (__addon__.getLocalizedString(32211), secLevStr)
                    displayNameList.append(displayString)

                # Check if we need the option to disable a classification restriction
                if classBlocked:
                    displayNameList.append(__addon__.getLocalizedString(32212))

                select = xbmcgui.Dialog().select(__addon__.getLocalizedString(32001), displayNameList)

                if select != -1:
                    level = select
                    if classBlocked and (select >= (len(displayNameList) - 1)):
                        level = -1
                    log("Setting security level to %d" % level)
                else:
                    log("Exiting set security as no level selected")
                    return
        else:
            level = forceLevel

        # This could take a little time to set the value so show the busy dialog
        xbmc.executebuiltin("ActivateWindow(busydialog)")

        if title not in [None, ""]:
            pinDB = PinSentryDB()
            if type == MenuNavigator.TVSHOWS:
                # Set the security level for this title, setting it to zero
                # will result in the entry being removed from the database
                # as the default for an item is unset
                pinDB.setTvShowSecurityLevel(title, int(id), level)
            elif type == MenuNavigator.MOVIES:
                pinDB.setMovieSecurityLevel(title, int(id), level)
            elif type == MenuNavigator.MOVIESETS:
                pinDB.setMovieSetSecurityLevel(title, int(id), level)
                # As well as setting the security on the Movie set, we need
                # to also set it on each movie in the Movie Set
                self._setSecurityOnMoviesInMovieSets(int(id), level)
            elif type == MenuNavigator.MUSICVIDEOS:
                pinDB.setMusicVideoSecurityLevel(title, int(id), level)
            elif type == MenuNavigator.PLUGINS:
                pinDB.setPluginSecurityLevel(title, id, level)
            elif type == MenuNavigator.FILESOURCE:
                pinDB.setFileSourceSecurityLevel(title, id, level)
            elif type == MenuNavigator.CLASSIFICATIONS_MOVIES:
                pinDB.setMovieClassificationSecurityLevel(id, title, level)
            elif type == MenuNavigator.CLASSIFICATIONS_TV:
                pinDB.setTvClassificationSecurityLevel(id, title, level)
            del pinDB
        else:
            # Handle the bulk operations like set All security for the movies
            self._setBulkSecurity(type, level)

        xbmc.executebuiltin("Dialog.Close(busydialog)")
        xbmc.executebuiltin("Container.Refresh")
开发者ID:Stevie-Bs,项目名称:repository.xvbmc,代码行数:79,代码来源:plugin.py


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