add bus_modes to App class for tracking bus modes

add bus_modes to App class for tracking bus modes
This commit is contained in:
onyx-and-iris 2022-04-26 08:06:08 +01:00
parent 7e4acc3743
commit 4fb7a88855
3 changed files with 18 additions and 2 deletions

View File

@ -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)

View File

@ -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:
[

View File

@ -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("<Button-1>", self.rotate_bus_modes_right)