nvdaaddons / AddonTemplate

Template and metadata used by NVDA community add-ons
GNU General Public License v2.0
20 stars 25 forks source link

NVDA Add-on Scons Template

This package contains a basic template structure for NVDA add-on development, building, distribution and localization. For details about NVDA add-on development, please see the NVDA Add-on Development Guide. The NVDA add-on development/discussion list is here Information specific to NV Access add-on store can be found here.

Copyright (C) 2012-2024 NVDA Add-on team contributors.

This package is distributed under the terms of the GNU General Public License, version 2 or later. Please see the file COPYING.txt for further details.

alekssamos added automatic package of add-ons through Github Actions.

For details about Github Actions please see the Workflow syntax for GitHub Actions.

Copyright (C) 2022 alekssamos

Features

This template provides the following features you can use during NVDA add-on development and packaging:

In addition, this template includes configuration files for the following tools for use in add-on development and testing (see "additional tools" section for details):

Requirements

You need the following software to use this code for your NVDA add-on development and packaging:

Note, that you may not need these tools in a local build environment, if you are using Appveyor or GitHub Actions, to build and package your add-ons.

Usage

To create a new NVDA add-on using this template:

  1. Create an empty folder to hold the files for your add-on.
  2. Copy the folder:
    site_scons

    and the following files, into your new empty folder:

    buildVars.py
    manifest.ini.tpl
    manifest-translated.ini.tpl
    sconstruct
    .gitignore
    .gitattributes
  3. If you intend to use the provided GitHub workflow, also copy the folder:
    .github

    and file:

    .pre-commit-config.yaml
  4. Create an addon folder inside your new folder. You will put your code in the usual folders for NVDA extensions, under the addon folder. For instance: globalPlugins, synthDrivers, etc.
  5. In the buildVars.py file, change variable addon_info with your add-on's information (name, summary, description, version, author, url, source url, license, and license URL). Also, be sure to carefully set the paths contained in the other variables in that file. If you need to use custom Markdown extensions, original add-on interface language is not English, or include custom braille translations tables, be sure to fil out markdown list, base language variable, and braille tables dictioanry, respectively.
  6. Gettext translations must be placed into addon\locale\<lang>/LC_MESSAGES\nvda.po.

Add-on manifest specification

An add-on manifest generated manually or via buildVars.py must include the following information:

In addition, the following information must be filled out (not used in the manifest but used elsewhere such as add-on store) in buildVars:

Custom add-on information

In addition to the core manifest data, custom add-on information can be specified.

Braille translation tables

Information on custom braille tables must be specified in buildVars under brailleTables dictionary as follows:

Note: you must fill out this dictionary if at least one custom braille table is included in the add-on. If not, leave the dictionary empty.

Speech symbol dictionaries

Information on custom symbol dictionaries must be specified in buildVars under symbolDictionaries dictionary as follows:

Note: you must fill out this dictionary if at least one custom symbol dictionary is included in the add-on. If not, leave the dictionary empty.

To manage documentation files for your addon:

  1. Copy the readme.md file for your add-on to the first created folder, where you copied buildVars.py. You can also copy style.css to improve the presentation of HTML documents.
  2. Documentation files (named readme.md) must be placed into addon\doc\<lang>/.

To package the add-on for distribution:

  1. Open a command line, change to the folder that has the sconstruct file (usually the root of your add-on development folder) and run the scons command. The created add-on, if there were no errors, is placed in the current directory.
  2. You can further customize variables in the buildVars.py file.
  3. You can also customize version and update channel information from command line by passing the following switches when running scons:
    • version: add-on version string.
    • versionNumber: add-on version number of the form major.minor.patch (all integers)
    • channel: update channel (do not use this switch unless you know what you are doing).
    • dev: suitable for development builds, names the add-on according to current date (yyyymmdd) and sets update channel to "dev".

Additional tools

The template includes configuration files for use with additional tools such as linters. These include:

Read the documentation for the tools you wish to use when building and developing add-ons.

Note that this template only provides a basic add-on structure and build infrastructure. You may need to adapt it for your specific needs such as using additional tools.

If you have any issues please use the NVDA addon list mentioned above.