Re: NVDA Developer Guide: Question about how to make addons using standard NotePad


Luke Davis
 

In Python3, all source files are assumed to be UTF-8.
In Python2, they are assumed to be ASCII, unless you include that famous encoding comment at the top.
Although some (most?) add-on devs encode Python2 files in UTF-8, but don't include the magic comment for some reason.

That said, if you save as ASCII, I believe the world won't actually end. I have done it, and not run into problems. But, I only write in characters below 127--I'm very vanilla that way. But if you want to be future-safe, saving in UTF-8 is always preferable.

I vaguely remember hearing somewhere that NVDA strengthens Python's assumption to a requirement for some reason (translations?), but I can't find anything in any of the guides about it.
I do know that for most things (manifests, dictionaries, etc.), NVDA does require UTF-8 encoding.

Luke

On Sun, 9 Jun 2019, Daniel Gartmann wrote:

The last time I played with writing .py files in Notepad, I had to change the encoding in the Save dialog. It was not just using the standard Save command. Right now, I don’t recall how the file should be encoded in order to work properly in NVDA.

Thanks.

Den 9. jun. 2019 kl. 21.14 skrev Luke Davis <luke@newanswertech.com>:

There is nothing really special about a .py file, it is just a text file with a different extension (not .txt).

The nice thing about Notepad++, is that it has auto-indentation, and re-opens last open files, and so on. But other than that, it is editing in text just like Notepad.

It might also be easier to change character encodings in Notepad++, but I haven't really explored that.

So, all of that is to say, there really is no special procedure.
You can open a notepad session, write your code, and save it with a .py extension. You will have to do your own indenting, but if you're used to writing Python that should be no problem.

Any text editor which does not wrap lines should be fine for this.

Luke

On Sun, 9 Jun 2019, Daniel Gartmann wrote:


Hi,

I tried to find information about how to make an add-on using the built-in Notepad application instead of having to install NotePad++.

The use case is as follows:
You go to another person’s computer to make NVDA behave better for that particular user in a specific situation.

Other screenreaders have built-in script editors e.g the JAWS Script Editor. But when using NVDA, we are told to use NotePad++.

It is, however, not possible to install NotePad++ if, for instance, you are in a corporate environment or some other restricted setting.

So. What is the procedure to make a .py file in Notepad and save it in the correct format?

Could it be included in the NVDA Developer guide?

Just a suggestion so that NVDA’s customizations can be made easier in more places.

Daniel







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