Skip to content

Commit 45a54af

Browse files
committed
Initial check-in and 1.0 release
0 parents  commit 45a54af

File tree

9 files changed

+878
-0
lines changed

9 files changed

+878
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
addon/doc/*.css
2+
addon/doc/en/
3+
*_docHandler.py
4+
*.html
5+
manifest.ini
6+
*.mo
7+
*.pot
8+
*.py[co]
9+
*.nvda-addon
10+
.sconsign.dblite
11+
/[0-9]*.[0-9]*.[0-9]*.json

COPYING.txt

Lines changed: 350 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# En Dash Bash for NVDA
2+
En Dash Bash is an add-on for the [NVDA screen reader](https://nvaccess.org) that adds input gestures (NVDA commands) to enter the en dash (–) and em dash (—) quickly. En dashes are used to connect symmetric items, such as the two ends of a range of numbers or dates; to contrast values or illustrate a relationship between two things (such as Mexican–American War); to compound attributes, where one of the connected items is itself a compound (such as New York–style pizza); and, when spaced, to set off parenthetical expressions – like this one – in the middle of sentences. In some languages, en dashes are sometimes used to indicate a change of speaker in quoted dialogue. Unspaced em dashes are used similarly to spaced en dashes to set off parenthetical expressions.
3+
4+
By default, <kbd>NVDA</kbd>+<kbd>-</kbd> types an en dash, and <kbd>NVDA</kbd>+<kbd>Shift</kbd>+<kbd>-</kbd> types an em dash. These commands can be changed in NVDA's input gestures dialog.
5+
6+
## Building
7+
Much like NVDA, this add-on is built with [SCons](https://scons.org). Run `scons` from the root of the repo to build an `nvda-addon` package.

addon/globalPlugins/enDashBash.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import globalPluginHandler
2+
3+
from brailleInput import handler as brailleInputHandler
4+
from scriptHandler import script
5+
6+
7+
"""
8+
En Dash Bash for NVDA
9+
Copyright 2024 Bill Dengler
10+
11+
Permission is hereby granted, free of charge, to any person obtaining a copy
12+
of this software and associated documentation files (the "Software"), to deal
13+
in the Software without restriction, including without limitation the rights
14+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
copies of the Software, and to permit persons to whom the Software is
16+
furnished to do so, subject to the following conditions:
17+
The above copyright notice and this permission notice shall be included in all
18+
copies or substantial portions of the Software.
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
"""
27+
28+
29+
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
30+
def _sendCharacters(self, chars: str):
31+
if brailleInputHandler is not None:
32+
brailleInputHandler.sendChars(chars)
33+
34+
@script(
35+
gesture="kb:NVDA+-",
36+
description=(
37+
# Translators: a gesture description.
38+
_("Enters an en dash (\N{en dash}) character")
39+
),
40+
category=(
41+
# Translators: an input gesture category.
42+
_("En Dash Bash")
43+
),
44+
)
45+
def script_enDash(self, gesture):
46+
self._sendCharacters("\N{en dash}")
47+
48+
@script(
49+
gesture="kb:NVDA+Shift+-",
50+
description=(
51+
# Translators: a gesture description.
52+
_("Enters an em dash (\N{em dash}) character")
53+
),
54+
category=(
55+
# Translators: an input gesture category.
56+
_("En Dash Bash")
57+
),
58+
)
59+
def script_emDash(self, gesture):
60+
self._sendCharacters("\N{em dash}")

buildVars.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# -*- coding: UTF-8 -*-
2+
3+
# Build customizations
4+
# Change this file instead of sconstruct or manifest files, whenever possible.
5+
6+
7+
# Since some strings in `addon_info` are translatable,
8+
# we need to include them in the .po files.
9+
# Gettext recognizes only strings given as parameters to the `_` function.
10+
# To avoid initializing translations in this module we simply roll our own "fake" `_` function
11+
# which returns whatever is given to it as an argument.
12+
def _(arg):
13+
return arg
14+
15+
16+
# Add-on information variables
17+
addon_info = {
18+
# add-on Name/identifier, internal for NVDA
19+
"addon_name": "enDashBash",
20+
# Add-on summary, usually the user visible name of the addon.
21+
# Translators: Summary for this add-on
22+
# to be shown on installation and add-on information found in Add-ons Manager.
23+
"addon_summary": _("En Dash Bash"),
24+
# Add-on description
25+
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
26+
"addon_description": _(
27+
(
28+
"En Dash Bash adds input gestures (NVDA commands) to enter the en dash"
29+
" (\N{en dash}) and em dash (\N{em dash}) quickly. En dashes are used"
30+
" to connect symmetric items, such as the two ends of a range of numbers"
31+
" or dates; to contrast values or illustrate a relationship between two"
32+
" things (such as Mexican\N{en dash}American War); to compound attributes,"
33+
" where one of the connected items is itself a compound (such as New"
34+
" York\N{en dash}style pizza); and, when spaced, to set off parenthetical"
35+
" expressions \N{en dash} like this one \N{en dash} in the middle of"
36+
" sentences. In some languages, en dashes are sometimes used to indicate a"
37+
" change of speaker in quoted dialogue. Unspaced em dashes are used"
38+
" similarly to spaced en dashes to set off parenthetical"
39+
" expressions.\n\nBy default, NVDA+- types an en dash, and NVDA+Shift+-"
40+
" types an em dash. These commands can be changed in NVDA's input gestures"
41+
" dialog."
42+
)
43+
),
44+
# version
45+
"addon_version": "1.0.0",
46+
# Author(s)
47+
"addon_author": "Bill Dengler <[email protected]>",
48+
# URL for the add-on documentation support
49+
"addon_url": "https://github.com/codeofdusk/endashbash-nvda",
50+
# URL for the add-on repository where the source code can be found
51+
"addon_sourceURL": "https://github.com/codeofdusk/endashbash-nvda",
52+
# Documentation file name
53+
"addon_docFileName": "readme.html",
54+
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
55+
"addon_minimumNVDAVersion": "2024.1.0",
56+
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
57+
"addon_lastTestedNVDAVersion": "2024.1.0",
58+
# Add-on update channel (default is None, denoting stable releases,
59+
# and for development releases, use "dev".)
60+
# Do not change unless you know what you are doing!
61+
"addon_updateChannel": None,
62+
# Add-on license such as GPL 2
63+
"addon_license": "MIT",
64+
# URL for the license document the ad-on is licensed under
65+
"addon_licenseURL": "https://github.com/codeofdusk/endashbash-nvda/blob/master/COPYING.txt",
66+
}
67+
68+
# Define the python files that are the sources of your add-on.
69+
# You can either list every file (using ""/") as a path separator,
70+
# or use glob expressions.
71+
# For example to include all files with a ".py" extension from the "globalPlugins" dir of your add-on
72+
# the list can be written as follows:
73+
# pythonSources = ["addon/globalPlugins/*.py"]
74+
# For more information on SCons Glob expressions please take a look at:
75+
# https://scons.org/doc/production/HTML/scons-user/apd.html
76+
pythonSources = []
77+
78+
# Files that contain strings for translation. Usually your python sources
79+
i18nSources = pythonSources + ["buildVars.py"]
80+
81+
# Files that will be ignored when building the nvda-addon file
82+
# Paths are relative to the addon directory, not to the root directory of your addon sources.
83+
excludedFiles = []
84+
85+
# Base language for the NVDA add-on
86+
# If your add-on is written in a language other than english, modify this variable.
87+
# For example, set baseLanguage to "es" if your add-on is primarily written in spanish.
88+
baseLanguage = "en"
89+
90+
# Markdown extensions for add-on documentation
91+
# Most add-ons do not require additional Markdown extensions.
92+
# If you need to add support for markup such as tables, fill out the below list.
93+
# Extensions string must be of the form "markdown.extensions.extensionName"
94+
# e.g. "markdown.extensions.tables" to add tables.
95+
markdownExtensions = []
96+
97+
# Custom braille translation tables
98+
# If your add-on includes custom braille tables (most will not), fill out this dictionary.
99+
# Each key is a dictionary named according to braille table file name,
100+
# with keys inside recording the following attributes:
101+
# displayName (name of the table shown to users and translatable),
102+
# contracted (contracted (True) or uncontracted (False) braille code),
103+
# output (shown in output table list),
104+
# input (shown in input table list).
105+
brailleTables = {}

manifest-translated.ini.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
summary = "{addon_summary}"
2+
description = """{addon_description}"""

manifest.ini.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name = {addon_name}
2+
summary = "{addon_summary}"
3+
description = """{addon_description}"""
4+
author = "{addon_author}"
5+
url = {addon_url}
6+
version = {addon_version}
7+
docFileName = {addon_docFileName}
8+
minimumNVDAVersion = {addon_minimumNVDAVersion}
9+
lastTestedNVDAVersion = {addon_lastTestedNVDAVersion}
10+
updateChannel = {addon_updateChannel}

0 commit comments

Comments
 (0)