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
3 changes: 2 additions & 1 deletion .github/scripts/checkTranslation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

import sys
import os
import sys

from crowdin_api import CrowdinClient


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
$curDate = Get-Date -Format "yyyyMMdd"
$curYear = Get-Date -Format "yyyy"
$tagName = "v" + (Get-Date -Format "yy.MM.dd")

echo "CUR_DATE=$curDate" >> $env:GITHUB_ENV
echo "CUR_YEAR=$curYear" >> $env:GITHUB_ENV
echo "TAG_NAME=$tagName" >> $env:GITHUB_ENV
Expand Down
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
41 changes: 20 additions & 21 deletions addon/globalPlugins/dayOfTheWeek.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# globalPlugins/dayOfTheWeek.py.

# Allows you to find the day of the week corresponding to a chosen date
Expand All @@ -9,24 +7,25 @@
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

from __future__ import unicode_literals
import addonHandler
import globalPluginHandler
import locale
import buildVersion
from scriptHandler import script
import speech
import re
from collections.abc import Callable
import keyboardHandler

import addonHandler
import api
import buildVersion
import config
import controlTypes
import globalPluginHandler
import gui
import keyboardHandler
import speech
import wx
import wx.adv
import gui
from gui.settingsDialogs import SettingsPanel as SettingsDialog, NVDASettingsDialog
from gui.settingsDialogs import NVDASettingsDialog
from gui.settingsDialogs import SettingsPanel as SettingsDialog
from NVDAObjects.IAccessible import IAccessible
import config
from scriptHandler import script

addonHandler.initTranslation()
_: Callable[[str], str]
Expand Down Expand Up @@ -89,15 +88,15 @@ class DateDialog(wx.Dialog):

def __new__(cls, *args, **kwargs):
if DateDialog._instance is None:
return super(DateDialog, cls).__new__(cls, *args, **kwargs)
return super().__new__(cls, *args, **kwargs)
return DateDialog._instance

def __init__(self, parent):
if DateDialog._instance is not None:
return
DateDialog._instance = self
dlgTitle = _("Get the day of the week")
super(DateDialog, self).__init__(parent, title=dlgTitle)
super().__init__(parent, title=dlgTitle)
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.dateLabel = _("Type or select a date")

Expand Down Expand Up @@ -203,7 +202,7 @@ def onOk(self, evt):
config.conf["dayOfWeek"]["reportFieldsValuesWhenMovingVertically"] = (
self.reportDateFieldValuesCheckBox.GetValue()
)
super(DayOfWeekSettingsDialog, self).onOk(evt)
super().onOk(evt)

def onSave(self):
config.conf["dayOfWeek"]["enableAnnounces"] = self.enableAnnouncesCheckBox.GetValue()
Expand All @@ -222,15 +221,15 @@ class AnnounceFieldsLabels(IAccessible):

def event_gainFocus(self):
global curDateField
super(AnnounceFieldsLabels, self).event_gainFocus()
super().event_gainFocus()
if curDateField == 0:
curDateField += 1
self.calculateCurField()

def event_valueChange(self):
if self.increment:
return
super(AnnounceFieldsLabels, self).event_valueChange()
super().event_valueChange()

def isUS(self):
return "US" in locale.getdefaultlocale()[0]
Expand All @@ -245,15 +244,15 @@ def sayField(self, curValue, columnID=None):
labelAnnounce = fieldLabels[columnID - 1][0]
else:
labelAnnounce = fieldLabels[columnID - 1][1]
field = "{0}, {1}".format(curValue, labelAnnounce) if columnID else curValue
field = f"{curValue}, {labelAnnounce}" if columnID else curValue
ui.message(field)

def getDelimiter(self, value):
ptrn = r"^[\d]{1,4}([\./-]).+$"
rg = re.compile(ptrn)
return rg.match(value).group(1)

def whatChanged(self, val1, val2): # noqa: C901
def whatChanged(self, val1, val2):
global curDateField
isYear = False
isMonth = False
Expand Down Expand Up @@ -406,7 +405,7 @@ def whatChanged(self, val1, val2): # noqa: C901
if config.conf["dayOfWeek"]["reportFieldsValuesWhenMovingVertically"]:
self.sayField(curValue)
else:
super(AnnounceFieldsLabels, self).event_valueChange()
super().event_valueChange()

def leftOrRight(self, value, flag=None):
if flag:
Expand Down Expand Up @@ -470,7 +469,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
scriptCategory = ADDON_SUMMARY

def __init__(self, *args, **kwargs):
super(GlobalPlugin, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
NVDASettingsDialog.categoryClasses.append(DayOfWeekSettingsDialog)
self.createMenu()

Expand Down
1 change: 0 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
## Changes for 20260727.0.0

* Updated translations from Crowdin

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