From 4ebab80a198be9e119df3e95c67bef814e6206aa Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sat, 26 Aug 2023 10:42:18 +0100 Subject: [PATCH] app now loads properly for kind basic --- src/nvda_voicemeeter/builder.py | 14 +++++++++----- src/nvda_voicemeeter/window.py | 8 +++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/nvda_voicemeeter/builder.py b/src/nvda_voicemeeter/builder.py index a2e5e59..29590b7 100644 --- a/src/nvda_voicemeeter/builder.py +++ b/src/nvda_voicemeeter/builder.py @@ -48,6 +48,10 @@ class Builder: def add_physical_device_opts(layout): devices = get_input_device_list(self.vm) devices.append("- remove device selection -") + if self.kind.name == "basic": + num_outs = self.kind.phys_out + self.kind.virt_out + else: + num_outs = self.kind.phys_out layout.append( [ psg.ButtonMenu( @@ -56,7 +60,7 @@ class Builder: menu_def=["", devices], key=f"HARDWARE OUT||A{i + 1}", ) - for i in range(self.kind.phys_out) + for i in range(num_outs) ] ) @@ -178,7 +182,7 @@ class Builder: if j < self.kind.phys_out else f"STRIP {i}||B{j - self.kind.phys_out + 1}", ) - for j in range(self.kind.num_strip) + for j in range(self.kind.phys_out + self.kind.virt_out) ] ) @@ -187,7 +191,7 @@ class Builder: return psg.Frame(self.vm.strip[i].label, outputs) def make_tab1_rows(self) -> psg.Frame: - layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_out)] + layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_in)] return psg.Frame(None, layout, border_width=0) def make_tab2_row(self, i) -> psg.Frame: @@ -201,7 +205,7 @@ class Builder: if j < self.kind.phys_out else f"STRIP {i}||B{j - self.kind.phys_out + 1}", ) - for j in range(self.kind.num_strip) + for j in range(self.kind.phys_out + self.kind.virt_out) ] ) @@ -210,5 +214,5 @@ class Builder: return psg.Frame(self.vm.strip[i].label, outputs) def make_tab2_rows(self) -> psg.Frame: - layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_out, self.kind.phys_out + self.kind.virt_out)] + layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_in, self.kind.phys_in + self.kind.virt_in)] return psg.Frame(None, layout, border_width=0) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index f3514ee..75dd903 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -31,7 +31,8 @@ class NVDAVMWindow(psg.Window): layout = self.builder.run() super().__init__(title, layout, finalize=True) [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)] + if self.kind.name != "basic": + [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): @@ -57,8 +58,9 @@ class NVDAVMWindow(psg.Window): self[f"ASIO CHECKBOX||IN{i + 1} 1"].bind("", "||FOCUS IN") # Patch Composite - for i in range(self.vm.kind.phys_out): - self[f"PATCH COMPOSITE||PC{i + 1}"].bind("", "||FOCUS IN") + if self.kind.name != "basic": + 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":