From b2f9c42f3e9175ebf1a6ca457cb2ea49753ef39e Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Wed, 27 Apr 2022 14:22:23 +0100 Subject: [PATCH] sync bus mode on create config frame sync bus mode on create config frame --- vmcompact/app.py | 4 ++-- vmcompact/config.py | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/vmcompact/app.py b/vmcompact/app.py index de6b937..ad30daa 100644 --- a/vmcompact/app.py +++ b/vmcompact/app.py @@ -65,8 +65,8 @@ class App(tk.Tk): _base_vals.submixes = self.configuration["submixes"]["default"] _base_vals.mwscroll_step = self.configuration["mwscroll_step"]["size"] self.bus_modes_cache = { - "vmr": list(tk.StringVar(value="normal") for _ in range(12)), - "vban": list(tk.StringVar(value="normal") for _ in range(12)), + "vmr": list(tk.StringVar(value="normal") for _ in range(8)), + "vban": list(tk.StringVar(value="normal") for _ in range(8)), } # create menus diff --git a/vmcompact/config.py b/vmcompact/config.py index bab010a..4324216 100644 --- a/vmcompact/config.py +++ b/vmcompact/config.py @@ -364,12 +364,12 @@ class BusConfig(Config): self.params = ("mono", "eq", "eq_ab") self.param_vars = [tk.BooleanVar() for i, _ in enumerate(self.params)] - self.make_row0() - self.make_row1() - # sync all parameters self.sync() + self.make_row0() + self.make_row1() + self.col_row_configure() @property @@ -391,9 +391,7 @@ class BusConfig(Config): ].set(val) def make_row0(self): - self.bus_mode_label_text = tk.StringVar() - self.bus_mode_label_text.set(f"Bus Mode: {self.bus_mode}") - setattr(self.target.mode, self.bus_mode.lower(), True) + self.bus_mode_label_text = tk.StringVar(value=f"Bus Mode: {self.bus_mode}") self.busmode_button = ttk.Button(self, textvariable=self.bus_mode_label_text) self.busmode_button.grid(column=0, row=0, columnspan=2, sticky=(tk.W)) self.busmode_button.bind("", self.rotate_bus_modes_right) @@ -452,6 +450,9 @@ class BusConfig(Config): ] def sync(self): + for i, mode in enumerate(self.bus_modes): + if getattr(self.target.mode, mode.lower()): + self.bus_mode = self.bus_modes[i] [ self.param_vars[self.params.index(param)].set(self.getter(param)) for param in self.params