27 Commits

Author SHA1 Message Date
0bd28be7b8 fix regression, login should allow a return value of 1. 2026-03-19 05:42:35 +00:00
f458fb8d0e minor bump 2026-03-19 05:33:25 +00:00
4c34028194 improve the feedback for some of the binds:
- solo + mc will give error warning if not currently using a Strip controller.
- karaoke and mc will give error warning if the Strip controller doesn't have the correct index.
- bus assignments will give error warning if not on a Strip controller.

mono now toggles for the Strip controller but rotates through modes for the Bus controller.
2026-03-19 05:33:16 +00:00
84ee479bf1 Controller no longer subclasses Binds.
add some wrapper methods to binds
2026-03-19 05:26:19 +00:00
c3b06cae51 remove on: pull_request 2026-03-19 04:00:42 +00:00
4c176cfd77 patch bump
upd ruff config
2026-03-19 03:58:44 +00:00
df023c67ea add bump task 2026-03-19 03:58:28 +00:00
8b025206b1 rename exceptions + lint fixes 2026-03-19 03:51:36 +00:00
8e8e3ce8a5 upd pdm badge 2026-02-22 11:40:08 +00:00
e565283827 upd tag pattern 2025-02-18 11:25:00 +00:00
2d194e8e67 upd build_addon workflow 2025-02-18 11:24:02 +00:00
3aab5922ab rename build command to avoid overriding built-in 2025-02-14 23:33:34 +00:00
1fb435416f run scons with pdm 2025-02-14 14:32:53 +00:00
40aaeb4c54 add ignore 2025-02-14 11:57:43 +00:00
17cdd84c51 add Taskfile
invoke tasks from pdm
2025-02-14 11:44:52 +00:00
43379f1b09 fix path in release step 2025-01-24 01:41:40 +00:00
dc9ac5ddc3 add name to download action 2025-01-24 01:31:27 +00:00
9764b9d827 upd workflow 2025-01-24 01:05:57 +00:00
d95a2280c6 minor bump
update README with example bits in config
2025-01-24 00:49:55 +00:00
5534381981 reduce min supported version to 2022.1.0 (unsure if this is earliest it will work so we'll see) 2025-01-24 00:49:41 +00:00
0522b69420 read bits from config, defaults to cdll.BITS
reflect change in script_announce_voicemeeter_version
2025-01-24 00:48:59 +00:00
68462016a5 repackage with pdm
add pdm build/copy scripts

update README
2025-01-23 20:05:50 +00:00
b090c359b4 re-run through ruff formatter 2025-01-23 20:04:48 +00:00
1b5cfacf4f Merge pull request #1 from onyx-and-iris/dependabot/github_actions/dot-github/workflows/actions/download-artifact-4.1.7
Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows
2024-09-04 09:23:37 +01:00
dependabot[bot]
30c2608e6c Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-04 08:19:42 +00:00
b988879c86 fix nvda link 2023-10-01 12:19:54 +01:00
8a79005d6f adds badges, links to README 2023-10-01 12:18:20 +01:00
18 changed files with 597 additions and 242 deletions

View File

@@ -1,46 +1,35 @@
name: build addon name: Build Addon
on: on:
push: push:
tags: ["*"] tags:
# To build on main/master branch, uncomment the following line: - 'v*.*.*'
# branches: [ main , master ]
pull_request:
branches: [ main, master ]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - name: Checkout code
uses: actions/checkout@v4
- run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt - name: Set up PDM
uses: pdm-project/setup-pdm@v4
- name: Set up Python
uses: actions/setup-python@v4
with: with:
python-version: 3.9 python-version: '3.11'
cache: 'pip'
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip wheel pdm sync -d -G build
pip install -r requirements.txt
sudo apt-get update -y
sudo apt-get install -y gettext
- name: Code checks - name: Build addon
run: export SKIP=no-commit-to-branch; pre-commit run --all run: pdm run scons
- name: building addon - name: Upload build artifacts
run: scons if: success()
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with: with:
name: packaged_addon name: packaged_addon
path: ./*.nvda-addon path: ./*.nvda-addon
@@ -48,17 +37,20 @@ jobs:
upload_release: upload_release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }} if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: ["build"] needs: build
steps: steps:
- uses: actions/checkout@v3 - name: Download releases files
- name: download releases files uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3 with:
name: packaged_addon
- name: Display structure of downloaded files - name: Display structure of downloaded files
run: ls -R run: tree
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: packaged_addon/*.nvda-addon files: ./*.nvda-addon
fail_on_unmatched_files: true fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref, '-') }} prerelease: ${{ contains(github.ref, '-') }}

178
.gitignore vendored
View File

@@ -1,3 +1,179 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file
.pypirc
# NVDA
addon/doc/*.css addon/doc/*.css
addon/doc/en/ addon/doc/en/
*_docHandler.py *_docHandler.py
@@ -10,5 +186,5 @@ manifest.ini
.sconsign.dblite .sconsign.dblite
/[0-9]*.[0-9]*.[0-9]*.json /[0-9]*.[0-9]*.[0-9]*.json
.venv/ # testing
keybinds.json keybinds.json

View File

@@ -1,6 +1,13 @@
[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
# NVDA Addon Voicemeeter # NVDA Addon Voicemeeter
Control Voicemeeter with global hotkeys. Control [Voicemeeter][voicemeeter] with global hotkeys.
## Requirements
- [NVDA screen reader][nvda]
## Install ## Install
@@ -78,6 +85,7 @@ example:
```json ```json
{ {
"voicemeeter": "banana", "voicemeeter": "banana",
"bits": 64,
"keybinds": { "keybinds": {
"NVDA+alt+k": "strip_mode", "NVDA+alt+k": "strip_mode",
"NVDA+alt+l": "bus_mode", "NVDA+alt+l": "bus_mode",
@@ -113,8 +121,12 @@ example:
Would make the following changes: Would make the following changes:
- load the plugin in `banana` mode (default is potato) - load the plugin in `banana` mode (default is potato)
- override the bits of Voicemeeter GUI to 64 (default is 32)
- change the `strip_mode` and `bus_mode` binds to `NVDA+alt+k` and `NVDA+alt+l` respectively - change the `strip_mode` and `bus_mode` binds to `NVDA+alt+k` and `NVDA+alt+l` respectively
- change the `announce_voicemeeter_version` bind to `NVDA+shift+z` - change the `announce_voicemeeter_version` bind to `NVDA+shift+z`
- changes the bus assignment binds to `NVDA+control+number` - changes the bus assignment binds to `NVDA+control+number`
All other binds would then be defaults. All other binds would then be defaults.
[voicemeeter]: https://voicemeeter.com/
[nvda]: https://www.nvaccess.org/

41
Taskfile.yml Normal file
View File

@@ -0,0 +1,41 @@
version: '3'
vars:
SHELL: pwsh
tasks:
default:
desc: Build the addon
cmds:
- task: build
copy:
desc: Copy sources files to scratchpad directory
platforms: [windows]
vars:
SOURCE: addon\globalPlugins\voicemeeter
DEST: ${env:appdata}\nvda\scratchpad\globalPlugins\voicemeeter\
cmds:
- "{{.SHELL}} -Command 'robocopy {{.SOURCE}} {{.DEST}} /NDL'"
ignore_error: true
build:
desc: Build the addon
platforms: [windows]
cmds:
- '{{.SHELL}} -Command "pdm run scons"'
bump:
desc: Bump the version number
preconditions:
- sh: '{{.SHELL}} -c "if (Get-Command bump) { exit 0 } else { exit 1 }"'
msg: "The 'bump' command is not available. Run `go install github.com/onyx-and-iris/bump/cmd/bump@latest`."
cmds:
- |
{{if eq .CLI_ARGS "show"}}
{{.SHELL}} -c "bump show -f buildVars.py -p \"'addon_version': '(\d+\.\d+\.\d+)'\""
{{.SHELL}} -c "bump show -f pyproject.toml -p \"version = .(\d+\.\d+\.\d+).\""
{{else}}
{{.SHELL}} -c "bump {{.CLI_ARGS}} -w -f buildVars.py -p \"'addon_version': '(\d+\.\d+\.\d+)'\""
{{.SHELL}} -c "bump {{.CLI_ARGS}} -w -f pyproject.toml -p \"version = .(\d+\.\d+\.\d+).\""
{{end}}

View File

@@ -9,7 +9,7 @@ from .kinds import KindId, request_kind_map
class GlobalPlugin(CommandsMixin, globalPluginHandler.GlobalPlugin): class GlobalPlugin(CommandsMixin, globalPluginHandler.GlobalPlugin):
__kind_id = config.get("voicemeeter", "potato") __kind_id = config.get('voicemeeter', 'potato')
__gestures = util._make_gestures(__kind_id) __gestures = util._make_gestures(__kind_id)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@@ -2,7 +2,7 @@ import ctypes as ct
from ctypes.wintypes import CHAR, FLOAT, LONG from ctypes.wintypes import CHAR, FLOAT, LONG
from .cdll import libc from .cdll import libc
from .error import VMCAPIError from .error import VMAddonCAPIError
class Binds: class Binds:
@@ -38,8 +38,32 @@ class Binds:
bind_set_parameter_float.restype = LONG bind_set_parameter_float.restype = LONG
bind_set_parameter_float.argtypes = [ct.POINTER(CHAR), FLOAT] bind_set_parameter_float.argtypes = [ct.POINTER(CHAR), FLOAT]
def call(self, fn, *args, ok=(0,)): def _call(self, fn, *args, ok=(0,)):
retval = fn(*args) retval = fn(*args)
if retval not in ok: if retval not in ok:
raise VMCAPIError(fn.__name__, retval) raise VMAddonCAPIError(fn.__name__, retval)
return retval return retval
def login(self):
return self._call(self.bind_login, ok=(0, 1))
def logout(self):
return self._call(self.bind_logout)
def run_voicemeeter(self, kind_val):
return self._call(self.bind_run_voicemeeter, kind_val)
def get_voicemeeter_type(self, c_type):
return self._call(self.bind_get_voicemeeter_type, ct.byref(c_type))
def get_voicemeeter_version(self, ver):
return self._call(self.bind_get_voicemeeter_version, ct.byref(ver))
def is_parameters_dirty(self):
return self._call(self.bind_is_parameters_dirty, ok=(0, 1))
def get_parameter_float(self, param, buf):
return self._call(self.bind_get_parameter_float, param, ct.byref(buf))
def set_parameter_float(self, param, val):
return self._call(self.bind_set_parameter_float, param, val)

View File

@@ -1,49 +1,54 @@
import ctypes as ct import ctypes as ct
import platform import platform
import winreg
from pathlib import Path from pathlib import Path
from .error import VMError from .error import VMAddonError
try:
import winreg
except ImportError as e:
ERR_MSG = 'winreg module not found, only Windows OS supported'
raise VMAddonError(ERR_MSG) from e
# Defense against edge cases where winreg imports but we're not on Windows
if platform.system() != 'Windows':
ERR_MSG = f'Unsupported OS: {platform.system()}, only Windows OS supported'
raise VMAddonError(ERR_MSG)
BITS = 64 if ct.sizeof(ct.c_voidp) == 8 else 32 BITS = 64 if ct.sizeof(ct.c_voidp) == 8 else 32
if platform.system() != "Windows": VM_KEY = 'VB:Voicemeeter {17359A74-1236-5467}'
raise VMError("Only Windows OS supported") REG_KEY = '\\'.join(
VM_KEY = "VB:Voicemeeter {17359A74-1236-5467}"
REG_KEY = "\\".join(
filter( filter(
None, None,
( (
"SOFTWARE", 'SOFTWARE',
"WOW6432Node" if BITS == 64 else "", 'WOW6432Node' if BITS == 64 else '',
"Microsoft", 'Microsoft',
"Windows", 'Windows',
"CurrentVersion", 'CurrentVersion',
"Uninstall", 'Uninstall',
), ),
) )
) )
def get_vmpath(): def get_vmpath():
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"{}".format("\\".join((REG_KEY, VM_KEY)))) as vm_key: with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'{}'.format('\\'.join((REG_KEY, VM_KEY)))) as vm_key:
return winreg.QueryValueEx(vm_key, r"UninstallString")[0] return winreg.QueryValueEx(vm_key, r'UninstallString')[0]
try: try:
vm_parent = Path(get_vmpath()).parent vm_parent = Path(get_vmpath()).parent
except FileNotFoundError as e: except FileNotFoundError as e:
raise VMError("Unable to fetch DLL path from the registry") from e ERR_MSG = 'Voicemeeter installation not found in registry'
raise VMAddonError(ERR_MSG) from e
DLL_NAME = f'VoicemeeterRemote{"64" if BITS == 64 else ""}.dll' DLL_NAME = f'VoicemeeterRemote{"64" if BITS == 64 else ""}.dll'
dll_path = vm_parent.joinpath(DLL_NAME) dll_path = vm_parent.joinpath(DLL_NAME)
if not dll_path.is_file(): if not dll_path.is_file():
raise VMError(f"Could not find {dll_path}") ERR_MSG = f'Could not find {dll_path}'
raise VMAddonError(ERR_MSG)
if BITS == 64: libc = ct.WinDLL(str(dll_path))
libc = ct.CDLL(str(dll_path))
else:
libc = ct.WinDLL(str(dll_path))

View File

@@ -8,93 +8,137 @@ class CommandsMixin:
### ANNOUNCEMENTS ### ### ANNOUNCEMENTS ###
def script_announce_voicemeeter_version(self, _): def script_announce_voicemeeter_version(self, _):
ui.message(f"Running Voicemeeter {self.kind} {self.controller.version}") ui.message(f'Running Voicemeeter {self.kind} {self.controller.version} {self.controller.bits} bit')
def script_announce_controller(self, _): def script_announce_controller(self, _):
ui.message(f"Controller for {self.controller.ctx.strategy} {self.controller.ctx.index + 1}") ui.message(f'Controller for {self.controller.ctx.strategy} {self.controller.ctx.index + 1}')
### ALTER THE CONTEXT ### ### ALTER THE CONTEXT ###
def script_strip_mode(self, _): def script_strip_mode(self, _):
if self.controller.ctx.index >= self.kind.num_strip: if self.controller.ctx.index >= self.kind.num_strip:
ui.message(f"Controller strip {self.controller.ctx.index + 1} does not exist for Voicemeeter {self.kind}") ui.message(f'Controller strip {self.controller.ctx.index + 1} does not exist for Voicemeeter {self.kind}')
return return
self.controller.ctx.strategy = context.StripStrategy(self.controller, self.controller.ctx.index) self.controller.ctx.strategy = context.StripStrategy(self.controller, self.controller.ctx.index)
ui.message(f"Controller for strip {self.controller.ctx.index + 1}") ui.message(f'Controller for strip {self.controller.ctx.index + 1}')
log.info(f"INFO - strip {self.controller.ctx.index} mode") log.info(f'INFO - strip {self.controller.ctx.index} mode')
def script_bus_mode(self, _): def script_bus_mode(self, _):
if self.controller.ctx.index >= self.kind.num_bus: if self.controller.ctx.index >= self.kind.num_bus:
ui.message(f"Controller bus {self.controller.ctx.index + 1} does not exist for Voicemeeter {self.kind}") ui.message(f'Controller bus {self.controller.ctx.index + 1} does not exist for Voicemeeter {self.kind}')
return return
self.controller.ctx.strategy = context.BusStrategy(self.controller, self.controller.ctx.index) self.controller.ctx.strategy = context.BusStrategy(self.controller, self.controller.ctx.index)
ui.message(f"Controller for {self.controller.ctx.strategy} {self.controller.ctx.index + 1}") ui.message(f'Controller for {self.controller.ctx.strategy} {self.controller.ctx.index + 1}')
log.info(f"INFO - {self.controller.ctx.strategy} {self.controller.ctx.index} mode") log.info(f'INFO - {self.controller.ctx.strategy} {self.controller.ctx.index} mode')
def script_index(self, gesture): def script_index(self, gesture):
proposed = int(gesture.displayName[-1]) proposed = int(gesture.displayName[-1])
self.controller.ctx.index = proposed - 1 self.controller.ctx.index = proposed - 1
ui.message(f"Controller for {self.controller.ctx.strategy} {self.controller.ctx.index + 1}") ui.message(f'Controller for {self.controller.ctx.strategy} {self.controller.ctx.index + 1}')
log.info(f"INFO - {self.controller.ctx.strategy} {self.controller.ctx.index} mode") log.info(f'INFO - {self.controller.ctx.strategy} {self.controller.ctx.index} mode')
def __set_slider_mode(self, mode): def __set_slider_mode(self, mode):
self.controller.ctx.slider_mode = mode self.controller.ctx.slider_mode = mode
ui.message(f"{mode} mode enabled") ui.message(f'{mode} mode enabled')
def script_gain_mode(self, _): def script_gain_mode(self, _):
self.__set_slider_mode("gain") self.__set_slider_mode('gain')
def script_comp_mode(self, _): def script_comp_mode(self, _):
self.__set_slider_mode("comp") self.__set_slider_mode('comp')
def script_gate_mode(self, _): def script_gate_mode(self, _):
self.__set_slider_mode("gate") self.__set_slider_mode('gate')
def script_denoiser_mode(self, _): def script_denoiser_mode(self, _):
self.__set_slider_mode("denoiser") self.__set_slider_mode('denoiser')
def script_audibility_mode(self, _): def script_audibility_mode(self, _):
self.__set_slider_mode("audibility") self.__set_slider_mode('audibility')
# Mono is a special case because the parameter is a boolean for strips and an int for buses
def script_rotate_mono(self, _):
if isinstance(self.controller.ctx.strategy, context.StripStrategy):
val = not self.controller.ctx.get_bool('mono')
self.controller.ctx.set_bool('mono', val)
ui.message('on' if val else 'off')
else:
opts = ['off', 'on', 'stereo reverse']
val = self.controller.ctx.get_int('mono')
new_val = (val + 1) % len(opts)
self.controller.ctx.set_int('mono', new_val)
ui.message(opts[new_val])
### BOOLEAN PARAMETERS ### ### BOOLEAN PARAMETERS ###
def script_toggle_mono(self, _):
val = not self.controller.ctx.get_bool("mono")
self.controller.ctx.set_bool("mono", val)
ui.message("on" if val else "off")
def script_toggle_solo(self, _): def script_toggle_solo(self, _):
val = not self.controller.ctx.get_bool("solo") if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
self.controller.ctx.set_bool("solo", val) ui.message('Solo only available for strips')
ui.message("on" if val else "off") return
val = not self.controller.ctx.get_bool('solo')
self.controller.ctx.set_bool('solo', val)
ui.message('on' if val else 'off')
def script_toggle_mute(self, _): def script_toggle_mute(self, _):
val = not self.controller.ctx.get_bool("mute") val = not self.controller.ctx.get_bool('mute')
self.controller.ctx.set_bool("mute", val) self.controller.ctx.set_bool('mute', val)
ui.message("on" if val else "off") ui.message('on' if val else 'off')
def script_toggle_mc(self, _): def script_toggle_mc(self, _):
val = not self.controller.ctx.get_bool("mc") if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
self.controller.ctx.set_bool("mc", val) ui.message('MC only available for strips')
ui.message("on" if val else "off") return
valid_indices = [self.kind.phys_in + 1]
match self.kind.name:
case 'potato':
valid_indices.append(self.kind.phys_in + self.kind.virt_in)
if self.controller.ctx.index + 1 not in valid_indices:
if len(valid_indices) == 1:
ui.message(f'MC only available for strip {valid_indices[0]} for Voicemeeter {self.kind}')
else:
ui.message(
f'MC only available for strips {valid_indices[0]} and {valid_indices[1]} for Voicemeeter {self.kind}'
)
return
val = not self.controller.ctx.get_bool('mc')
self.controller.ctx.set_bool('mc', val)
ui.message('on' if val else 'off')
def script_karaoke(self, _): def script_karaoke(self, _):
opts = ["off", "k m", "k 1", "k 2", "k v"] if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
val = self.controller.ctx.get_int("karaoke") + 1 ui.message('Karaoke mode only available for strips')
if val == len(opts): return
val = 0
self.controller.ctx.set_int("karaoke", val) valid_index = self.kind.phys_in + self.kind.virt_in - 1
ui.message(opts[val]) # controller index is 0 based and the gesture display is 1 based, so subtract 1 from valid_index
if self.controller.ctx.index != valid_index - 1:
ui.message(f'Karaoke mode only available for strip {valid_index} for Voicemeeter {self.kind}')
return
opts = ['off', 'k m', 'k 1', 'k 2', 'k v']
val = self.controller.ctx.get_int('karaoke')
new_val = (val + 1) % len(opts)
self.controller.ctx.set_int('karaoke', new_val)
ui.message(opts[new_val])
def script_bus_assignment(self, gesture): def script_bus_assignment(self, gesture):
if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
ui.message('Bus assignment only available for strips')
return
proposed = int(gesture.displayName[-1]) proposed = int(gesture.displayName[-1])
if proposed - 1 < self.kind.phys_out: if proposed - 1 < self.kind.phys_out:
output = f"A{proposed}" output = f'A{proposed}'
else: else:
output = f"B{proposed - self.kind.phys_out}" output = f'B{proposed - self.kind.phys_out}'
val = not self.controller.ctx.get_bool(output) val = not self.controller.ctx.get_bool(output)
self.controller.ctx.set_bool(output, val) self.controller.ctx.set_bool(output, val)
ui.message("on" if val else "off") ui.message('on' if val else 'off')
### CONTROL SLIDERS ### ### CONTROL SLIDERS ###

View File

@@ -3,10 +3,10 @@ from pathlib import Path
def config_from_json(): def config_from_json():
pn = Path.home() / "Documents" / "Voicemeeter" / "nvda_settings.json" pn = Path.home() / 'Documents' / 'Voicemeeter' / 'nvda_settings.json'
data = None data = None
if pn.exists(): if pn.exists():
with open(pn, "r") as f: with open(pn, 'r') as f:
data = json.load(f) data = json.load(f)
return data or {} return data or {}

View File

@@ -5,7 +5,7 @@ class Strategy(ABC):
def __init__(self, controller, index): def __init__(self, controller, index):
self._controller = controller self._controller = controller
self._index = index self._index = index
self._slider_mode = "gain" self._slider_mode = 'gain'
@abstractmethod @abstractmethod
def identifier(self): def identifier(self):
@@ -28,40 +28,40 @@ class Strategy(ABC):
self._slider_mode = val self._slider_mode = val
def get_bool(self, param: str) -> bool: def get_bool(self, param: str) -> bool:
return self._controller._get(f"{self.identifier}.{param}") == 1 return self._controller.get(f'{self.identifier}.{param}') == 1
def set_bool(self, param: str, val: bool): def set_bool(self, param: str, val: bool):
self._controller._set(f"{self.identifier}.{param}", 1 if val else 0) self._controller.set(f'{self.identifier}.{param}', 1 if val else 0)
def get_float(self, param: str) -> float: def get_float(self, param: str) -> float:
return round(self._controller._get(f"{self.identifier}.{param}"), 1) return round(self._controller.get(f'{self.identifier}.{param}'), 1)
def set_float(self, param: str, val: float): def set_float(self, param: str, val: float):
self._controller._set(f"{self.identifier}.{param}", val) self._controller.set(f'{self.identifier}.{param}', val)
def get_int(self, param: str) -> int: def get_int(self, param: str) -> int:
return int(self._controller._get(f"{self.identifier}.{param}")) return int(self._controller.get(f'{self.identifier}.{param}'))
def set_int(self, param: str, val: int): def set_int(self, param: str, val: int):
self._controller._set(f"{self.identifier}.{param}", val) self._controller.set(f'{self.identifier}.{param}', val)
class StripStrategy(Strategy): class StripStrategy(Strategy):
def __str__(self): def __str__(self):
return "Strip" return 'Strip'
@property @property
def identifier(self): def identifier(self):
return f"{self}[{self._index}]" return f'{self}[{self._index}]'
class BusStrategy(Strategy): class BusStrategy(Strategy):
def __str__(self): def __str__(self):
return "Bus" return 'Bus'
@property @property
def identifier(self): def identifier(self):
return f"{self}[{self._index}]" return f'{self}[{self._index}]'
class Context: class Context:

View File

@@ -2,36 +2,39 @@ import ctypes as ct
from logHandler import log from logHandler import log
from . import config
from .binds import Binds from .binds import Binds
from .cdll import BITS from .cdll import BITS
from .context import Context, StripStrategy from .context import Context, StripStrategy
from .kinds import KindId from .kinds import KindId
class Controller(Binds): class Controller:
def __init__(self): def __init__(self):
self._binds = Binds()
self.ctx = Context(StripStrategy(self, 0)) self.ctx = Context(StripStrategy(self, 0))
self.bits = config.get('bits', BITS)
def login(self): def login(self):
retval = self.call(self.bind_login, ok=(0, 1)) retval = self._binds.login()
log.info("INFO - logged into Voicemeeter Remote API") log.info('INFO - logged into Voicemeeter Remote API')
return retval return retval
def logout(self): def logout(self):
self.call(self.bind_logout) self._binds.logout()
log.info("NFO - logged out of Voicemeeter Remote API") log.info('NFO - logged out of Voicemeeter Remote API')
@property @property
def kind_id(self): def kind_id(self):
c_type = ct.c_long() c_type = ct.c_long()
self.call(self.bind_get_voicemeeter_type, ct.byref(c_type)) self._binds.get_voicemeeter_type(c_type)
return KindId(c_type.value).name.lower() return KindId(c_type.value).name.lower()
@property @property
def version(self): def version(self):
ver = ct.c_long() ver = ct.c_long()
self.call(self.bind_get_voicemeeter_version, ct.byref(ver)) self._binds.get_voicemeeter_version(ver)
return "{}.{}.{}.{}".format( return '{}.{}.{}.{}'.format(
(ver.value & 0xFF000000) >> 24, (ver.value & 0xFF000000) >> 24,
(ver.value & 0x00FF0000) >> 16, (ver.value & 0x00FF0000) >> 16,
(ver.value & 0x0000FF00) >> 8, (ver.value & 0x0000FF00) >> 8,
@@ -40,19 +43,19 @@ class Controller(Binds):
def run_voicemeeter(self, kind_id): def run_voicemeeter(self, kind_id):
val = kind_id.value val = kind_id.value
if val == 3 and BITS == 64: if self.bits == 64:
val = 6 val += 3
self.call(self.bind_run_voicemeeter, val) self._binds.run_voicemeeter(val)
def __clear(self): def __clear(self):
while self.call(self.bind_is_parameters_dirty, ok=(0, 1)) == 1: while self._binds.is_parameters_dirty() == 1:
pass pass
def _get(self, param): def get(self, param):
self.__clear() self.__clear()
buf = ct.c_float() buf = ct.c_float()
self.call(self.bind_get_parameter_float, param.encode(), ct.byref(buf)) self._binds.get_parameter_float(param.encode(), buf)
return buf.value return buf.value
def _set(self, param, val): def set(self, param, val):
self.call(self.bind_set_parameter_float, param.encode(), ct.c_float(float(val))) self._binds.set_parameter_float(param.encode(), ct.c_float(float(val)))

View File

@@ -1,11 +1,11 @@
class VMError(Exception): class VMAddonError(Exception):
"""Base voicemeeterlib exception class""" """Base voicemeeter add-on exception class"""
class VMCAPIError(VMError): class VMAddonCAPIError(VMAddonError):
"""Exception raised when the C-API returns an error code""" """Exception raised when the Voicemeeter C-API returns an error code"""
def __init__(self, fn_name, code): def __init__(self, fn_name, code):
self.fn_name = fn_name self.fn_name = fn_name
self.code = code self.code = code
super().__init__(f"{self.fn_name} returned {self.code}") super().__init__(f'{self.fn_name} returned {self.code}')

View File

@@ -1,7 +1,7 @@
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum, unique from enum import Enum, unique
from .error import VMError from .error import VMAddonError
@unique @unique
@@ -14,11 +14,6 @@ class KindId(Enum):
@dataclass @dataclass
class KindMapClass: class KindMapClass:
name: str name: str
ins: tuple
outs: tuple
vban: tuple
asio: tuple
insert: int
@property @property
def phys_in(self) -> int: def phys_in(self) -> int:
@@ -50,7 +45,6 @@ class KindMapClass:
@dataclass @dataclass
class BasicMap(KindMapClass): class BasicMap(KindMapClass):
name: str
ins: tuple = (2, 1) ins: tuple = (2, 1)
outs: tuple = (1, 1) outs: tuple = (1, 1)
vban: tuple = (4, 4, 1, 1) vban: tuple = (4, 4, 1, 1)
@@ -60,7 +54,6 @@ class BasicMap(KindMapClass):
@dataclass @dataclass
class BananaMap(KindMapClass): class BananaMap(KindMapClass):
name: str
ins: tuple = (3, 2) ins: tuple = (3, 2)
outs: tuple = (3, 2) outs: tuple = (3, 2)
vban: tuple = (8, 8, 1, 1) vban: tuple = (8, 8, 1, 1)
@@ -70,7 +63,6 @@ class BananaMap(KindMapClass):
@dataclass @dataclass
class PotatoMap(KindMapClass): class PotatoMap(KindMapClass):
name: str
ins: tuple = (5, 3) ins: tuple = (5, 3)
outs: tuple = (5, 3) outs: tuple = (5, 3)
vban: tuple = (8, 8, 1, 1) vban: tuple = (8, 8, 1, 1)
@@ -79,14 +71,15 @@ class PotatoMap(KindMapClass):
def kind_factory(kind_id): def kind_factory(kind_id):
if kind_id == "basic": if kind_id == 'basic':
_kind_map = BasicMap _kind_map = BasicMap
elif kind_id == "banana": elif kind_id == 'banana':
_kind_map = BananaMap _kind_map = BananaMap
elif kind_id == "potato": elif kind_id == 'potato':
_kind_map = PotatoMap _kind_map = PotatoMap
else: else:
raise ValueError(f"Unknown Voicemeeter kind {kind_id}") ERR_MSG = f'Unknown Voicemeeter kind {kind_id}'
raise ValueError(ERR_MSG)
return _kind_map(name=kind_id) return _kind_map(name=kind_id)
@@ -95,5 +88,5 @@ def request_kind_map(kind_id):
try: try:
KIND_obj = kind_factory(kind_id) KIND_obj = kind_factory(kind_id)
except ValueError as e: except ValueError as e:
raise VMError(str(e)) from e raise VMAddonError(str(e)) from e
return KIND_obj return KIND_obj

View File

@@ -17,34 +17,34 @@ def remove_suffix(input_string, suffix):
def _make_gestures(kind_id): def _make_gestures(kind_id):
kind = request_kind_map(kind_id) kind = request_kind_map(kind_id)
defaults = { defaults = {
"kb:NVDA+alt+s": "strip_mode", 'kb:NVDA+alt+s': 'strip_mode',
"kb:NVDA+alt+b": "bus_mode", 'kb:NVDA+alt+b': 'bus_mode',
"kb:NVDA+alt+g": "gain_mode", 'kb:NVDA+alt+g': 'gain_mode',
"kb:NVDA+alt+c": "comp_mode", 'kb:NVDA+alt+c': 'comp_mode',
"kb:NVDA+alt+t": "gate_mode", 'kb:NVDA+alt+t': 'gate_mode',
"kb:NVDA+alt+d": "denoiser_mode", 'kb:NVDA+alt+d': 'denoiser_mode',
"kb:NVDA+alt+a": "audibility_mode", 'kb:NVDA+alt+a': 'audibility_mode',
"kb:NVDA+shift+q": "announce_controller", 'kb:NVDA+shift+q': 'announce_controller',
"kb:NVDA+shift+v": "announce_voicemeeter_version", 'kb:NVDA+shift+v': 'announce_voicemeeter_version',
"kb:NVDA+shift+o": "toggle_mono", 'kb:NVDA+shift+o': 'rotate_mono',
"kb:NVDA+shift+s": "toggle_solo", 'kb:NVDA+shift+s': 'toggle_solo',
"kb:NVDA+shift+m": "toggle_mute", 'kb:NVDA+shift+m': 'toggle_mute',
"kb:NVDA+shift+c": "toggle_mc", 'kb:NVDA+shift+c': 'toggle_mc',
"kb:NVDA+shift+k": "karaoke", 'kb:NVDA+shift+k': 'karaoke',
"kb:NVDA+shift+upArrow": "slider_increase_by_point_one", 'kb:NVDA+shift+upArrow': 'slider_increase_by_point_one',
"kb:NVDA+shift+downArrow": "slider_decrease_by_point_one", 'kb:NVDA+shift+downArrow': 'slider_decrease_by_point_one',
"kb:NVDA+shift+alt+upArrow": "slider_increase_by_one", 'kb:NVDA+shift+alt+upArrow': 'slider_increase_by_one',
"kb:NVDA+shift+alt+downArrow": "slider_decrease_by_one", 'kb:NVDA+shift+alt+downArrow': 'slider_decrease_by_one',
"kb:NVDA+shift+control+upArrow": "slider_increase_by_three", 'kb:NVDA+shift+control+upArrow': 'slider_increase_by_three',
"kb:NVDA+shift+control+downArrow": "slider_decrease_by_three", 'kb:NVDA+shift+control+downArrow': 'slider_decrease_by_three',
} }
for i in range(1, kind.num_strip + 1): for i in range(1, kind.num_strip + 1):
defaults[f"kb:NVDA+alt+{i}"] = "index" defaults[f'kb:NVDA+alt+{i}'] = 'index'
for i in range(1, kind.phys_out + kind.virt_out + 1): for i in range(1, kind.phys_out + kind.virt_out + 1):
defaults[f"kb:NVDA+shift+{i}"] = "bus_assignment" defaults[f'kb:NVDA+shift+{i}'] = 'bus_assignment'
abc = config.get("keybinds") abc = config.get('keybinds')
if abc: if abc:
overrides = {f"kb:{remove_prefix(k, 'kb:')}": v for k, v in abc.items()} overrides = {f'kb:{remove_prefix(k, "kb:")}': v for k, v in abc.items()}
matching_values = set(defaults.values()).intersection(set(overrides.values())) matching_values = set(defaults.values()).intersection(set(overrides.values()))
defaults = {k: v for k, v in defaults.items() if v not in matching_values} defaults = {k: v for k, v in defaults.items() if v not in matching_values}
return {**defaults, **overrides} return {**defaults, **overrides}

View File

@@ -1,25 +0,0 @@
param(
[switch]$build
)
function Copy-FilestoScratchpad {
$source = Join-Path $PSScriptRoot "addon" "globalPlugins" "voicemeeter"
$target = Join-Path $env:appdata "nvda" "scratchpad" "globalPlugins" "voicemeeter"
Robocopy $source $target | Out-Null
}
function main {
"Copying files to Scratchpad" | Write-Host
Copy-FilestoScratchpad
if ($build) {
Invoke-Expression ".venv/Scripts/Activate.ps1"
"Building add-on" | Write-Host
scons
deactivate
}
}
if ($MyInvocation.InvocationName -ne '.') { main }

View File

@@ -16,39 +16,39 @@ def _(arg):
# Add-on information variables # Add-on information variables
addon_info = { addon_info = {
# add-on Name/identifier, internal for NVDA # add-on Name/identifier, internal for NVDA
"addon_name": "voicemeeter", 'addon_name': 'voicemeeter',
# Add-on summary, usually the user visible name of the addon. # Add-on summary, usually the user visible name of the addon.
# Translators: Summary for this add-on # Translators: Summary for this add-on
# to be shown on installation and add-on information found in Add-ons Manager. # to be shown on installation and add-on information found in Add-ons Manager.
"addon_summary": _("Voicemeeter Controller"), 'addon_summary': _('Voicemeeter Controller'),
# Add-on description # Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager # Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _( 'addon_description': _(
"""This add-on uses Voicemeeter's Remote API to control it's GUI. """This add-on uses Voicemeeter's Remote API to control it's GUI.
The add-on requires Voicemeeter to be installed.""" The add-on requires Voicemeeter to be installed."""
), ),
# version # version
"addon_version": "0.6", 'addon_version': '1.2.0',
# Author(s) # Author(s)
"addon_author": "onyx-and-iris <code@onyxandiris.online>", 'addon_author': 'onyx-and-iris <code@onyxandiris.online>',
# URL for the add-on documentation support # URL for the add-on documentation support
"addon_url": None, 'addon_url': None,
# URL for the add-on repository where the source code can be found # URL for the add-on repository where the source code can be found
"addon_sourceURL": "https://github.com/onyx-and-iris/nvda-addon-voicemeeter", 'addon_sourceURL': 'https://github.com/onyx-and-iris/nvda-addon-voicemeeter',
# Documentation file name # Documentation file name
"addon_docFileName": "readme.html", 'addon_docFileName': 'readme.html',
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional) # Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
"addon_minimumNVDAVersion": "2023.2", 'addon_minimumNVDAVersion': '2022.1.0',
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version) # Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion": "2023.2", 'addon_lastTestedNVDAVersion': '2024.4.2',
# Add-on update channel (default is None, denoting stable releases, # Add-on update channel (default is None, denoting stable releases,
# and for development releases, use "dev".) # and for development releases, use "dev".)
# Do not change unless you know what you are doing! # Do not change unless you know what you are doing!
"addon_updateChannel": "dev", 'addon_updateChannel': 'dev',
# Add-on license such as GPL 2 # Add-on license such as GPL 2
"addon_license": "GPL 2", 'addon_license': 'GPL 2',
# URL for the license document the ad-on is licensed under # URL for the license document the ad-on is licensed under
"addon_licenseURL": "https://github.com/onyx-and-iris/nvda-addon-voicemeeter/blob/main/LICENSE", 'addon_licenseURL': 'https://github.com/onyx-and-iris/nvda-addon-voicemeeter/blob/main/LICENSE',
} }
# Define the python files that are the sources of your add-on. # Define the python files that are the sources of your add-on.
@@ -60,11 +60,11 @@ The add-on requires Voicemeeter to be installed."""
# For more information on SCons Glob expressions please take a look at: # For more information on SCons Glob expressions please take a look at:
# https://scons.org/doc/production/HTML/scons-user/apd.html # https://scons.org/doc/production/HTML/scons-user/apd.html
pythonSources = [ pythonSources = [
"addon/globalPlugins/voicemeeter/*.py", 'addon/globalPlugins/voicemeeter/*.py',
] ]
# Files that contain strings for translation. Usually your python sources # Files that contain strings for translation. Usually your python sources
i18nSources = pythonSources + ["buildVars.py"] i18nSources = pythonSources + ['buildVars.py']
# Files that will be ignored when building the nvda-addon file # 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. # Paths are relative to the addon directory, not to the root directory of your addon sources.
@@ -73,7 +73,7 @@ excludedFiles = []
# Base language for the NVDA add-on # Base language for the NVDA add-on
# If your add-on is written in a language other than english, modify this variable. # 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. # For example, set baseLanguage to "es" if your add-on is primarily written in spanish.
baseLanguage = "en" baseLanguage = 'en'
# Markdown extensions for add-on documentation # Markdown extensions for add-on documentation
# Most add-ons do not require additional Markdown extensions. # Most add-ons do not require additional Markdown extensions.

36
pdm.lock generated Normal file
View File

@@ -0,0 +1,36 @@
# This file is @generated by PDM.
# It is not intended for manual editing.
[metadata]
groups = ["default", "build"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:ffb180ef920ab37ffd5773fd707e211323fdcdf938a50189f57238ca6222d2c6"
[[metadata.targets]]
requires_python = "==3.11.*"
[[package]]
name = "markdown"
version = "3.7"
requires_python = ">=3.8"
summary = "Python implementation of John Gruber's Markdown."
groups = ["build"]
dependencies = [
"importlib-metadata>=4.4; python_version < \"3.10\"",
]
files = [
{file = "Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803"},
{file = "markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2"},
]
[[package]]
name = "scons"
version = "4.8.1"
requires_python = ">=3.6"
summary = "Open Source next-generation build tool."
groups = ["build"]
files = [
{file = "SCons-4.8.1-py3-none-any.whl", hash = "sha256:a4c3b434330e2d7d975002fd6783284ba348bf394db94c8f83fdc5bf69cdb8d7"},
{file = "scons-4.8.1.tar.gz", hash = "sha256:5b641357904d2f56f7bfdbb37e165ab996b6143c948b9df0efc7305f54949daa"},
]

View File

@@ -1,15 +1,24 @@
[tool.black] [project]
line-length = 119 name = "nvda-addon-voicemeeter"
version = "1.2.0"
description = "A GUI-less NVDA Addon for Voicemeeter using the Remote API"
authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
dependencies = []
requires-python = "==3.11.*"
readme = "README.md"
license = { text = "MIT" }
[dependency-groups]
build = ["scons>=4.8.1", "markdown>=3.7"]
[tool.pdm]
distribution = false
[tool.pdm.scripts]
copy = "task copy"
release = "task build"
[tool.ruff] [tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]
# Avoid enforcing line-length violations (`E501`). Let Black deal with this.
ignore = ["E501"]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [ exclude = [
".bzr", ".bzr",
".direnv", ".direnv",
@@ -33,14 +42,59 @@ exclude = [
"node_modules", "node_modules",
"venv", "venv",
] ]
# Same as Black.
line-length = 119 line-length = 120
indent-width = 4
# Assume Python 3.11
target-version = "py311"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Enable flake8-errmsg (EM) warnings.
# Enable flake8-bugbear (B) warnings.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "EM", "F", "B"]
ignore = []
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed. # Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.7
target-version = "py37"
[tool.ruff.mccabe] [tool.ruff.format]
# Unlike Flake8, default to a complexity level of 10. # Unlike Black, use single quotes for strings.
quote-style = "single"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
[tool.ruff.lint.mccabe]
max-complexity = 10 max-complexity = 10
[tool.ruff.per-file-ignores]
"__init__.py" = ["E402", "F401"] # Ignore unused import and variable not accessed violations [tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]