diff --git a/pdm.lock b/pdm.lock index daa39b5..a2b2594 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "build", "lint", "test"] strategy = ["cross_platform"] lock_version = "4.4" -content_hash = "sha256:ca47eaae0de5aa6bcc3fde33b6c1fa7dc2476aeb680f00bb1c550fe06ad67c55" +content_hash = "sha256:4295f6824f37484ec423b53bd425334b0e039a51d81261b52c8890928fcf3948" [[package]] name = "altgraph" @@ -74,6 +74,31 @@ files = [ {file = "macholib-1.16.2.tar.gz", hash = "sha256:557bbfa1bb255c20e9abafe7ed6cd8046b48d9525db2f9b77d3122a63a2a8bf8"}, ] +[[package]] +name = "mypy" +version = "1.7.0" +requires_python = ">=3.8" +summary = "Optional static typing for Python" +dependencies = [ + "mypy-extensions>=1.0.0", + "tomli>=1.1.0; python_version < \"3.11\"", + "typing-extensions>=4.1.0", +] +files = [ + {file = "mypy-1.7.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5da84d7bf257fd8f66b4f759a904fd2c5a765f70d8b52dde62b521972a0a2357"}, + {file = "mypy-1.7.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a3637c03f4025f6405737570d6cbfa4f1400eb3c649317634d273687a09ffc2f"}, + {file = "mypy-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b633f188fc5ae1b6edca39dae566974d7ef4e9aaaae00bc36efe1f855e5173ac"}, + {file = "mypy-1.7.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d6ed9a3997b90c6f891138e3f83fb8f475c74db4ccaa942a1c7bf99e83a989a1"}, + {file = "mypy-1.7.0-cp310-cp310-win_amd64.whl", hash = "sha256:1fe46e96ae319df21359c8db77e1aecac8e5949da4773c0274c0ef3d8d1268a9"}, + {file = "mypy-1.7.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:df67fbeb666ee8828f675fee724cc2cbd2e4828cc3df56703e02fe6a421b7401"}, + {file = "mypy-1.7.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a79cdc12a02eb526d808a32a934c6fe6df07b05f3573d210e41808020aed8b5d"}, + {file = "mypy-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f65f385a6f43211effe8c682e8ec3f55d79391f70a201575def73d08db68ead1"}, + {file = "mypy-1.7.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0e81ffd120ee24959b449b647c4b2fbfcf8acf3465e082b8d58fd6c4c2b27e46"}, + {file = "mypy-1.7.0-cp311-cp311-win_amd64.whl", hash = "sha256:f29386804c3577c83d76520abf18cfcd7d68264c7e431c5907d250ab502658ee"}, + {file = "mypy-1.7.0-py3-none-any.whl", hash = "sha256:96650d9a4c651bc2a4991cf46f100973f656d69edc7faf91844e87fe627f7e96"}, + {file = "mypy-1.7.0.tar.gz", hash = "sha256:1e280b5697202efa698372d2f39e9a6713a0395a756b1c6bd48995f8d72690dc"}, +] + [[package]] name = "mypy-extensions" version = "1.0.0" @@ -248,6 +273,16 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +[[package]] +name = "typing-extensions" +version = "4.8.0" +requires_python = ">=3.8" +summary = "Backported and Experimental Type Hints for Python 3.8+" +files = [ + {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, + {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, +] + [[package]] name = "voicemeeter-api" version = "2.5.2" diff --git a/pyproject.toml b/pyproject.toml index d844a70..1b189d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nvda_voicemeeter" -version = "0.5.7b1" +version = "0.5.7b2" description = "A Voicemeeter app compatible with NVDA" authors = [ { name = "onyx-and-iris", email = "code@onyxandiris.online" }, @@ -23,6 +23,7 @@ build = [ lint = [ "black>=23.7.0", "ruff>=0.0.291", + "mypy>=1.7.0", ] test = [ "psgdemos>=1.12.1", diff --git a/src/nvda_voicemeeter/cdll.py b/src/nvda_voicemeeter/cdll.py index d0162db..dc85abb 100644 --- a/src/nvda_voicemeeter/cdll.py +++ b/src/nvda_voicemeeter/cdll.py @@ -5,7 +5,7 @@ from pathlib import Path from .errors import NVDAVMError -bits = 64 if ct.sizeof(ct.c_voidp) == 8 else 32 +bits = 64 if ct.sizeof(ct.c_void_p) == 8 else 32 if platform.system() != "Windows": raise NVDAVMError("Only Windows OS supported") diff --git a/src/nvda_voicemeeter/compound.py b/src/nvda_voicemeeter/compound.py index ed20c04..14164fb 100644 --- a/src/nvda_voicemeeter/compound.py +++ b/src/nvda_voicemeeter/compound.py @@ -13,7 +13,10 @@ class LabelSlider(psg.Frame): if param in ("AUDIBILITY", "DENOISER"): size = 7 else: - size = 4 + if psg.theme() == "HighContrast": + size = 5 + else: + size = 4 layout = [ [ psg.Text(param.capitalize(), size=size), diff --git a/src/nvda_voicemeeter/util.py b/src/nvda_voicemeeter/util.py index 4e27ac1..2a90d82 100644 --- a/src/nvda_voicemeeter/util.py +++ b/src/nvda_voicemeeter/util.py @@ -200,6 +200,23 @@ def _get_bus_assignments(kind) -> list: return [f"A{i}" for i in range(1, kind.phys_out + 1)] + [f"B{i}" for i in range(1, kind.virt_out + 1)] +psg.theme_add_new( + "HighContrast", + { + "BACKGROUND": "#FFFFFF", + "TEXT": "#000000", + "INPUT": "#FAF9F6", + "TEXT_INPUT": "#000000", + "SCROLL": "#FAF9F6", + "BUTTON": ("#000000", "#FFFFFF"), + "PROGRESS": ("#000000", "#FFFFFF"), + "BORDER": 2, + "SLIDER_DEPTH": 3, + "PROGRESS_DEPTH": 0, + }, +) + + def get_themes_list() -> list: return [ "Bright Colors", @@ -221,4 +238,5 @@ def get_themes_list() -> list: "Neutral Blue", "Reds", "Sandy Beach", + "High Contrast", ] diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 3377c2d..3af36eb 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -13,6 +13,8 @@ from .popup import Popup logger = logging.getLogger(__name__) psg.theme(configuration.get("default_theme", "Dark Blue 3")) +if psg.theme() == "HighContrast": + psg.set_options(font=("Arial", 14)) class NVDAVMWindow(psg.Window): @@ -22,6 +24,7 @@ class NVDAVMWindow(psg.Window): self.vm = vm self.kind = self.vm.kind self.logger = logger.getChild(type(self).__name__) + self.logger.debug(f"loaded with theme: {psg.theme()}") self.cache = { "hw_ins": models._make_hardware_ins_cache(self.vm), "hw_outs": models._make_hardware_outs_cache(self.vm), @@ -65,7 +68,7 @@ class NVDAVMWindow(psg.Window): if settings_path.exists(): try: defaultconfig = Path(configuration.get("default_config", "")) # coerce the type - if defaultconfig.exists(): + if defaultconfig.is_file() and defaultconfig.exists(): self.vm.set("command.load", str(defaultconfig)) self.logger.debug(f"config {defaultconfig} loaded") self.TKroot.after(