From 752f93a64ce819b873fc2ff430db00862faf0522 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 23 Aug 2023 02:31:15 +0100 Subject: [PATCH] only register patch events if not kind basic add basic build script --- build.ps1 | 3 +++ src/nvda_voicemeeter/builder.py | 18 ++++++++++------- src/nvda_voicemeeter/window.py | 34 +++++++++++++++++---------------- 3 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 build.ps1 diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..25a4f82 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,3 @@ +@("basic", "banana", "potato") | ForEach-Object { + pdm run pyinstaller "${_}.spec" --noconfirm +} \ No newline at end of file diff --git a/src/nvda_voicemeeter/builder.py b/src/nvda_voicemeeter/builder.py index b008da3..dd668e2 100644 --- a/src/nvda_voicemeeter/builder.py +++ b/src/nvda_voicemeeter/builder.py @@ -16,12 +16,16 @@ class Builder: self.kind = self.vm.kind def run(self) -> list: - row0 = self.make_row0() - row1 = self.make_row1() - row2 = self.make_row2() - return [[row0], [row1], [row2]] + layout = [] + if self.kind.name == "basic": + steps = (self.make_row0,) + else: + steps = (self.make_row0, self.make_row1, self.make_row2) + for step in steps: + layout.append([step()]) + return layout - def make_row0(self): + def make_row0(self) -> psg.Frame: def add_physical_device_opts(layout): devices = get_input_device_list(self.vm) devices.append("Deselect Device") @@ -44,7 +48,7 @@ class Builder: [step(hardware_out) for step in (add_physical_device_opts,)] return psg.Frame("Hardware Out", hardware_out) - def make_row1(self): + def make_row1(self) -> psg.Frame: def add_asio_checkboxes(layout, i): nums = list(range(99)) layout.append( @@ -79,7 +83,7 @@ class Builder: asio_checkboxes = [inner] return psg.Frame("PATCH ASIO Inputs to Strips", asio_checkboxes) - def make_row2(self): + def make_row2(self) -> psg.Frame: def add_insert_checkboxes(layout, i): if i <= self.kind.phys_in: layout.append( diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 945d575..bf64e58 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -41,22 +41,24 @@ class Window(psg.Window): for i in range(1, self.vm.kind.phys_out + 1): self[f"HARDWARE OUT||A{i}"].bind("", "||FOCUS IN") self[f"HARDWARE OUT||A{i}"].bind("", "||KEY RETURN") - 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(1, self.kind.num_strip + 1): - 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") - else: - 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} 2"].bind("", "||FOCUS IN") - self[f"INSERT CHECKBOX||IN{i} 3"].bind("", "||FOCUS IN") - self[f"INSERT CHECKBOX||IN{i} 4"].bind("", "||FOCUS IN") - self[f"INSERT CHECKBOX||IN{i} 5"].bind("", "||FOCUS IN") - self[f"INSERT CHECKBOX||IN{i} 6"].bind("", "||FOCUS IN") - self[f"INSERT CHECKBOX||IN{i} 7"].bind("", "||FOCUS IN") + 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") + if self.kind.name != "basic": + for i in range(1, self.kind.num_strip + 1): + 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") + else: + 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} 2"].bind("", "||FOCUS IN") + self[f"INSERT CHECKBOX||IN{i} 3"].bind("", "||FOCUS IN") + self[f"INSERT CHECKBOX||IN{i} 4"].bind("", "||FOCUS IN") + self[f"INSERT CHECKBOX||IN{i} 5"].bind("", "||FOCUS IN") + self[f"INSERT CHECKBOX||IN{i} 6"].bind("", "||FOCUS IN") + self[f"INSERT CHECKBOX||IN{i} 7"].bind("", "||FOCUS IN") def run(self): """