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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
- id: check-hooks-apply

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
# Prevents commits to certain branches
- id: no-commit-to-branch
Expand Down Expand Up @@ -60,7 +60,7 @@ repos:
# Avoids using reserved Windows filenames.
- id: check-illegal-windows-names
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.2.0
rev: v4.0.0
hooks:
# Ruff preserves indent/new-line formatting of function arguments, list items, and similar iterables,
# if a trailing comma is added.
Expand All @@ -69,7 +69,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Matches Ruff version in pyproject.
rev: v0.12.7
rev: v0.16.1
hooks:
- id: ruff
name: lint with ruff
Expand Down
1 change: 0 additions & 1 deletion addon/globalPlugins/objectViewer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from .viewerFrame import ObjectViewerFrame


# Translators: The name of a category of NVDA commands.
# Script category for Object Viewer commands.
SCRCAT_OBJECTS_VIEWER = _("Object Viewer")
Expand Down
22 changes: 16 additions & 6 deletions addon/globalPlugins/objectViewer/viewerFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ def __init__(self, parent, namespace):
self.frameContentsSizer: wx.BoxSizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(self.frameContentsSizer)
self.frameContentsSizer.Add(
self.panel, proportion=1, flag=wx.EXPAND, border=gui.guiHelper.BORDER_FOR_DIALOGS
self.panel,
proportion=1,
flag=wx.EXPAND,
border=gui.guiHelper.BORDER_FOR_DIALOGS,
)
self.panelContentsSizer: wx.BoxSizer = wx.BoxSizer(wx.VERTICAL)
self.panel.SetSizer(self.panelContentsSizer)
Expand All @@ -48,7 +51,8 @@ def __init__(self, parent, namespace):

self.treeContentsSizer.Add(self.objectTree, proportion=1, flag=wx.EXPAND)
self.propertieContentsSizer: gui.guiHelper.BoxSizerHelper = gui.guiHelper.BoxSizerHelper(
self.panel, sizer=wx.StaticBoxSizer(wx.VERTICAL, self.panel, _("Object Properties"))
self.panel,
sizer=wx.StaticBoxSizer(wx.VERTICAL, self.panel, _("Object Properties")),
)
self.objectPropertieLabel: wx.StaticText = wx.StaticText(self.panel, label="")
font: wx.Font = wx.Font(18, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
Expand Down Expand Up @@ -80,11 +84,15 @@ def createCrust(self, namespace):

introText = _(
f"Python {sys.version.split()[0]} on {sys.platform}, NVDA {buildVersion.version}\n"
"NOTE: The 'obj' variable refers to the NVDA object selected in the tree."
"NOTE: The 'obj' variable refers to the NVDA object selected in the tree.",
)

crust = wx.py.crust.Crust(
self.panel, size=(-1, 200), locals=namespace, intro=introText, showInterpIntro=False
self.panel,
size=(-1, 200),
locals=namespace,
intro=introText,
showInterpIntro=False,
)
crust.shell.SetBufferedDraw(False)
crust.filling.text.SetBufferedDraw(False)
Expand All @@ -97,11 +105,13 @@ def makeMenuBar(self):

menu_addTreeNodesMode: wx.Menu = wx.Menu()
self.addTreeNodesChildrenMode: wx.MenuItem = menu_addTreeNodesMode.AppendRadioItem(
wx.ID_ANY, _("children")
wx.ID_ANY,
_("children"),
)
self.addTreeNodesChildrenMode.Check(config.conf["objectViewer"]["addTreeNodesMode"] == "children")
self.addTreeNodesIteratorMode: wx.MenuItem = menu_addTreeNodesMode.AppendRadioItem(
wx.ID_ANY, _("iterator")
wx.ID_ANY,
_("iterator"),
)
self.addTreeNodesIteratorMode.Check(config.conf["objectViewer"]["addTreeNodesMode"] == "iterator")
self.Bind(wx.EVT_MENU, self.onToggleAddTreeNodesMode, self.addTreeNodesChildrenMode)
Expand Down
78 changes: 43 additions & 35 deletions site_scons/site_tools/NVDATool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,25 @@

"""

from SCons.Script import Environment, Builder
from SCons.Script import Builder, Environment

from .addon import createAddonBundleFromPath
from .manifests import generateManifest, generateTranslatedManifest
from .docs import md2html
from .manifests import generateManifest, generateTranslatedManifest


def generate(env: Environment):
env.SetDefault(excludePatterns=tuple())

addonAction = env.Action(
lambda target, source, env: createAddonBundleFromPath(
source[0].abspath,
target[0].abspath,
env["excludePatterns"],
)
and None,
lambda target, source, env: (
createAddonBundleFromPath(
source[0].abspath,
target[0].abspath,
env["excludePatterns"],
)
and None
),
lambda target, source, env: f"Generating Addon {target[0]}",
)
env["BUILDERS"]["NVDAAddon"] = Builder(
Expand All @@ -53,15 +55,17 @@ def generate(env: Environment):
env.SetDefault(speechDictionaries={})

manifestAction = env.Action(
lambda target, source, env: generateManifest(
source[0].abspath,
target[0].abspath,
addon_info=env["addon_info"],
brailleTables=env["brailleTables"],
symbolDictionaries=env["symbolDictionaries"],
speechDictionaries=env["speechDictionaries"],
)
and None,
lambda target, source, env: (
generateManifest(
source[0].abspath,
target[0].abspath,
addon_info=env["addon_info"],
brailleTables=env["brailleTables"],
symbolDictionaries=env["symbolDictionaries"],
speechDictionaries=env["speechDictionaries"],
)
and None
),
lambda target, source, env: f"Generating manifest {target[0]}",
)
env["BUILDERS"]["NVDAManifest"] = Builder(
Expand All @@ -71,16 +75,18 @@ def generate(env: Environment):
)

translatedManifestAction = env.Action(
lambda target, source, env: generateTranslatedManifest(
source[1].abspath,
target[0].abspath,
mo=source[0].abspath,
addon_info=env["addon_info"],
brailleTables=env["brailleTables"],
symbolDictionaries=env["symbolDictionaries"],
speechDictionaries=env["speechDictionaries"],
)
and None,
lambda target, source, env: (
generateTranslatedManifest(
source[1].abspath,
target[0].abspath,
mo=source[0].abspath,
addon_info=env["addon_info"],
brailleTables=env["brailleTables"],
symbolDictionaries=env["symbolDictionaries"],
speechDictionaries=env["speechDictionaries"],
)
and None
),
lambda target, source, env: f"Generating translated manifest {target[0]}",
)

Expand All @@ -93,14 +99,16 @@ def generate(env: Environment):
env.SetDefault(mdExtensions={})

mdAction = env.Action(
lambda target, source, env: md2html(
source[0].path,
target[0].path,
moFile=env["moFile"].path if env["moFile"] else None,
mdExtensions=env["mdExtensions"],
addon_info=env["addon_info"],
)
and None,
lambda target, source, env: (
md2html(
source[0].path,
target[0].path,
moFile=env["moFile"].path if env["moFile"] else None,
mdExtensions=env["mdExtensions"],
addon_info=env["addon_info"],
)
and None
),
lambda target, source, env: f"Generating {target[0]}",
)
env["BUILDERS"]["md2html"] = env.Builder(
Expand Down
2 changes: 1 addition & 1 deletion site_scons/site_tools/NVDATool/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def matchesNoPatterns(path: Path, patterns: Iterable[str]) -> bool:
"""Checks if the path, the first argument, does not match any of the patterns passed as the second argument."""
return not any((path.match(pattern) for pattern in patterns))
return not any(path.match(pattern) for pattern in patterns)


def createAddonBundleFromPath(path: str | Path, dest: str, excludePatterns: Iterable[str]):
Expand Down
2 changes: 1 addition & 1 deletion site_scons/site_tools/NVDATool/manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import gettext
from functools import partial

from .typings import AddonInfo, BrailleTables, SymbolDictionaries, SpeechDictionaries
from .typings import AddonInfo, BrailleTables, SpeechDictionaries, SymbolDictionaries
from .utils import format_nested_section


Expand Down
2 changes: 1 addition & 1 deletion site_scons/site_tools/NVDATool/typings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TypedDict, Protocol
from typing import Protocol, TypedDict


class AddonInfo(TypedDict):
Expand Down
Loading