sync bus mode on create config frame

sync bus mode on create config frame
This commit is contained in:
onyx-and-iris 2022-04-27 14:22:23 +01:00
parent 109eb54c2e
commit b2f9c42f3e
2 changed files with 9 additions and 8 deletions

View File

@ -65,8 +65,8 @@ class App(tk.Tk):
_base_vals.submixes = self.configuration["submixes"]["default"] _base_vals.submixes = self.configuration["submixes"]["default"]
_base_vals.mwscroll_step = self.configuration["mwscroll_step"]["size"] _base_vals.mwscroll_step = self.configuration["mwscroll_step"]["size"]
self.bus_modes_cache = { self.bus_modes_cache = {
"vmr": 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(12)), "vban": list(tk.StringVar(value="normal") for _ in range(8)),
} }
# create menus # create menus

View File

@ -364,12 +364,12 @@ class BusConfig(Config):
self.params = ("mono", "eq", "eq_ab") self.params = ("mono", "eq", "eq_ab")
self.param_vars = [tk.BooleanVar() for i, _ in enumerate(self.params)] self.param_vars = [tk.BooleanVar() for i, _ in enumerate(self.params)]
self.make_row0()
self.make_row1()
# sync all parameters # sync all parameters
self.sync() self.sync()
self.make_row0()
self.make_row1()
self.col_row_configure() self.col_row_configure()
@property @property
@ -391,9 +391,7 @@ class BusConfig(Config):
].set(val) ].set(val)
def make_row0(self): def make_row0(self):
self.bus_mode_label_text = tk.StringVar() self.bus_mode_label_text = tk.StringVar(value=f"Bus Mode: {self.bus_mode}")
self.bus_mode_label_text.set(f"Bus Mode: {self.bus_mode}")
setattr(self.target.mode, self.bus_mode.lower(), True)
self.busmode_button = ttk.Button(self, textvariable=self.bus_mode_label_text) 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.grid(column=0, row=0, columnspan=2, sticky=(tk.W))
self.busmode_button.bind("<Button-1>", self.rotate_bus_modes_right) self.busmode_button.bind("<Button-1>", self.rotate_bus_modes_right)
@ -452,6 +450,9 @@ class BusConfig(Config):
] ]
def sync(self): 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)) self.param_vars[self.params.index(param)].set(self.getter(param))
for param in self.params for param in self.params