Re: Question about screen curtain, review comments

 

Hey Noelia,


Thanks for pointing this out. It actually works as expected, but I will explain why.


The script uses a try/finally block. I think the following code is pretty explanatory when executed:


def test():
    try:
        return(42)
    finally:
        print("hello!")

You will notice that when executing test(), both 42 and Hello are printed. In short, return brings you straight to the finally block, and I think the function will first execute the finally block and then returns.


Regards,

Leonard


On 7-9-2019 11:17, Noelia Ruiz wrote:
@leonardder and @feerrenrut :

def script_toggleScreenCurtain(self, gesture):
        message = None
        try:
            screenCurtainName = "screenCurtain"
            if not vision.getProviderClass(screenCurtainName).canStart():
                # Translators: Reported when the screen curtain is not available.
                message = _("Screen curtain not available")
                return

If return, I think that the message won't be reported if screen curtain is not available.

Also:

# Translators: Reported when the screen curtain could not be enabled.
                    message = _("Could not enable screen curtain")
                    return

Sorry if I'm missing something.
My tests are successful toggling screen curtain, so I can't check what happens when this can't be done.
Kind regards




Join nvda-devel@groups.io to automatically receive all group messages.