Skip to content

Commit 925c3d6

Browse files
committed
Version 25.1.1
* Added support for NVDA 2025.1. * Now the driver looks for the audio output in two config paths. * Deleted the audio output change handler. This was created because in some cases the driver was not synchronized with the current audio output, it needs more testing but seems that this doesn't happen in wasapi mode. * Git repo: added a better support for vscode. Update the path with the NVDA files if needed.
1 parent 061fbfd commit 925c3d6

File tree

6 files changed

+70
-35
lines changed

6 files changed

+70
-35
lines changed

.github/workflows/release-on-tag.yaml renamed to .github/workflows/build_addon.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ on:
55
push:
66
tags:
77
['*']
8+
pull_request:
9+
branches: [ main, master ]
810
workflow_dispatch:
911

1012
jobs:
1113
build:
1214
runs-on: ubuntu-latest
1315
steps:
1416
- name: Checkout code
15-
uses: actions/checkout@v3
16-
- run: echo -e "scons\nmarkdown">requirements.txt
17+
uses: actions/checkout@v4
1718
- name: Set up Python
18-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
1920
with:
2021
python-version: 3.11
2122
cache: 'pip'
@@ -43,7 +44,7 @@ jobs:
4344
run: awk '/^# / && !flag {flag=1; next} /^# / && flag {exit} flag && NF' changelog.md > newChanges.md
4445
- name: Calculate sha256
4546
run: sha256sum *.nvda-addon >> newChanges.md
46-
- uses: actions/upload-artifact@v3
47+
- uses: actions/upload-artifact@v4
4748
with:
4849
name: packaged_addon
4950
path: |
@@ -56,12 +57,12 @@ jobs:
5657
needs: ["build"]
5758
steps:
5859
- name: download releases files
59-
uses: actions/download-artifact@v3
60+
uses: actions/download-artifact@v4
6061
- name: Display structure of downloaded files
6162
run: ls -R
6263

6364
- name: Release
64-
uses: softprops/action-gh-release@v1
65+
uses: softprops/action-gh-release@v2
6566
with:
6667
body_path: packaged_addon/newChanges.md
6768
files: packaged_addon/*.nvda-addon

.vscode/typings/__builtins__.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def _(msg: str) -> str:
2+
...
3+
4+
5+
def pgettext(context: str, message: str) -> str:
6+
...

addon/synthDrivers/_ibmeci.py

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
import queue
1010

1111
import threading, time
12-
import config, languageHandler, nvwave, addonHandler
12+
import languageHandler, nvwave, addonHandler
13+
from config import conf
1314
from logHandler import log
1415
from fileUtils import getFileVersionInfo
15-
from ._settingsDB import appConfig, speechConfig
16+
from ._settingsDB import appConfig
1617

1718
addonHandler.initTranslation()
1819

@@ -297,7 +298,7 @@ def eciNew():
297298
avLangs=(c_int*b.value)()
298299
eci.eciGetAvailableLanguages(byref(avLangs),byref(b))
299300
try:
300-
handle=eci.eciNewEx(int(speechConfig.ibmtts['voice']))
301+
handle=eci.eciNewEx(int(conf['speech']['ibmeci']['voice']))
301302
except:
302303
handle=eci.eciNewEx(getVoiceByLanguage(languageHandler.getLanguage())[0])
303304
for i in ECIVoiceParam.params:
@@ -407,7 +408,7 @@ def initialize(indexCallback, doneCallback):
407408
callbackQueue = queue.Queue()
408409
callbackThread = CallbackThread()
409410
callbackThread.start()
410-
toggleProbileSwitchRegistration(config.post_configProfileSwitch.register)
411+
411412

412413
def speak(text):
413414
# deleted the following fix because is incompatible with NVDA's speech change command. Now send it from speak in ibmeci.py
@@ -450,7 +451,6 @@ def terminate():
450451
idleTimer.cancel()
451452
player.close()
452453
callbackQueue= callbackThread= dll= eciQueue=eciThread= handle= idleTimer= onDoneSpeaking= onIndexReached= player = None
453-
toggleProbileSwitchRegistration(config.post_configProfileSwitch.unregister)
454454

455455

456456
def setVoice(vl):
@@ -547,7 +547,10 @@ def idlePlayer():
547547

548548
def createPlayer(sampleRate):
549549
global currentSoundcardOutput, currentSampleRate
550-
currentSoundcardOutput = speechConfig.outputDevice
550+
try:
551+
currentSoundcardOutput = conf['speech']['outputDevice']
552+
except:
553+
currentSoundcardOutput = conf["audio"]["outputDevice"]
551554
currentSampleRate = sampleRate
552555
if sampleRate == 0:
553556
player = nvwave.WavePlayer(1, 8000, 16, outputDevice=currentSoundcardOutput)
@@ -558,24 +561,3 @@ def createPlayer(sampleRate):
558561
else:
559562
player = nvwave.WavePlayer(1, 11025, 16, outputDevice=currentSoundcardOutput)
560563
return player
561-
562-
def handleSoundcardChange():
563-
global currentSoundcardOutput, currentSampleRate, player
564-
# if player is none, this driver is not active.
565-
# This may occur because post_configProfileSwitch.unregister is delaied by 1 second.
566-
if player and currentSoundcardOutput != speechConfig.outputDevice:
567-
player.close()
568-
player = createPlayer(currentSampleRate)
569-
570-
profileSwitchRegister = None
571-
def toggleProbileSwitchRegistration(fn):
572-
""" the register or unregister of the handler for config changes can't be done when a profile switch is being done.
573-
this function helps to avoid that.
574-
fn: the function to be called (usually register or unregister)
575-
"""
576-
global profileSwitchRegister
577-
if profileSwitchRegister:
578-
profileSwitchRegister.cancel()
579-
profileSwitchRegister = None
580-
profileSwitchRegister = threading.Timer(1, fn, [handleSoundcardChange])
581-
profileSwitchRegister.start()

buildVars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
2020
"addon_description" : _("""This is the IBMTTS synthesizer driver for NVDA."""),
2121
# version
22-
"addon_version" : "23.12.1",
22+
"addon_version" : "25.1.1",
2323
# Author(s)
2424
"addon_author" : u"David CM <[email protected]>, x0 and others",
2525
# URL for the add-on documentation support
@@ -29,7 +29,7 @@
2929
# Minimum NVDA version supported (e.g. "2018.3.0")
3030
"addon_minimumNVDAVersion" : "2019.3.0",
3131
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
32-
"addon_lastTestedNVDAVersion" : "2024.2.0",
32+
"addon_lastTestedNVDAVersion" : "2025.1.0",
3333
# Add-on update channel (default is stable or None)
3434
"addon_updateChannel" : None,
3535
# Add-on license such as GPL 2

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Version 25.1.1
2+
3+
* Added support for NVDA 2025.1.
4+
* Now the driver looks for the audio output in two config paths.
5+
* Deleted the audio output change handler. This was created because in some cases the driver was not synchronized with the current audio output, it needs more testing but seems that this doesn't happen in wasapi mode.
6+
17
# Version 23.12.1
28

39
* Updated support for NVDA 2024.2.

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[tool.ruff]
2+
line-length = 110
3+
4+
builtins = [
5+
# translation lookup
6+
"_",
7+
# translation lookup
8+
"ngettext",
9+
# translation lookup
10+
"pgettext",
11+
# translation lookup
12+
"npgettext",
13+
]
14+
15+
include = [
16+
"*.py",
17+
"sconstruct",
18+
]
19+
20+
exclude = [
21+
".git",
22+
"__pycache__",
23+
]
24+
25+
[tool.ruff.format]
26+
indent-style = "tab"
27+
28+
[tool.ruff.lint.mccabe]
29+
max-complexity = 15
30+
31+
[tool.ruff.lint]
32+
ignore = [
33+
# indentation contains tabs
34+
"W191",
35+
]
36+
37+
[tool.ruff.lint.per-file-ignores]
38+
# sconstruct contains many inbuilt functions not recognised by the lint,
39+
# so ignore F821.
40+
"sconstruct" = ["F821"]

0 commit comments

Comments
 (0)