Re: Question about screen curtain, review comments
toggle quoted messageShow quoted text
On 7-9-2019 13:14, Noelia Ruiz wrote:
work and excellent explanation!
Previously, I tried to test something similar in the Python
console and for any reason this failed, but it works perfectly in
a global plugin using ui.message().
In the console I got this: SyntaxError: 'return' outside function
But this works and expected. Thanks for all your work and my best
El 07/09/2019 a las 12:40, Leonard de Ruijter escribió:
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:
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.
On 7-9-2019 11:17, Noelia Ruiz wrote:
@leonardder and @feerrenrut :
def script_toggleScreenCurtain(self, gesture):
message = None
screenCurtainName = "screenCurtain"
# Translators: Reported when the screen
curtain is not available.
message = _("Screen curtain not available")
If return, I think that the message won't be reported if
screen curtain is not available.
# Translators: Reported when the screen curtain could not be
message = _("Could not enable screen
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.
Join email@example.com to automatically receive all group messages.