mirror of
https://github.com/onyx-and-iris/nvda-addon-voicemeeter.git
synced 2025-04-01 19:33:46 +01:00
Compare commits
2 Commits
1b5cfacf4f
...
68462016a5
Author | SHA1 | Date | |
---|---|---|---|
68462016a5 | |||
b090c359b4 |
178
.gitignore
vendored
178
.gitignore
vendored
@ -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/en/
|
||||
*_docHandler.py
|
||||
@ -10,5 +186,5 @@ manifest.ini
|
||||
.sconsign.dblite
|
||||
/[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
.venv/
|
||||
# testing
|
||||
keybinds.json
|
@ -1,5 +1,4 @@
|
||||
[](https://github.com/psf/black)
|
||||
[](https://pycqa.github.io/isort/)
|
||||
[](https://pdm.fming.dev)
|
||||
[](https://github.com/astral-sh/ruff)
|
||||
|
||||
# NVDA Addon Voicemeeter
|
||||
|
@ -9,7 +9,7 @@ from .kinds import KindId, request_kind_map
|
||||
|
||||
|
||||
class GlobalPlugin(CommandsMixin, globalPluginHandler.GlobalPlugin):
|
||||
__kind_id = config.get("voicemeeter", "potato")
|
||||
__kind_id = config.get('voicemeeter', 'potato')
|
||||
__gestures = util._make_gestures(__kind_id)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -7,41 +7,41 @@ from .error import VMError
|
||||
|
||||
BITS = 64 if ct.sizeof(ct.c_voidp) == 8 else 32
|
||||
|
||||
if platform.system() != "Windows":
|
||||
raise VMError("Only Windows OS supported")
|
||||
if platform.system() != 'Windows':
|
||||
raise VMError('Only Windows OS supported')
|
||||
|
||||
|
||||
VM_KEY = "VB:Voicemeeter {17359A74-1236-5467}"
|
||||
REG_KEY = "\\".join(
|
||||
VM_KEY = 'VB:Voicemeeter {17359A74-1236-5467}'
|
||||
REG_KEY = '\\'.join(
|
||||
filter(
|
||||
None,
|
||||
(
|
||||
"SOFTWARE",
|
||||
"WOW6432Node" if BITS == 64 else "",
|
||||
"Microsoft",
|
||||
"Windows",
|
||||
"CurrentVersion",
|
||||
"Uninstall",
|
||||
'SOFTWARE',
|
||||
'WOW6432Node' if BITS == 64 else '',
|
||||
'Microsoft',
|
||||
'Windows',
|
||||
'CurrentVersion',
|
||||
'Uninstall',
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def get_vmpath():
|
||||
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]
|
||||
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]
|
||||
|
||||
|
||||
try:
|
||||
vm_parent = Path(get_vmpath()).parent
|
||||
except FileNotFoundError as e:
|
||||
raise VMError("Unable to fetch DLL path from the registry") from e
|
||||
raise VMError('Unable to fetch DLL path from the registry') from e
|
||||
|
||||
DLL_NAME = f'VoicemeeterRemote{"64" if BITS == 64 else ""}.dll'
|
||||
|
||||
dll_path = vm_parent.joinpath(DLL_NAME)
|
||||
if not dll_path.is_file():
|
||||
raise VMError(f"Could not find {dll_path}")
|
||||
raise VMError(f'Could not find {dll_path}')
|
||||
|
||||
if BITS == 64:
|
||||
libc = ct.CDLL(str(dll_path))
|
||||
|
@ -8,93 +8,93 @@ class CommandsMixin:
|
||||
### ANNOUNCEMENTS ###
|
||||
|
||||
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}')
|
||||
|
||||
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 ###
|
||||
|
||||
def script_strip_mode(self, _):
|
||||
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
|
||||
self.controller.ctx.strategy = context.StripStrategy(self.controller, self.controller.ctx.index)
|
||||
ui.message(f"Controller for strip {self.controller.ctx.index + 1}")
|
||||
log.info(f"INFO - strip {self.controller.ctx.index} mode")
|
||||
ui.message(f'Controller for strip {self.controller.ctx.index + 1}')
|
||||
log.info(f'INFO - strip {self.controller.ctx.index} mode')
|
||||
|
||||
def script_bus_mode(self, _):
|
||||
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
|
||||
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}")
|
||||
log.info(f"INFO - {self.controller.ctx.strategy} {self.controller.ctx.index} mode")
|
||||
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')
|
||||
|
||||
def script_index(self, gesture):
|
||||
proposed = int(gesture.displayName[-1])
|
||||
self.controller.ctx.index = proposed - 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")
|
||||
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')
|
||||
|
||||
def __set_slider_mode(self, mode):
|
||||
self.controller.ctx.slider_mode = mode
|
||||
ui.message(f"{mode} mode enabled")
|
||||
ui.message(f'{mode} mode enabled')
|
||||
|
||||
def script_gain_mode(self, _):
|
||||
self.__set_slider_mode("gain")
|
||||
self.__set_slider_mode('gain')
|
||||
|
||||
def script_comp_mode(self, _):
|
||||
self.__set_slider_mode("comp")
|
||||
self.__set_slider_mode('comp')
|
||||
|
||||
def script_gate_mode(self, _):
|
||||
self.__set_slider_mode("gate")
|
||||
self.__set_slider_mode('gate')
|
||||
|
||||
def script_denoiser_mode(self, _):
|
||||
self.__set_slider_mode("denoiser")
|
||||
self.__set_slider_mode('denoiser')
|
||||
|
||||
def script_audibility_mode(self, _):
|
||||
self.__set_slider_mode("audibility")
|
||||
self.__set_slider_mode('audibility')
|
||||
|
||||
### 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")
|
||||
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, _):
|
||||
val = not self.controller.ctx.get_bool("solo")
|
||||
self.controller.ctx.set_bool("solo", val)
|
||||
ui.message("on" if val else "off")
|
||||
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, _):
|
||||
val = not self.controller.ctx.get_bool("mute")
|
||||
self.controller.ctx.set_bool("mute", val)
|
||||
ui.message("on" if val else "off")
|
||||
val = not self.controller.ctx.get_bool('mute')
|
||||
self.controller.ctx.set_bool('mute', val)
|
||||
ui.message('on' if val else 'off')
|
||||
|
||||
def script_toggle_mc(self, _):
|
||||
val = not self.controller.ctx.get_bool("mc")
|
||||
self.controller.ctx.set_bool("mc", val)
|
||||
ui.message("on" if val else "off")
|
||||
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, _):
|
||||
opts = ["off", "k m", "k 1", "k 2", "k v"]
|
||||
val = self.controller.ctx.get_int("karaoke") + 1
|
||||
opts = ['off', 'k m', 'k 1', 'k 2', 'k v']
|
||||
val = self.controller.ctx.get_int('karaoke') + 1
|
||||
if val == len(opts):
|
||||
val = 0
|
||||
self.controller.ctx.set_int("karaoke", val)
|
||||
self.controller.ctx.set_int('karaoke', val)
|
||||
ui.message(opts[val])
|
||||
|
||||
def script_bus_assignment(self, gesture):
|
||||
proposed = int(gesture.displayName[-1])
|
||||
if proposed - 1 < self.kind.phys_out:
|
||||
output = f"A{proposed}"
|
||||
output = f'A{proposed}'
|
||||
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)
|
||||
self.controller.ctx.set_bool(output, val)
|
||||
ui.message("on" if val else "off")
|
||||
ui.message('on' if val else 'off')
|
||||
|
||||
### CONTROL SLIDERS ###
|
||||
|
||||
|
@ -3,10 +3,10 @@ from pathlib import Path
|
||||
|
||||
|
||||
def config_from_json():
|
||||
pn = Path.home() / "Documents" / "Voicemeeter" / "nvda_settings.json"
|
||||
pn = Path.home() / 'Documents' / 'Voicemeeter' / 'nvda_settings.json'
|
||||
data = None
|
||||
if pn.exists():
|
||||
with open(pn, "r") as f:
|
||||
with open(pn, 'r') as f:
|
||||
data = json.load(f)
|
||||
return data or {}
|
||||
|
||||
|
@ -5,7 +5,7 @@ class Strategy(ABC):
|
||||
def __init__(self, controller, index):
|
||||
self._controller = controller
|
||||
self._index = index
|
||||
self._slider_mode = "gain"
|
||||
self._slider_mode = 'gain'
|
||||
|
||||
@abstractmethod
|
||||
def identifier(self):
|
||||
@ -28,40 +28,40 @@ class Strategy(ABC):
|
||||
self._slider_mode = val
|
||||
|
||||
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):
|
||||
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:
|
||||
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):
|
||||
self._controller._set(f"{self.identifier}.{param}", val)
|
||||
self._controller._set(f'{self.identifier}.{param}', val)
|
||||
|
||||
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):
|
||||
self._controller._set(f"{self.identifier}.{param}", val)
|
||||
self._controller._set(f'{self.identifier}.{param}', val)
|
||||
|
||||
|
||||
class StripStrategy(Strategy):
|
||||
def __str__(self):
|
||||
return "Strip"
|
||||
return 'Strip'
|
||||
|
||||
@property
|
||||
def identifier(self):
|
||||
return f"{self}[{self._index}]"
|
||||
return f'{self}[{self._index}]'
|
||||
|
||||
|
||||
class BusStrategy(Strategy):
|
||||
def __str__(self):
|
||||
return "Bus"
|
||||
return 'Bus'
|
||||
|
||||
@property
|
||||
def identifier(self):
|
||||
return f"{self}[{self._index}]"
|
||||
return f'{self}[{self._index}]'
|
||||
|
||||
|
||||
class Context:
|
||||
|
@ -14,12 +14,12 @@ class Controller(Binds):
|
||||
|
||||
def login(self):
|
||||
retval = self.call(self.bind_login, ok=(0, 1))
|
||||
log.info("INFO - logged into Voicemeeter Remote API")
|
||||
log.info('INFO - logged into Voicemeeter Remote API')
|
||||
return retval
|
||||
|
||||
def logout(self):
|
||||
self.call(self.bind_logout)
|
||||
log.info("NFO - logged out of Voicemeeter Remote API")
|
||||
log.info('NFO - logged out of Voicemeeter Remote API')
|
||||
|
||||
@property
|
||||
def kind_id(self):
|
||||
@ -31,7 +31,7 @@ class Controller(Binds):
|
||||
def version(self):
|
||||
ver = ct.c_long()
|
||||
self.call(self.bind_get_voicemeeter_version, ct.byref(ver))
|
||||
return "{}.{}.{}.{}".format(
|
||||
return '{}.{}.{}.{}'.format(
|
||||
(ver.value & 0xFF000000) >> 24,
|
||||
(ver.value & 0x00FF0000) >> 16,
|
||||
(ver.value & 0x0000FF00) >> 8,
|
||||
|
@ -8,4 +8,4 @@ class VMCAPIError(VMError):
|
||||
def __init__(self, fn_name, code):
|
||||
self.fn_name = fn_name
|
||||
self.code = code
|
||||
super().__init__(f"{self.fn_name} returned {self.code}")
|
||||
super().__init__(f'{self.fn_name} returned {self.code}')
|
||||
|
@ -79,14 +79,14 @@ class PotatoMap(KindMapClass):
|
||||
|
||||
|
||||
def kind_factory(kind_id):
|
||||
if kind_id == "basic":
|
||||
if kind_id == 'basic':
|
||||
_kind_map = BasicMap
|
||||
elif kind_id == "banana":
|
||||
elif kind_id == 'banana':
|
||||
_kind_map = BananaMap
|
||||
elif kind_id == "potato":
|
||||
elif kind_id == 'potato':
|
||||
_kind_map = PotatoMap
|
||||
else:
|
||||
raise ValueError(f"Unknown Voicemeeter kind {kind_id}")
|
||||
raise ValueError(f'Unknown Voicemeeter kind {kind_id}')
|
||||
return _kind_map(name=kind_id)
|
||||
|
||||
|
||||
|
@ -17,34 +17,34 @@ def remove_suffix(input_string, suffix):
|
||||
def _make_gestures(kind_id):
|
||||
kind = request_kind_map(kind_id)
|
||||
defaults = {
|
||||
"kb:NVDA+alt+s": "strip_mode",
|
||||
"kb:NVDA+alt+b": "bus_mode",
|
||||
"kb:NVDA+alt+g": "gain_mode",
|
||||
"kb:NVDA+alt+c": "comp_mode",
|
||||
"kb:NVDA+alt+t": "gate_mode",
|
||||
"kb:NVDA+alt+d": "denoiser_mode",
|
||||
"kb:NVDA+alt+a": "audibility_mode",
|
||||
"kb:NVDA+shift+q": "announce_controller",
|
||||
"kb:NVDA+shift+v": "announce_voicemeeter_version",
|
||||
"kb:NVDA+shift+o": "toggle_mono",
|
||||
"kb:NVDA+shift+s": "toggle_solo",
|
||||
"kb:NVDA+shift+m": "toggle_mute",
|
||||
"kb:NVDA+shift+c": "toggle_mc",
|
||||
"kb:NVDA+shift+k": "karaoke",
|
||||
"kb:NVDA+shift+upArrow": "slider_increase_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+downArrow": "slider_decrease_by_one",
|
||||
"kb:NVDA+shift+control+upArrow": "slider_increase_by_three",
|
||||
"kb:NVDA+shift+control+downArrow": "slider_decrease_by_three",
|
||||
'kb:NVDA+alt+s': 'strip_mode',
|
||||
'kb:NVDA+alt+b': 'bus_mode',
|
||||
'kb:NVDA+alt+g': 'gain_mode',
|
||||
'kb:NVDA+alt+c': 'comp_mode',
|
||||
'kb:NVDA+alt+t': 'gate_mode',
|
||||
'kb:NVDA+alt+d': 'denoiser_mode',
|
||||
'kb:NVDA+alt+a': 'audibility_mode',
|
||||
'kb:NVDA+shift+q': 'announce_controller',
|
||||
'kb:NVDA+shift+v': 'announce_voicemeeter_version',
|
||||
'kb:NVDA+shift+o': 'toggle_mono',
|
||||
'kb:NVDA+shift+s': 'toggle_solo',
|
||||
'kb:NVDA+shift+m': 'toggle_mute',
|
||||
'kb:NVDA+shift+c': 'toggle_mc',
|
||||
'kb:NVDA+shift+k': 'karaoke',
|
||||
'kb:NVDA+shift+upArrow': 'slider_increase_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+downArrow': 'slider_decrease_by_one',
|
||||
'kb:NVDA+shift+control+upArrow': 'slider_increase_by_three',
|
||||
'kb:NVDA+shift+control+downArrow': 'slider_decrease_by_three',
|
||||
}
|
||||
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):
|
||||
defaults[f"kb:NVDA+shift+{i}"] = "bus_assignment"
|
||||
abc = config.get("keybinds")
|
||||
defaults[f'kb:NVDA+shift+{i}'] = 'bus_assignment'
|
||||
abc = config.get('keybinds')
|
||||
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()))
|
||||
defaults = {k: v for k, v in defaults.items() if v not in matching_values}
|
||||
return {**defaults, **overrides}
|
||||
|
24
build.ps1
24
build.ps1
@ -1,25 +1,25 @@
|
||||
param(
|
||||
param (
|
||||
[switch]$build
|
||||
)
|
||||
|
||||
function Copy-FilestoScratchpad {
|
||||
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
|
||||
function Build-Addon {
|
||||
"Building add-on" | Write-Host
|
||||
scons
|
||||
}
|
||||
|
||||
function Main {
|
||||
"Copying updated files to Scratchpad" | Write-Host
|
||||
Copy-FilesToScratchpad
|
||||
|
||||
if ($build) {
|
||||
Invoke-Expression ".venv/Scripts/Activate.ps1"
|
||||
|
||||
"Building add-on" | Write-Host
|
||||
scons
|
||||
|
||||
deactivate
|
||||
Build-Addon
|
||||
}
|
||||
}
|
||||
|
||||
if ($MyInvocation.InvocationName -ne '.') { main }
|
||||
if ($MyInvocation.InvocationName -ne '.') { Main }
|
32
buildVars.py
32
buildVars.py
@ -16,39 +16,39 @@ def _(arg):
|
||||
# Add-on information variables
|
||||
addon_info = {
|
||||
# add-on Name/identifier, internal for NVDA
|
||||
"addon_name": "voicemeeter",
|
||||
'addon_name': 'voicemeeter',
|
||||
# Add-on summary, usually the user visible name of the addon.
|
||||
# Translators: Summary for this add-on
|
||||
# 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
|
||||
# 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.
|
||||
The add-on requires Voicemeeter to be installed."""
|
||||
),
|
||||
# version
|
||||
"addon_version": "0.6",
|
||||
'addon_version': '1.0.0',
|
||||
# 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
|
||||
"addon_url": None,
|
||||
'addon_url': None,
|
||||
# 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
|
||||
"addon_docFileName": "readme.html",
|
||||
'addon_docFileName': 'readme.html',
|
||||
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
|
||||
"addon_minimumNVDAVersion": "2023.2",
|
||||
'addon_minimumNVDAVersion': '2024.4.0',
|
||||
# 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,
|
||||
# and for development releases, use "dev".)
|
||||
# Do not change unless you know what you are doing!
|
||||
"addon_updateChannel": "dev",
|
||||
'addon_updateChannel': 'dev',
|
||||
# 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
|
||||
"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.
|
||||
@ -60,11 +60,11 @@ The add-on requires Voicemeeter to be installed."""
|
||||
# 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/voicemeeter/*.py",
|
||||
'addon/globalPlugins/voicemeeter/*.py',
|
||||
]
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# 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.
|
||||
baseLanguage = "en"
|
||||
baseLanguage = 'en'
|
||||
|
||||
# Markdown extensions for add-on documentation
|
||||
# Most add-ons do not require additional Markdown extensions.
|
||||
|
36
pdm.lock
generated
Normal file
36
pdm.lock
generated
Normal 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"},
|
||||
]
|
@ -1,15 +1,29 @@
|
||||
[tool.black]
|
||||
line-length = 119
|
||||
[project]
|
||||
name = "nvda-addon-voicemeeter"
|
||||
version = "1.0.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 = "pwsh build.ps1"
|
||||
build = "pwsh build.ps1 -build"
|
||||
|
||||
[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 = [
|
||||
".bzr",
|
||||
".direnv",
|
||||
@ -33,14 +47,60 @@ exclude = [
|
||||
"node_modules",
|
||||
"venv",
|
||||
]
|
||||
# Same as Black.
|
||||
line-length = 119
|
||||
|
||||
line-length = 120
|
||||
indent-width = 4
|
||||
|
||||
# Assume Python 3.10
|
||||
target-version = "py310"
|
||||
|
||||
[tool.ruff.lint]
|
||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
|
||||
# McCabe complexity (`C901`) by default.
|
||||
select = ["E4", "E7", "E9", "F"]
|
||||
ignore = []
|
||||
|
||||
# Allow fix for all enabled rules (when `--fix`) is provided.
|
||||
fixable = ["ALL"]
|
||||
unfixable = []
|
||||
|
||||
# Allow unused variables when underscore-prefixed.
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
# Assume Python 3.7
|
||||
target-version = "py37"
|
||||
[tool.ruff.mccabe]
|
||||
# Unlike Flake8, default to a complexity level of 10.
|
||||
|
||||
|
||||
[tool.ruff.format]
|
||||
# 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
|
||||
[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",
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user