Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build_addon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.11
cache: 'pip'
Expand All @@ -40,7 +40,7 @@ jobs:
- name: building addon
run: scons && scons pot

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v6
with:
name: packaged_addon
path: |
Expand All @@ -54,22 +54,22 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: download releases files
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6
- name: Display structure of downloaded files
run: ls -R
- name: Calculate sha256
run: |
echo -e "\nSHA256: " >> changelog.md
sha256sum packaged_addon/*.nvda-addon >> changelog.md
sha256sum *.nvda-addon >> changelog.md

- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
packaged_addon/*.nvda-addon
packaged_addon/*.pot
*.nvda-addon
*.pot
body_path: changelog.md
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref, '-') }}
92 changes: 86 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,87 @@
# Copied from https://github.com/nvaccess/nvda
# https://pre-commit.ci/
# Configuration for Continuous Integration service
ci:
# Pyright does not seem to work in pre-commit CI
skip: [pyright]
autoupdate_schedule: monthly
autoupdate_commit_msg: "Pre-commit auto-update"
autofix_commit_msg: "Pre-commit auto-fix"
submodules: true

default_language_version:
python: python3.13

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-yaml
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
- id: check-pre-commit-ci-config

- repo: meta
hooks:
# ensures that exclude directives apply to any file in the repository.
- id: check-useless-excludes
# ensures that the configured hooks apply to at least one file in the repository.
- id: check-hooks-apply

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Prevents commits to certain branches
- id: no-commit-to-branch
args: ["--branch", "main", "master", ]
# Checks that large files have not been added. Default cut-off for "large" files is 500kb.
- id: check-added-large-files
# Checks python syntax
- id: check-ast
# Checks for filenames that will conflict on case insensitive filesystems (the majority of Windows filesystems, most of the time)
- id: check-case-conflict
# Checks for artifacts from resolving merge conflicts.
- id: check-merge-conflict
# Checks Python files for debug statements, such as python's breakpoint function, or those inserted by some IDEs.
- id: debug-statements
# Removes trailing whitespace.
- id: trailing-whitespace
types_or: [python, c, c++, batch, markdown, toml, yaml, powershell]
# Ensures all files end in 1 (and only 1) newline.
- id: end-of-file-fixer
types_or: [python, c, c++, batch, markdown, toml, yaml, powershell]
# Removes the UTF-8 BOM from files that have it.
# See https://github.com/nvaccess/nvda/blob/master/projectDocs/dev/codingStandards.md#encoding
- id: fix-byte-order-marker
types_or: [python, c, c++, batch, markdown, toml, yaml, powershell]
# Validates TOML files.
- id: check-toml
# Validates YAML files.
- id: check-yaml
# Ensures that links to lines in files under version control point to a particular commit.
- id: check-vcs-permalinks
# Avoids using reserved Windows filenames.
- id: check-illegal-windows-names
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.2.0
hooks:
# Ruff preserves indent/new-line formatting of function arguments, list items, and similar iterables,
# if a trailing comma is added.
# This adds a trailing comma to args/iterable items in case it was missed.
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
# Matches Ruff version in pyproject.
rev: v0.12.7
hooks:
- id: ruff
name: lint with ruff
args: [ --fix ]
- id: ruff-format
name: format with ruff

- repo: local
hooks:

- id: pyright
name: type check with pyright
entry: uv run pyright
language: system
types: [python]
29 changes: 0 additions & 29 deletions _template_addon_release.json

This file was deleted.

3 changes: 2 additions & 1 deletion addon/globalPlugins/viewerFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, parent, namespace):
wx.ID_ANY,
# Translators: The title of the Object Viewer frame.
_("Object Viewer"),
style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP,
# style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP,
)

self.panel: wx.Panel = wx.Panel(self)
Expand Down Expand Up @@ -70,6 +70,7 @@ def __init__(self, parent, namespace):
self.SetMinSize(self.scaleSize(self.MIN_SIZE))
self.SetSize(self.scaleSize(self.INITIAL_SIZE))
# the size has changed, so recenter on the screen
self.SetTransparent(int(255 * 0.9))
self.CentreOnScreen()

INITIAL_SIZE = (800, 480)
Expand Down
56 changes: 31 additions & 25 deletions buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,54 @@
# Build customizations
# Change this file instead of sconstruct or manifest files, whenever possible.

from site_scons.site_tools.NVDATool.typings import AddonInfo, BrailleTables, SymbolDictionaries

# 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
# To avoid initializing translations in this module we simply import a "fake" `_` function
# which returns whatever is given to it as an argument.
def _(arg):
return arg
from site_scons.site_tools.NVDATool.utils import _


# Add-on information variables
addon_info = {
addon_info = AddonInfo(
# add-on Name/identifier, internal for NVDA
"addon_name": "objectViewer",
addon_name="objectViewer",
# Add-on summary/title, usually the user visible name of the add-on
# Translators: Summary/title for this add-on
# to be shown on installation and add-on information found in add-on store
"addon_summary": _("Object Viewer"),
addon_summary=_("Object Viewer"),
# Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-on store
"addon_description": _("""This NVDA add-on use the GUI to view the NVDA Object."""),
addon_description=_("""This NVDA add-on use the GUI to view the NVDA Object."""),
# version
"addon_version": "0.0.1",
addon_version="0.0.1",
# Brief changelog for this version
# Translators: what's new content for the add-on version to be shown in the add-on store
addon_changelog=_("""Changelog for the add-on version.
It can span multiple lines."""),
# Author(s)
"addon_author": "hwf1324 <1398969445@qq.com>",
addon_author="hwf1324 <1398969445@qq.com>",
# URL for the add-on documentation support
"addon_url": "https://github.com/hwf1324/objectViewer",
addon_url="https://github.com/hwf1324/objectViewer",
# URL for the add-on repository where the source code can be found
"addon_sourceURL": "https://github.com/hwf1324/objectViewer",
addon_sourceURL="https://github.com/hwf1324/objectViewer",
# Documentation file name
"addon_docFileName": "readme.html",
addon_docFileName="readme.html",
# Minimum NVDA version supported (e.g. "2019.3.0", minor version is optional)
"addon_minimumNVDAVersion": "2023.1",
addon_minimumNVDAVersion="2023.1",
# Last NVDA version supported/tested (e.g. "2024.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion": "2025.1",
addon_lastTestedNVDAVersion="2025.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,
addon_updateChannel=None,
# Add-on license such as GPL 2
"addon_license": "GPL v2",
addon_license="GPL v2",
# URL for the license document the ad-on is licensed under
"addon_licenseURL": "https://www.gnu.org/licenses/gpl-2.0.html",
}
addon_licenseURL="https://www.gnu.org/licenses/gpl-2.0.html",
)

# Define the python files that are the sources of your add-on.
# You can either list every file (using ""/") as a path separator,
Expand All @@ -56,27 +60,29 @@ 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 = ["addon/globalPlugins/*.py"]
pythonSources: list[str] = ["addon/globalPlugins/*.py"]

# Files that contain strings for translation. Usually your python sources
i18nSources = pythonSources + ["buildVars.py"]
i18nSources: list[str] = 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 = []
# You can either list every file (using ""/") as a path separator,
# or use glob expressions.
excludedFiles: list[str] = []

# 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.
# You must also edit .gitignore file to specify base language files to be ignored.
baseLanguage = "en"
baseLanguage: str = "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 = []
markdownExtensions: list[str] = []

# Custom braille translation tables
# If your add-on includes custom braille tables (most will not), fill out this dictionary.
Expand All @@ -86,7 +92,7 @@ def _(arg):
# contracted (contracted (True) or uncontracted (False) braille code),
# output (shown in output table list),
# input (shown in input table list).
brailleTables = {}
brailleTables: BrailleTables = {}

# Custom speech symbol dictionaries
# Symbol dictionary files reside in the locale folder, e.g. `locale\en`, and are named `symbols-<name>.dic`.
Expand All @@ -95,4 +101,4 @@ def _(arg):
# with keys inside recording the following attributes:
# displayName (name of the speech dictionary shown to users and translatable),
# mandatory (True when always enabled, False when not.
symbolDictionaries = {}
symbolDictionaries: SymbolDictionaries = {}
1 change: 1 addition & 0 deletions manifest-translated.ini.tpl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
summary = "{addon_summary}"
description = """{addon_description}"""
changelog = """{addon_changelog}"""
1 change: 1 addition & 0 deletions manifest.ini.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description = """{addon_description}"""
author = "{addon_author}"
url = {addon_url}
version = {addon_version}
changelog = """{addon_changelog}"""
docFileName = {addon_docFileName}
minimumNVDAVersion = {addon_minimumNVDAVersion}
lastTestedNVDAVersion = {addon_lastTestedNVDAVersion}
Expand Down
Loading
Loading