-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 45a54af
Showing
9 changed files
with
878 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
addon/doc/*.css | ||
addon/doc/en/ | ||
*_docHandler.py | ||
*.html | ||
manifest.ini | ||
*.mo | ||
*.pot | ||
*.py[co] | ||
*.nvda-addon | ||
.sconsign.dblite | ||
/[0-9]*.[0-9]*.[0-9]*.json |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# En Dash Bash for NVDA | ||
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. | ||
|
||
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. | ||
|
||
## Building | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import globalPluginHandler | ||
|
||
from brailleInput import handler as brailleInputHandler | ||
from scriptHandler import script | ||
|
||
|
||
""" | ||
En Dash Bash for NVDA | ||
Copyright 2024 Bill Dengler | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
""" | ||
|
||
|
||
class GlobalPlugin(globalPluginHandler.GlobalPlugin): | ||
def _sendCharacters(self, chars: str): | ||
if brailleInputHandler is not None: | ||
brailleInputHandler.sendChars(chars) | ||
|
||
@script( | ||
gesture="kb:NVDA+-", | ||
description=( | ||
# Translators: a gesture description. | ||
_("Enters an en dash (\N{en dash}) character") | ||
), | ||
category=( | ||
# Translators: an input gesture category. | ||
_("En Dash Bash") | ||
), | ||
) | ||
def script_enDash(self, gesture): | ||
self._sendCharacters("\N{en dash}") | ||
|
||
@script( | ||
gesture="kb:NVDA+Shift+-", | ||
description=( | ||
# Translators: a gesture description. | ||
_("Enters an em dash (\N{em dash}) character") | ||
), | ||
category=( | ||
# Translators: an input gesture category. | ||
_("En Dash Bash") | ||
), | ||
) | ||
def script_emDash(self, gesture): | ||
self._sendCharacters("\N{em dash}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# -*- coding: UTF-8 -*- | ||
|
||
# Build customizations | ||
# Change this file instead of sconstruct or manifest files, whenever possible. | ||
|
||
|
||
# Since some strings in `addon_info` are translatable, | ||
# we need to include them in the .po files. | ||
# Gettext recognizes only strings given as parameters to the `_` function. | ||
# To avoid initializing translations in this module we simply roll our own "fake" `_` function | ||
# which returns whatever is given to it as an argument. | ||
def _(arg): | ||
return arg | ||
|
||
|
||
# Add-on information variables | ||
addon_info = { | ||
# add-on Name/identifier, internal for NVDA | ||
"addon_name": "enDashBash", | ||
# Add-on summary, usually the user visible name of the addon. | ||
# Translators: Summary for this add-on | ||
# to be shown on installation and add-on information found in Add-ons Manager. | ||
"addon_summary": _("En Dash Bash"), | ||
# Add-on description | ||
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager | ||
"addon_description": _( | ||
( | ||
"En Dash Bash adds input gestures (NVDA commands) to enter the en dash" | ||
" (\N{en dash}) and em dash (\N{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\N{en dash}American War); to compound attributes," | ||
" where one of the connected items is itself a compound (such as New" | ||
" York\N{en dash}style pizza); and, when spaced, to set off parenthetical" | ||
" expressions \N{en dash} like this one \N{en dash} 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.\n\nBy default, NVDA+- types an en dash, and NVDA+Shift+-" | ||
" types an em dash. These commands can be changed in NVDA's input gestures" | ||
" dialog." | ||
) | ||
), | ||
# version | ||
"addon_version": "1.0.0", | ||
# Author(s) | ||
"addon_author": "Bill Dengler <codeofdusk@gmail.com>", | ||
# URL for the add-on documentation support | ||
"addon_url": "https://github.com/codeofdusk/endashbash-nvda", | ||
# URL for the add-on repository where the source code can be found | ||
"addon_sourceURL": "https://github.com/codeofdusk/endashbash-nvda", | ||
# Documentation file name | ||
"addon_docFileName": "readme.html", | ||
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional) | ||
"addon_minimumNVDAVersion": "2024.1.0", | ||
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version) | ||
"addon_lastTestedNVDAVersion": "2024.1.0", | ||
# Add-on update channel (default is None, denoting stable releases, | ||
# and for development releases, use "dev".) | ||
# Do not change unless you know what you are doing! | ||
"addon_updateChannel": None, | ||
# Add-on license such as GPL 2 | ||
"addon_license": "MIT", | ||
# URL for the license document the ad-on is licensed under | ||
"addon_licenseURL": "https://github.com/codeofdusk/endashbash-nvda/blob/master/COPYING.txt", | ||
} | ||
|
||
# Define the python files that are the sources of your add-on. | ||
# You can either list every file (using ""/") as a path separator, | ||
# or use glob expressions. | ||
# For example to include all files with a ".py" extension from the "globalPlugins" dir of your add-on | ||
# the list can be written as follows: | ||
# pythonSources = ["addon/globalPlugins/*.py"] | ||
# For more information on SCons Glob expressions please take a look at: | ||
# https://scons.org/doc/production/HTML/scons-user/apd.html | ||
pythonSources = [] | ||
|
||
# Files that contain strings for translation. Usually your python sources | ||
i18nSources = pythonSources + ["buildVars.py"] | ||
|
||
# Files that will be ignored when building the nvda-addon file | ||
# Paths are relative to the addon directory, not to the root directory of your addon sources. | ||
excludedFiles = [] | ||
|
||
# Base language for the NVDA add-on | ||
# If your add-on is written in a language other than english, modify this variable. | ||
# For example, set baseLanguage to "es" if your add-on is primarily written in spanish. | ||
baseLanguage = "en" | ||
|
||
# Markdown extensions for add-on documentation | ||
# Most add-ons do not require additional Markdown extensions. | ||
# If you need to add support for markup such as tables, fill out the below list. | ||
# Extensions string must be of the form "markdown.extensions.extensionName" | ||
# e.g. "markdown.extensions.tables" to add tables. | ||
markdownExtensions = [] | ||
|
||
# Custom braille translation tables | ||
# If your add-on includes custom braille tables (most will not), fill out this dictionary. | ||
# Each key is a dictionary named according to braille table file name, | ||
# with keys inside recording the following attributes: | ||
# displayName (name of the table shown to users and translatable), | ||
# contracted (contracted (True) or uncontracted (False) braille code), | ||
# output (shown in output table list), | ||
# input (shown in input table list). | ||
brailleTables = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
summary = "{addon_summary}" | ||
description = """{addon_description}""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name = {addon_name} | ||
summary = "{addon_summary}" | ||
description = """{addon_description}""" | ||
author = "{addon_author}" | ||
url = {addon_url} | ||
version = {addon_version} | ||
docFileName = {addon_docFileName} | ||
minimumNVDAVersion = {addon_minimumNVDAVersion} | ||
lastTestedNVDAVersion = {addon_lastTestedNVDAVersion} | ||
updateChannel = {addon_updateChannel} |
Oops, something went wrong.