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


Python Settings.getUserEndTime方法代码示例

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


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

示例1: displaySummary

# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import getUserEndTime [as 别名]
    def displaySummary(self):
        # Load the settings for this user
        allowedStartTime, displayStartTime = Settings.getUserStartTime(self.userId)
        allowedEndTime, displayEndTime = Settings.getUserEndTime(self.userId)
        viewingLimit = Settings.getUserViewingLimit(self.userId)
        usersName = Settings.getUserName(self.userId)

        # Work out how much time is remaining
        displayRemainingTime = viewingLimit - self.usedViewingLimit
        if displayRemainingTime < 0:
            displayRemainingTime = 0

        # Do a notification to let the user know how long they have left today
        summaryUserName = "%s:    %s" % (ADDON.getLocalizedString(32035), usersName)
        summaryLimit = "%s:    %d" % (ADDON.getLocalizedString(32033), viewingLimit)
        summaryLimitRemaining = "%s:    %d" % (ADDON.getLocalizedString(32131), displayRemainingTime)
        summaryAccess = "%s:    %s - %s" % (ADDON.getLocalizedString(32132), displayStartTime, displayEndTime)
        fullSummary = "%s\n%s\n%s\n%s" % (summaryUserName, summaryLimit, summaryLimitRemaining, summaryAccess)
        xbmcgui.Dialog().ok(ADDON.getLocalizedString(32001).encode('utf-8'), fullSummary)
开发者ID:jatlaoui,项目名称:script.pinsentry,代码行数:21,代码来源:service.py

示例2: startupCheck

# 需要导入模块: from resources.lib.settings import Settings [as 别名]
# 或者: from resources.lib.settings.Settings import getUserEndTime [as 别名]
    def startupCheck(self):
        # When the system starts up we need to check to see if User restriction is enabled
        if Settings.getNumberOfLimitedUsers() < 1:
            log("UserPinControl: No Limited users configured")
            self.isEnabled = False
            return

        self.isEnabled = True

        # Set the background
        background = Background.createBackground()
        if background is not None:
            background.show()

        preventAccess = False
        tryAgain = True
        while tryAgain:
            tryAgain = False
            # Need to find out which user this is, so prompt them for a pin
            numberpad = NumberPad.createNumberPad()
            numberpad.doModal()

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

            # Find out which user owns this pin
            self.userId = Settings.getUserForPin(enteredPin)

            # Check for the unrestricted user
            if self.userId == "unrestrictedUserPin":
                log("UserPinControl: Unrestricted user pin entered")
                self.isEnabled = False
                break

            if self.userId in [None, ""]:
                log("UserPinControl: Unknown pin entered, offering retry")
                # This is not a valid user, so display the error message and work out
                # if we should prompt the user again or shutdown the system
                tryAgain = xbmcgui.Dialog().yesno(ADDON.getLocalizedString(32001).encode('utf-8'), ADDON.getLocalizedString(32104).encode('utf-8'), ADDON.getLocalizedString(32129).encode('utf-8'))

                if not tryAgain:
                    # Need to stop this user accessing the system
                    preventAccess = True

        # Remove the background if we had one
        if background is not None:
            background.close()
            del background

        if preventAccess:
            log("UserPinControl: Shutting down as unknown user pin entered")
            self.shutdown()
        elif self.isEnabled:
            log("UserPinControl: User logged in is %s" % self.userId)
            # Load the settings for this user
            self.allowedStartTime, displayStartTime = Settings.getUserStartTime(self.userId)
            self.allowedEndTime, displayEndTime = Settings.getUserEndTime(self.userId)
            self.usedViewingLimit = Settings.getUserViewingUsedTime(self.userId)

            self.displaySummary()

            # Now we can record when this user started viewing in this session
            localTime = time.localtime()
            self.startedViewing = (localTime.tm_hour * 60) + localTime.tm_min

            # We actually want to also record how many minutes have already been viewed in previous
            # sessions, so roll the clock back by that much
            self.startedViewing = self.startedViewing - self.usedViewingLimit

            log("UserPinControl: Time already used for user is %d" % self.usedViewingLimit)

            # Record that we are running as a restricted user so that the default script
            # can display the status of how long is left when it is selected
            xbmcgui.Window(10000).setProperty("PinSentry_RestrictedUser", self.userId)
开发者ID:jatlaoui,项目名称:script.pinsentry,代码行数:77,代码来源:service.py


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