From 2490fc934307b78df94926bdda3f86e8d356af4f Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 25 Aug 2023 20:41:48 +0100 Subject: [PATCH] increment indices in formatted strings instead of range expressions --- src/nvda_voicemeeter/builder.py | 6 +++--- src/nvda_voicemeeter/window.py | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/nvda_voicemeeter/builder.py b/src/nvda_voicemeeter/builder.py index b0f41bb..4e78c8c 100644 --- a/src/nvda_voicemeeter/builder.py +++ b/src/nvda_voicemeeter/builder.py @@ -62,12 +62,12 @@ class Builder: layout.append( [ psg.ButtonMenu( - f"A{i}", + f"A{i + 1}", size=(6, 3), menu_def=["", devices], - key=f"HARDWARE OUT||A{i}", + key=f"HARDWARE OUT||A{i + 1}", ) - for i in range(1, self.kind.phys_out + 1) + for i in range(self.kind.phys_out) ] ) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 88013e0..e863d2f 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -30,8 +30,8 @@ class NVDAVMWindow(psg.Window): self.builder = Builder(self, self.vm) layout = self.builder.run() super().__init__(title, layout, finalize=True) - [self[f"HARDWARE OUT||A{i}"].Widget.config(takefocus=1) for i in range(1, self.kind.phys_out + 1)] - [self[f"PATCH COMPOSITE||PC{i}"].Widget.config(takefocus=1) for i in range(1, self.kind.phys_out + 1)] + [self[f"HARDWARE OUT||A{i + 1}"].Widget.config(takefocus=1) for i in range(self.kind.phys_out)] + [self[f"PATCH COMPOSITE||PC{i + 1}"].Widget.config(takefocus=1) for i in range(self.kind.phys_out)] self.register_events() def __enter__(self): @@ -44,27 +44,27 @@ class NVDAVMWindow(psg.Window): """Registers events for widgets""" # Hardware Out - for i in range(1, self.vm.kind.phys_out + 1): - self[f"HARDWARE OUT||A{i}"].bind("", "||FOCUS IN") + for i in range(self.vm.kind.phys_out): + self[f"HARDWARE OUT||A{i + 1}"].bind("", "||FOCUS IN") # Patch ASIO if self.kind.name != "basic": - for i in range(1, self.kind.phys_out + 1): - self[f"ASIO CHECKBOX||IN{i} 0"].bind("", "||FOCUS IN") - self[f"ASIO CHECKBOX||IN{i} 1"].bind("", "||FOCUS IN") + for i in range(self.kind.phys_out): + self[f"ASIO CHECKBOX||IN{i + 1} 0"].bind("", "||FOCUS IN") + self[f"ASIO CHECKBOX||IN{i + 1} 1"].bind("", "||FOCUS IN") # Patch Composite - for i in range(1, self.vm.kind.phys_out + 1): - self[f"PATCH COMPOSITE||PC{i}"].bind("", "||FOCUS IN") + for i in range(self.vm.kind.phys_out): + self[f"PATCH COMPOSITE||PC{i + 1}"].bind("", "||FOCUS IN") # Patch Insert if self.kind.name != "basic": - for i in range(1, self.kind.num_strip + 1): + for i in range(self.kind.num_strip): if i <= self.kind.phys_in: - self[f"INSERT CHECKBOX||IN{i} 0"].bind("", "||FOCUS IN") - self[f"INSERT CHECKBOX||IN{i} 1"].bind("", "||FOCUS IN") + self[f"INSERT CHECKBOX||IN{i + 1} 0"].bind("", "||FOCUS IN") + self[f"INSERT CHECKBOX||IN{i + 1} 1"].bind("", "||FOCUS IN") else: - [self[f"INSERT CHECKBOX||IN{i} {j}"].bind("", "||FOCUS IN") for j in range(8)] + [self[f"INSERT CHECKBOX||IN{i + 1} {j}"].bind("", "||FOCUS IN") for j in range(8)] def run(self): """