mirror of
https://github.com/onyx-and-iris/nvda-voicemeeter.git
synced 2024-11-22 18:00:50 +00:00
add guard clause for empty entry
This commit is contained in:
parent
599b140079
commit
d39cc35e79
@ -86,6 +86,13 @@ class Window(psg.Window):
|
|||||||
case [["HARDWARE", "OUT"], [key], ["FOCUS", "IN"]]:
|
case [["HARDWARE", "OUT"], [key], ["FOCUS", "IN"]]:
|
||||||
self.nvda.speak(f"HARDWARE OUT {key} in focus")
|
self.nvda.speak(f"HARDWARE OUT {key} in focus")
|
||||||
case [["HARDWARE", "OUT"], [key], ["KEY", "RETURN"]]:
|
case [["HARDWARE", "OUT"], [key], ["KEY", "RETURN"]]:
|
||||||
|
if not values[f"HARDWARE OUT||{key}"]:
|
||||||
|
index = int(key[1]) - 1
|
||||||
|
setattr(self.vm.bus[index].device, "wdm", "")
|
||||||
|
time.sleep(0.75)
|
||||||
|
self.nvda.speak(f"HARDWARE OUT {key} device deselected")
|
||||||
|
continue
|
||||||
|
|
||||||
matches = []
|
matches = []
|
||||||
devices = get_input_device_list(self.vm)
|
devices = get_input_device_list(self.vm)
|
||||||
devices.append("Deselect Device")
|
devices.append("Deselect Device")
|
||||||
@ -94,14 +101,15 @@ class Window(psg.Window):
|
|||||||
matches.append(device)
|
matches.append(device)
|
||||||
if len(matches) == 1:
|
if len(matches) == 1:
|
||||||
self.logger.info(f"Single matching entry found: {matches[0]}. Setting as device.")
|
self.logger.info(f"Single matching entry found: {matches[0]}. Setting as device.")
|
||||||
self[f"HARDWARE OUT||{key}"].update(matches[0])
|
|
||||||
index = int(key[1]) - 1
|
index = int(key[1]) - 1
|
||||||
match matches[0].split(":"):
|
match matches[0].split(":"):
|
||||||
case [device_name]:
|
case [device_name]:
|
||||||
|
self[f"HARDWARE OUT||{key}"].update("")
|
||||||
setattr(self.vm.bus[index].device, "wdm", "")
|
setattr(self.vm.bus[index].device, "wdm", "")
|
||||||
time.sleep(0.75)
|
time.sleep(0.75)
|
||||||
self.nvda.speak(f"HARDWARE OUT {key} device deselected")
|
self.nvda.speak(f"HARDWARE OUT {key} device deselected")
|
||||||
case [driver, device_name]:
|
case [driver, device_name]:
|
||||||
|
self[f"HARDWARE OUT||{key}"].update(matches[0])
|
||||||
setattr(self.vm.bus[index].device, driver, device_name.strip())
|
setattr(self.vm.bus[index].device, driver, device_name.strip())
|
||||||
time.sleep(0.75)
|
time.sleep(0.75)
|
||||||
self.nvda.speak(f"HARDWARE OUT {key} set {matches[0]}")
|
self.nvda.speak(f"HARDWARE OUT {key} set {matches[0]}")
|
||||||
|
Loading…
Reference in New Issue
Block a user