diff --git a/vmcompact/app.py b/vmcompact/app.py index 2c563d5..1795155 100644 --- a/vmcompact/app.py +++ b/vmcompact/app.py @@ -64,6 +64,7 @@ class App(tk.Tk): ] _base_vals.submixes = self.configuration["submixes"]["default"] _base_vals.mwscroll_step = self.configuration["mwscroll_step"]["size"] + self.bus_modes = [tk.StringVar(value="normal") for _ in range(12)] # create menus self.menus = Menus(self, vmr) diff --git a/vmcompact/channels.py b/vmcompact/channels.py index fc4b540..b47c263 100644 --- a/vmcompact/channels.py +++ b/vmcompact/channels.py @@ -280,8 +280,12 @@ class Bus(Channel): else: self.config_frame.grid(column=0, row=3, columnspan=4) self._parent._parent.channel_frame.reset_config_buttons(self) + self._parent._parent.bus_frame.update_bus_modes() self._parent._parent.bus_frame.reset_config_buttons(self) else: + self._parent._parent.bus_modes[self.index].set( + self.config_frame.bus_mode_current.get() + ) self.config_frame.destroy() if not _base_vals.using_theme: @@ -388,6 +392,15 @@ class ChannelFrame(ttk.Frame): def identifier(self): return "strip" if self._is_strip else "bus" + def update_bus_modes(self): + [ + self._parent.bus_modes[i].set( + labelframe.config_frame.bus_mode_current.get() + ) + for i, labelframe in enumerate(self.labelframes) + if labelframe is not None and labelframe.config_frame + ] + def reset_config_buttons(self, current): if not _base_vals.using_theme: [ diff --git a/vmcompact/config.py b/vmcompact/config.py index 6d25a2f..0dc3be5 100644 --- a/vmcompact/config.py +++ b/vmcompact/config.py @@ -380,9 +380,11 @@ class BusConfig(Config): def make_row0(self): self.bus_mode_label_text = tk.StringVar() - self.bus_mode_current = tk.StringVar(value="normal") + self.bus_mode_current = tk.StringVar( + value=self._parent.bus_modes[self.index].get() + ) self.bus_mode_label_text.set(f"Bus Mode: {self.bus_mode_current.get()}") - self.target.mode.normal = True + setattr(self.target.mode, self.bus_mode_current.get(), True) 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)