Skip to content

Commit

Permalink
Setup basic repo structure and files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Davis authored and Luke Davis committed May 1, 2024
1 parent 17625ae commit 92a68ed
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 186 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/build_addon.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
name: build addon

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
tags: ["*"]
# To build on main/master branch, uncomment the following line:
# branches: [ main , master ]
#branches: [ main, master, prime ]

pull_request:
branches: [ main, master ]
branches: [ main, master, prime ]

workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v4
- run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
cache: 'pip'

- name: Install dependencies
Expand All @@ -38,19 +39,23 @@ jobs:
run: export SKIP=no-commit-to-branch; pre-commit run --all

- name: building addon
run: scons
run: |
scons
scons pot
- uses: actions/upload-artifact@v3
with:
name: packaged_addon
path: ./*.nvda-addon
path: |
./*.nvda-addon
./*.pot
upload_release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: ["build"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: download releases files
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
Expand All @@ -59,6 +64,8 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v1
with:
files: packaged_addon/*.nvda-addon
files: |
packaged_addon/*.nvda-addon
packaged_addon/*.pot
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref, '-') }}
33 changes: 33 additions & 0 deletions .github/workflows/check-for-extended-ascii-and-utf-bom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check that we dont have extended ascii or utf boms in our files

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- master
- main
- prime
pull_request:
branches:
- master
- main
- prime

jobs:
extendedAsciiAndBom:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: check for files known to cause problems
run: find . -type f | grep -vP "^./.git" | xargs file | grep -iP "bom|extended|iso"
- name:
if: failure()
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "Please note that this push or pull request seems to contain files other than ascii or utf8 without bom."
29 changes: 29 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on: [push, pull_request]
# push:
# branches:
# - master
# pull_request:
# branches:
# - master

jobs:
lint:
runs-on: windows-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: pip install -r requirements.txt
- name: Lint
run: flake8 addon
26 changes: 26 additions & 0 deletions .github/workflows/mergeTranslations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://crontab.guru/crontab.5.html

name: Check for and merge l10n updates

on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '08 00 * * 6' # At 00:08 on Saturdays

jobs:
update-translations:
runs-on: windows-latest
steps:
- name: Checkout master
uses: actions/checkout@v3
- name: Merge changes
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git pull
git remote add l10n https://github.com/nvdaaddons/speechLogger
git fetch l10n
git merge -q --ff -m "Translations automerge" l10n/stable
git push
29 changes: 0 additions & 29 deletions _template_addon_release.json

This file was deleted.

76 changes: 76 additions & 0 deletions addon/globalPlugins/ignoreKeys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Ignore special keys
# Originally a private add-on by Tyler Spivey <tspivey@pcdesk.net>, on behalf of Sarah k Alawami <marrie12@gmail.com>
# With a subsequent rewrite and expansion by Luke Davis <XLTechie@newanswertech.com>.
# Copyright (c) 2023-2024, Sarah k Alawami, Luke Davis, all rights reserved.

import config
import gui
import ui
import addonHandler
import globalPluginHandler
import keyboardHandler
import tones
import winUser
import winInputHook
from scriptHandler import script
from logHandler import log
from globalCommands import SCRCAT_TOOLS


addonHandler.initTranslation()
globalPluginPointer: Optional[globalPluginHandler.GlobalPlugin] = None

config.conf.spec["ignoreSpecialKeys"] = {
"resetSelectedLockKeys": "boolean(default=True)",
"keyGroup": "integer(default=0)",
}

class GlobalPlugin(globalPluginHandler.GlobalPlugin):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.patched = False
global globalPluginPointer
globalPluginPointer = self

def patch(self):
if self.patched:
return
else:
self.old_fn = keyboardHandler.internal_keyDownEvent
keyboardHandler.internal_keyDownEvent = internal_keyDownEvent
winInputHook.keyDownCallback = internal_keyDownEvent
self.patched = True
tones.beep(1000, 100)

def unpatch(self, shouldBeep: bool = True):
if self.patched:
keyboardHandler.internal_keyDownEvent = self.old_fn
winInputHook.keyDownCallback = self.old_fn
self.patched = False
if shouldBeep:
tones.beep(700, 100)

def terminate(self):
self.unpatch(False)

@script(
description="Toggle to keep NVDA from intercepting foot pedal keys. Press again to restore normal keyboard.",
gesture="kb:NVDA+shift+f8",
category=SCRCAT_TOOLS
)
def script_patch(self, gesture):
if self.patched:
self.unpatch()
else:
self.patch()

def internal_keyDownEvent(vkCode, scanCode, extended, injected):
if (
vkCode == winUser.VK_PAUSE
or vkCode == winUser.VK_CANCEL
or vkCode == winUser.VK_SCROLL
):
return True
else:
return globalPluginPointer.old_fn(vkCode, scanCode, extended, injected)
26 changes: 13 additions & 13 deletions buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ def _(arg):
# Add-on information variables
addon_info = {
# add-on Name/identifier, internal for NVDA
"addon_name": "addonTemplate",
"addon_name": "ignoreKeys",
# 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": _("Add-on user visible name"),
"addon_summary": _("Ignore Keys"),
# Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _("""Description for the add-on.
It can span multiple lines."""),
"addon_description": _("""An NVDA add-on which causes the chosen keys (for example: pause, break, F12) to be completely ignored by NVDA when the add-on is set to active mode.
Includes optional resetting of lock keys under certain circumstances."""),
# version
"addon_version": "x.y",
"addon_version": "24.0.0",
# Author(s)
"addon_author": "name <name@domain.com>",
"addon_author": "Luke Davis <XLTechie@newanswertech.com>, Sarah K Alawami <marrie12@gmail.com>, Tyler Spivey <tspivey@pcdesk.net>",
# URL for the add-on documentation support
"addon_url": None,
"addon_url": "https://github.com/opensourcesys/ignoreKeys/blob/master/readme.md#readme",
# URL for the add-on repository where the source code can be found
"addon_sourceURL": None,
"addon_sourceURL": "https://github.com/opensourcesys/ignoreKeys",
# Documentation file name
"addon_docFileName": "readme.html",
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
"addon_minimumNVDAVersion": None,
"addon_minimumNVDAVersion": "2022.1.0",
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion": None,
"addon_lastTestedNVDAVersion": "2024.1",
# 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": None,
"addon_license": "GPL 2",
# URL for the license document the ad-on is licensed under
"addon_licenseURL": None,
"addon_licenseURL": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html",
}

# Define the python files that are the sources of your add-on.
Expand All @@ -57,7 +57,7 @@ def _(arg):
# 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 = []
pythonSources = ["addon/globalPlugins/*.py"]

# Files that contain strings for translation. Usually your python sources
i18nSources = pythonSources + ["buildVars.py"]
Expand Down
Loading

0 comments on commit 92a68ed

Please sign in to comment.