mirror of
https://github.com/onyx-and-iris/voicemeeter-compact.git
synced 2024-11-15 17:40:52 +00:00
updates to bus mode cache
add a separate bus mode cache for each interface. add property objects to config frame for setting/getting from bus mode cache. update function update_bus_modes to fit changes to bus mode cache
This commit is contained in:
parent
4fb7a88855
commit
80340ac219
@ -64,7 +64,10 @@ 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)]
|
||||
self.bus_modes_cache = {
|
||||
"vmr": list(tk.StringVar(value="normal") for _ in range(12)),
|
||||
"vban": list(tk.StringVar(value="normal") for _ in range(12)),
|
||||
}
|
||||
|
||||
# create menus
|
||||
self.menus = Menus(self, vmr)
|
||||
|
@ -394,9 +394,9 @@ class ChannelFrame(ttk.Frame):
|
||||
|
||||
def update_bus_modes(self):
|
||||
[
|
||||
self._parent.bus_modes[i].set(
|
||||
labelframe.config_frame.bus_mode_current.get()
|
||||
)
|
||||
self._parent.bus_modes_cache[
|
||||
"vban" if _base_vals.vban_connected else "vmr"
|
||||
][i].set(labelframe.config_frame.bus_mode)
|
||||
for i, labelframe in enumerate(self.labelframes)
|
||||
if labelframe is not None and labelframe.config_frame
|
||||
]
|
||||
|
@ -378,35 +378,44 @@ class BusConfig(Config):
|
||||
_target = super(BusConfig, self).target
|
||||
return getattr(_target, self.identifier)[self.index]
|
||||
|
||||
@property
|
||||
def bus_mode(self):
|
||||
return self._parent.bus_modes_cache[
|
||||
"vban" if _base_vals.vban_connected else "vmr"
|
||||
][self.index].get()
|
||||
|
||||
@bus_mode.setter
|
||||
def bus_mode(self, val):
|
||||
self._parent.bus_modes_cache["vban" if _base_vals.vban_connected else "vmr"][
|
||||
self.index
|
||||
].set(val)
|
||||
|
||||
def make_row0(self):
|
||||
self.bus_mode_label_text = tk.StringVar()
|
||||
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()}")
|
||||
setattr(self.target.mode, self.bus_mode_current.get(), True)
|
||||
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.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-3>", self.rotate_bus_modes_left)
|
||||
|
||||
def rotate_bus_modes_right(self, *args):
|
||||
current_index = self.bus_modes.index(self.bus_mode_current.get())
|
||||
current_index = self.bus_modes.index(self.bus_mode)
|
||||
if current_index + 1 < len(self.bus_modes):
|
||||
self.bus_mode_current.set(self.bus_modes[current_index + 1])
|
||||
self.bus_mode = self.bus_modes[current_index + 1]
|
||||
else:
|
||||
self.bus_mode_current.set(self.bus_modes[0])
|
||||
setattr(self.target.mode, self.bus_mode_current.get().lower(), True)
|
||||
self.bus_mode_label_text.set(f"Bus Mode: {self.bus_mode_current.get()}")
|
||||
self.bus_mode = self.bus_modes[0]
|
||||
setattr(self.target.mode, self.bus_mode.lower(), True)
|
||||
self.bus_mode_label_text.set(f"Bus Mode: {self.bus_mode}")
|
||||
|
||||
def rotate_bus_modes_left(self, *args):
|
||||
current_index = self.bus_modes.index(self.bus_mode_current.get())
|
||||
current_index = self.bus_modes.index(self.bus_mode)
|
||||
if current_index == 0:
|
||||
self.bus_mode_current.set(self.bus_modes[-1])
|
||||
self.bus_mode = self.bus_modes[-1]
|
||||
else:
|
||||
self.bus_mode_current.set(self.bus_modes[current_index - 1])
|
||||
setattr(self.target.mode, self.bus_mode_current.get().lower(), True)
|
||||
self.bus_mode_label_text.set(f"Bus Mode: {self.bus_mode_current.get()}")
|
||||
self.bus_mode = self.bus_modes[current_index - 1]
|
||||
setattr(self.target.mode, self.bus_mode.lower(), True)
|
||||
self.bus_mode_label_text.set(f"Bus Mode: {self.bus_mode}")
|
||||
|
||||
def make_row1(self):
|
||||
param_buttons = [
|
||||
|
Loading…
Reference in New Issue
Block a user