From 740cf1ac029c4b540066f43ff52892b27209ed20 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Tue, 22 Aug 2023 05:37:06 +0100 Subject: [PATCH] add deselect device to hardware outs --- src/nvda_voicemeeter/window.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 6a0935f..4e46a51 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -31,6 +31,7 @@ class Window(psg.Window): def add_physical_device_opts(layout): devices = ["{type}: {name}".format(**self.vm.device.output(i)) for i in range(self.vm.device.outs)] + devices.append("Deselect Device") layout.append( [ psg.Combo( @@ -38,6 +39,7 @@ class Window(psg.Window): size=(22, 4), expand_x=True, enable_events=True, + readonly=True, key=f"HARDWARE OUT||A{i}", ) for i in range(1, self.kind.phys_out + 1) @@ -98,10 +100,14 @@ class Window(psg.Window): match self.parser.match.parseString(event): case [["HARDWARE", "OUT"], [key]]: selection = values[f"HARDWARE OUT||{key}"] - driver, device_name = selection.split(":") - index = int(key[1]) - 1 - setattr(self.vm.bus[index].device, driver, device_name.strip()) - self.nvda.speak(f"{driver} {selection}") + match selection.split(":"): + case [device_name]: + device_name = "" + self.nvda.speak(f"HARDWARE OUT {key} device deselected") + case [driver, device_name]: + index = int(key[1]) - 1 + setattr(self.vm.bus[index].device, driver, device_name.strip()) + self.nvda.speak(f"{driver} {selection}") case [["HARDWARE", "OUT"], [key], ["FOCUS", "IN"]]: self.nvda.speak(f"HARDWARE OUT {key} in focus") case [["ASIO", "CHECKBOX"], [in_num, side]]: