calculator.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:wintenApps 作者: josephsl 项目源码 文件源码
def script_calculatorResult(self, gesture):
        # To prevent double focus announcement, check where we are.
        focus = api.getFocusObject()
        navMenu = False
        if isinstance(focus, UIA) and isinstance(focus.parent.parent, UIA) and focus.parent.parent.UIAElement.cachedAutomationID == "FlyoutNav":
            navMenu = True
        gesture.send()
        # In redstone, calculator result keeps firing name change, so tell it to do so if and only if enter has been pressed.
        self.shouldAnnounceResult = True
        # Hack: only announce display text when an actual calculator button (usually equals button) is pressed.
        # In redstone, pressing enter does not move focus to equals button.
        if isinstance(focus, UIA):
            if focus.UIAElement.cachedAutomationID == "CalculatorResults":
                queueHandler.queueFunction(queueHandler.eventQueue, focus.reportFocus)
            elif focus.UIAElement.cachedAutomationID != "NavButton":
                # In newer releases, result is located on the same spot in the object hierarchy.
                result = api.getForegroundObject().children[1].children[3]
                if result.UIAElement.cachedAutomationID == "CalculatorResults" and not navMenu:
                    # And no, do not allow focus to move.
                    queueHandler.queueFunction(queueHandler.eventQueue, result.reportFocus)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号