Re: About layered commands


Cyrille
 

Hello my friend Abdel

Nice to find you again even on English mailing lists! Welcome back!

I am wondering why you want to remove the decorators. IMO they are a nice way to write Python code; think to the widely used @script decorator.
In any case, a decorator is never absolutely necessary. Indeed, in Python it is only another to way to call a functions that takes a function as parameter and that returns a function. I.e.:

@myDecorator
def foo()
    pass

is the same as:

def foo():
    pass
foo = myDecorator(foo)

Regarding your code, you do not have only removed the decorators. You have also simplified the usual layered key management code.
The downside is that if an error occurs in a layered script, the layer is not exited and you need to press another key to exit it.

Cheers,

Cyrille






 
De : "Abdel"
A : nvda-addons@groups.io
Envoyé: mercredi 1 Septembre 2021 20:03
Objet : [nvda-addons] About layered commands
 
Hi everyone,

First of all, I wanted to apologize for this long silence, I was rather
busy lately.

Some time ago, I had used an implementation, in Clock add-on, which uses
layered commands without using a decorator.

I think it is important to clarify that the decorator is not really
essential to achieve this.

You will find as attachment, a small implementation, which has 2 scripts
that can be executed in layers mode.

You can test if you wish in the "Scratchpad" directory.

You will just have to activate the use of the developer's scratchpad in
the advanced settings.

The script for executing layer mode can be started with "Control + F9".

In layer mode, you can use the "H" for help or "M" to hear a simple message.

What are your thoughts?

Kind regards,
Abdel.






 

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