2022-09-29 13:45:06 +01:00
|
|
|
import logging
|
2022-04-11 18:35:28 +01:00
|
|
|
import tkinter as tk
|
|
|
|
import webbrowser
|
2022-06-16 23:53:28 +01:00
|
|
|
from functools import partial
|
2023-06-26 13:57:08 +01:00
|
|
|
from tkinter import messagebox
|
2022-06-16 23:53:28 +01:00
|
|
|
|
2022-04-24 12:05:57 +01:00
|
|
|
import sv_ttk
|
2022-06-16 23:53:28 +01:00
|
|
|
import vban_cmd
|
2023-06-26 13:57:08 +01:00
|
|
|
from vban_cmd.error import VBANCMDConnectionError
|
2022-04-11 18:35:28 +01:00
|
|
|
|
2022-06-16 23:53:28 +01:00
|
|
|
from .data import _base_values, _configuration, get_configuration, kind_get
|
2022-04-11 18:35:28 +01:00
|
|
|
|
2023-06-26 13:57:08 +01:00
|
|
|
logger = logging.getLogger(__name__)
|
2022-04-11 18:35:28 +01:00
|
|
|
|
2022-09-29 13:45:06 +01:00
|
|
|
|
2023-06-26 13:57:08 +01:00
|
|
|
class Menus(tk.Menu):
|
2022-04-11 18:35:28 +01:00
|
|
|
def __init__(self, parent, vmr):
|
|
|
|
super().__init__()
|
2022-05-10 20:34:29 +01:00
|
|
|
self.parent = parent
|
|
|
|
self.vmr = vmr
|
2023-06-26 13:57:08 +01:00
|
|
|
self.logger = logger.getChild(self.__class__.__name__)
|
2022-05-10 20:34:29 +01:00
|
|
|
self.vban_config = get_configuration("vban")
|
|
|
|
self.app_config = get_configuration("app")
|
2022-04-11 18:35:28 +01:00
|
|
|
self._is_topmost = tk.BooleanVar()
|
2022-05-14 14:05:48 +01:00
|
|
|
self._lock = tk.BooleanVar()
|
|
|
|
self._unlock = tk.BooleanVar()
|
2023-06-29 15:51:17 +01:00
|
|
|
self._navigation_show = tk.BooleanVar(value=_configuration.navigation_show)
|
|
|
|
self._navigation_hide = tk.BooleanVar(value=not _configuration.navigation_show)
|
2022-04-11 18:35:28 +01:00
|
|
|
self._selected_bus = list(tk.BooleanVar() for _ in range(8))
|
|
|
|
|
|
|
|
# voicemeeter menu
|
2022-05-05 11:08:23 +01:00
|
|
|
self.menu_voicemeeter = tk.Menu(self, tearoff=0)
|
|
|
|
self.add_cascade(menu=self.menu_voicemeeter, label="Voicemeeter")
|
2022-04-11 18:35:28 +01:00
|
|
|
self.menu_voicemeeter.add_checkbutton(
|
|
|
|
label="Always On Top",
|
|
|
|
onvalue=1,
|
|
|
|
offvalue=0,
|
|
|
|
variable=self._is_topmost,
|
|
|
|
command=self.always_on_top,
|
|
|
|
)
|
|
|
|
self.menu_voicemeeter.add_separator()
|
|
|
|
self.menu_voicemeeter.add_command(
|
|
|
|
label="Show",
|
|
|
|
underline=0,
|
|
|
|
command=partial(self.action_invoke_voicemeeter, "show"),
|
|
|
|
)
|
|
|
|
self.menu_voicemeeter.add_command(
|
|
|
|
label="Hide",
|
|
|
|
underline=0,
|
|
|
|
command=partial(self.action_invoke_voicemeeter, "hide"),
|
|
|
|
)
|
|
|
|
self.menu_voicemeeter.add_command(
|
|
|
|
label="Restart",
|
|
|
|
underline=0,
|
|
|
|
command=partial(self.action_invoke_voicemeeter, "restart"),
|
|
|
|
)
|
|
|
|
self.menu_voicemeeter.add_command(
|
|
|
|
label="Shutdown",
|
|
|
|
underline=0,
|
|
|
|
command=partial(self.action_invoke_voicemeeter, "shutdown"),
|
|
|
|
)
|
|
|
|
self.menu_voicemeeter.add_separator()
|
|
|
|
self.menu_lock = tk.Menu(self.menu_voicemeeter, tearoff=0)
|
|
|
|
self.menu_voicemeeter.add_cascade(
|
|
|
|
menu=self.menu_lock, label="GUI Lock", underline=0
|
|
|
|
)
|
2022-05-14 14:05:48 +01:00
|
|
|
self.menu_lock.add_checkbutton(
|
|
|
|
label="Lock",
|
|
|
|
onvalue=1,
|
|
|
|
offvalue=0,
|
|
|
|
variable=self._lock,
|
|
|
|
command=partial(self.action_set_voicemeeter, "lock"),
|
2022-04-11 18:35:28 +01:00
|
|
|
)
|
2022-05-14 14:05:48 +01:00
|
|
|
self.menu_lock.add_checkbutton(
|
|
|
|
label="Unlock",
|
|
|
|
onvalue=1,
|
|
|
|
offvalue=0,
|
|
|
|
variable=self._unlock,
|
|
|
|
command=partial(self.action_set_voicemeeter, "lock", False),
|
2022-04-11 18:35:28 +01:00
|
|
|
)
|
|
|
|
|
2022-06-16 23:53:28 +01:00
|
|
|
# configs menu
|
2022-07-16 22:14:39 +01:00
|
|
|
self.menu_configs = tk.Menu(self, tearoff=0)
|
|
|
|
self.add_cascade(menu=self.menu_configs, label="Configs")
|
|
|
|
self.menu_configs_load = tk.Menu(self.menu_configs, tearoff=0)
|
|
|
|
self.menu_configs.add_cascade(menu=self.menu_configs_load, label="Load config")
|
|
|
|
self.config_defaults = {"reset"}
|
|
|
|
if len(self.target.configs) > len(self.config_defaults) and all(
|
|
|
|
key in self.target.configs for key in self.config_defaults
|
2022-04-11 18:35:28 +01:00
|
|
|
):
|
|
|
|
[
|
2022-06-16 23:53:28 +01:00
|
|
|
self.menu_configs_load.add_command(
|
2022-04-11 18:35:28 +01:00
|
|
|
label=profile, command=partial(self.load_profile, profile)
|
|
|
|
)
|
2022-06-16 23:53:28 +01:00
|
|
|
for profile in self.target.configs.keys()
|
2022-07-16 22:14:39 +01:00
|
|
|
if profile not in self.config_defaults
|
2022-04-11 18:35:28 +01:00
|
|
|
]
|
2023-06-26 16:08:58 +01:00
|
|
|
elif self.parent.userconfigs:
|
|
|
|
[
|
|
|
|
self.menu_configs_load.add_command(
|
|
|
|
label=name, command=partial(self.load_custom_profile, data)
|
|
|
|
)
|
|
|
|
for name, data in self.parent.userconfigs.items()
|
|
|
|
if name not in self.config_defaults
|
|
|
|
]
|
2022-04-11 18:35:28 +01:00
|
|
|
else:
|
2022-07-16 22:14:39 +01:00
|
|
|
self.menu_configs.entryconfig(0, state="disabled")
|
|
|
|
self.menu_configs.add_command(
|
|
|
|
label="Reset to defaults", command=self.load_defaults
|
|
|
|
)
|
2022-04-11 18:35:28 +01:00
|
|
|
|
2022-05-06 13:35:31 +01:00
|
|
|
# layout menu
|
|
|
|
self.menu_layout = tk.Menu(self, tearoff=0)
|
|
|
|
self.add_cascade(menu=self.menu_layout, label="Layout")
|
2022-05-10 20:34:29 +01:00
|
|
|
# layout/submixes
|
2022-06-16 23:53:28 +01:00
|
|
|
# here we build menu regardless of kind but disable if not potato
|
2022-05-10 20:34:29 +01:00
|
|
|
buses = tuple(f"A{i+1}" for i in range(5)) + tuple(f"B{i+1}" for i in range(3))
|
|
|
|
self.menu_submixes = tk.Menu(self.menu_layout, tearoff=0)
|
|
|
|
self.menu_layout.add_cascade(menu=self.menu_submixes, label="Submixes")
|
|
|
|
[
|
|
|
|
self.menu_submixes.add_checkbutton(
|
|
|
|
label=f"Bus {buses[i]}",
|
|
|
|
underline=0,
|
|
|
|
onvalue=1,
|
|
|
|
offvalue=0,
|
|
|
|
variable=self._selected_bus[i],
|
|
|
|
command=partial(self.set_submix, i),
|
|
|
|
)
|
|
|
|
for i in range(8)
|
|
|
|
]
|
2022-05-16 22:20:05 +01:00
|
|
|
self._selected_bus[_configuration.submixes].set(True)
|
2022-06-16 23:53:28 +01:00
|
|
|
if self.parent.kind.name != "potato":
|
2022-05-10 20:34:29 +01:00
|
|
|
self.menu_layout.entryconfig(0, state="disabled")
|
2022-05-06 13:35:31 +01:00
|
|
|
# layout/extends
|
|
|
|
self.menu_extends = tk.Menu(self.menu_layout, tearoff=0)
|
|
|
|
self.menu_layout.add_cascade(
|
|
|
|
menu=self.menu_extends, label="Extends", underline=0
|
|
|
|
)
|
2022-04-11 18:35:28 +01:00
|
|
|
self.menu_extends.add_command(
|
|
|
|
label="horizontal",
|
|
|
|
underline=0,
|
|
|
|
command=partial(self.switch_orientation, extends_horizontal=True),
|
|
|
|
)
|
|
|
|
self.menu_extends.add_command(
|
|
|
|
label="vertical",
|
|
|
|
underline=0,
|
|
|
|
command=partial(self.switch_orientation, extends_horizontal=False),
|
|
|
|
)
|
|
|
|
self.menu_extends.entryconfig(
|
2022-05-10 20:34:29 +01:00
|
|
|
0 if _configuration.extends_horizontal else 1, state="disabled"
|
2022-04-11 18:35:28 +01:00
|
|
|
)
|
2022-05-06 13:35:31 +01:00
|
|
|
# layout/themes
|
|
|
|
self.menu_themes = tk.Menu(self.menu_layout, tearoff=0)
|
|
|
|
self.menu_layout.add_cascade(menu=self.menu_themes, label="Themes")
|
|
|
|
self.menu_themes.add_command(
|
|
|
|
label="light", command=partial(self.load_theme, "light")
|
|
|
|
)
|
|
|
|
self.menu_themes.add_command(
|
|
|
|
label="dark", command=partial(self.load_theme, "dark")
|
|
|
|
)
|
|
|
|
self.menu_themes.entryconfig(
|
2022-05-10 20:34:29 +01:00
|
|
|
0 if self.app_config["theme"]["mode"] == "light" else 1,
|
2022-05-06 13:35:31 +01:00
|
|
|
state="disabled",
|
|
|
|
)
|
2022-05-10 20:34:29 +01:00
|
|
|
if not _configuration.themes_enabled:
|
2022-05-14 14:05:48 +01:00
|
|
|
self.menu_layout.entryconfig(2, state="disabled")
|
2023-06-29 15:51:17 +01:00
|
|
|
# layout/navigation
|
|
|
|
self.menu_navigation = tk.Menu(self.menu_layout, tearoff=0)
|
|
|
|
self.menu_layout.add_cascade(menu=self.menu_navigation, label="Navigation")
|
|
|
|
self.menu_navigation.add_checkbutton(
|
|
|
|
label="show",
|
|
|
|
onvalue=1,
|
|
|
|
offvalue=0,
|
|
|
|
variable=self._navigation_show,
|
|
|
|
command=partial(self.toggle_navigation, "show"),
|
|
|
|
)
|
|
|
|
self.menu_navigation.add_checkbutton(
|
|
|
|
label="hide",
|
|
|
|
onvalue=1,
|
|
|
|
offvalue=0,
|
|
|
|
variable=self._navigation_hide,
|
|
|
|
command=partial(self.toggle_navigation, "hide"),
|
|
|
|
)
|
2022-05-10 20:34:29 +01:00
|
|
|
|
|
|
|
# vban connect menu
|
|
|
|
self.menu_vban = tk.Menu(self, tearoff=0)
|
|
|
|
self.add_cascade(menu=self.menu_vban, label="VBAN")
|
|
|
|
if self.vban_config:
|
|
|
|
for i, _ in enumerate(self.vban_config):
|
|
|
|
setattr(self, f"menu_vban_{i+1}", tk.Menu(self.menu_vban, tearoff=0))
|
|
|
|
target_menu = getattr(self, f"menu_vban_{i+1}")
|
|
|
|
self.menu_vban.add_cascade(
|
|
|
|
menu=target_menu,
|
|
|
|
label=f"{self.vban_config[f'connection-{i+1}']['streamname']}",
|
|
|
|
underline=0,
|
|
|
|
)
|
|
|
|
target_menu.add_command(
|
|
|
|
label="Connect", command=partial(self.vban_connect, i)
|
|
|
|
)
|
|
|
|
target_menu.add_command(
|
|
|
|
label="Disconnect", command=partial(self.vban_disconnect, i)
|
|
|
|
)
|
|
|
|
target_menu.entryconfig(1, state="disabled")
|
|
|
|
else:
|
2022-05-14 14:05:48 +01:00
|
|
|
self.entryconfig(4, state="disabled")
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
# Help menu
|
2022-05-05 11:08:23 +01:00
|
|
|
self.menu_help = tk.Menu(self, tearoff=0)
|
|
|
|
self.add_cascade(menu=self.menu_help, label="Help")
|
2022-04-11 18:35:28 +01:00
|
|
|
self.menu_help.add_command(
|
|
|
|
label="Voicemeeter Site",
|
|
|
|
command=self.documentation,
|
|
|
|
)
|
|
|
|
self.menu_help.add_command(
|
|
|
|
label="Source Code",
|
|
|
|
command=self.github,
|
|
|
|
)
|
|
|
|
self.menu_help.add_command(
|
|
|
|
label="App Creator",
|
|
|
|
command=self.onyxandiris,
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def target(self):
|
|
|
|
"""use the correct interface"""
|
2022-05-10 20:34:29 +01:00
|
|
|
return self.parent.target
|
2022-04-11 18:35:28 +01:00
|
|
|
|
2022-05-10 20:34:29 +01:00
|
|
|
def enable_vban_menus(self):
|
|
|
|
[
|
|
|
|
self.menu_vban.entryconfig(j, state="normal")
|
|
|
|
for j, _ in enumerate(self.menu_vban.winfo_children())
|
|
|
|
]
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
def action_invoke_voicemeeter(self, cmd):
|
|
|
|
getattr(self.target.command, cmd)()
|
|
|
|
|
|
|
|
def action_set_voicemeeter(self, cmd, val=True):
|
2022-05-14 14:05:48 +01:00
|
|
|
if cmd == "lock":
|
|
|
|
self._lock.set(val)
|
|
|
|
self._unlock.set(not self._lock.get())
|
2022-04-11 18:35:28 +01:00
|
|
|
setattr(self.target.command, cmd, val)
|
|
|
|
|
2023-06-26 16:08:58 +01:00
|
|
|
def load_custom_profile(self, profile):
|
|
|
|
self.logger.info(f"loading user profile {profile}")
|
|
|
|
self.target.apply(profile)
|
|
|
|
|
2022-04-11 18:35:28 +01:00
|
|
|
def load_profile(self, profile):
|
2023-06-26 13:57:08 +01:00
|
|
|
self.logger.info(f"loading user profile {profile}")
|
2022-06-16 23:53:28 +01:00
|
|
|
self.target.apply_config(profile)
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
def load_defaults(self):
|
2023-06-26 13:57:08 +01:00
|
|
|
msg = (
|
|
|
|
"Are you sure you want to Reset values to defaults?",
|
|
|
|
"Physical strips B1, Virtual strips A1",
|
|
|
|
"Mono, Solo, Mute, EQ all OFF",
|
|
|
|
"Gain sliders for Strip/Bus at 0.0",
|
2022-04-11 18:35:28 +01:00
|
|
|
)
|
2023-06-26 13:57:08 +01:00
|
|
|
resp = messagebox.askyesno(message="\n".join(msg))
|
2022-04-11 18:35:28 +01:00
|
|
|
if resp:
|
2023-06-26 13:57:08 +01:00
|
|
|
self.load_profile("reset")
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
def always_on_top(self):
|
2022-05-10 20:34:29 +01:00
|
|
|
self.parent.attributes("-topmost", self._is_topmost.get())
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
def switch_orientation(self, extends_horizontal: bool = True, *args):
|
2022-05-10 20:34:29 +01:00
|
|
|
_configuration.extends_horizontal = extends_horizontal
|
2022-04-11 18:35:28 +01:00
|
|
|
if extends_horizontal:
|
|
|
|
self.menu_extends.entryconfig(0, state="disabled")
|
|
|
|
self.menu_extends.entryconfig(1, state="normal")
|
|
|
|
else:
|
|
|
|
self.menu_extends.entryconfig(1, state="disabled")
|
|
|
|
self.menu_extends.entryconfig(0, state="normal")
|
|
|
|
|
|
|
|
def set_submix(self, i):
|
2022-05-16 22:20:05 +01:00
|
|
|
if _configuration.submixes != i:
|
|
|
|
_configuration.submixes = i
|
2022-05-10 20:34:29 +01:00
|
|
|
if self.parent.submix_frame is not None:
|
|
|
|
self.parent.submix_frame.teardown()
|
|
|
|
self.parent.nav_frame.show_submix()
|
2022-04-11 18:35:28 +01:00
|
|
|
for j, var in enumerate(self._selected_bus):
|
2022-05-14 14:05:48 +01:00
|
|
|
var.set(i == j)
|
2023-06-26 13:57:08 +01:00
|
|
|
self.parent.subject.notify("submix")
|
2022-04-11 18:35:28 +01:00
|
|
|
|
2022-05-05 11:08:23 +01:00
|
|
|
def load_theme(self, theme):
|
|
|
|
sv_ttk.set_theme(theme)
|
2022-05-14 14:05:48 +01:00
|
|
|
_configuration.theme_mode = theme
|
2022-04-11 18:35:28 +01:00
|
|
|
self.menu_themes.entryconfig(
|
|
|
|
0,
|
2022-05-05 11:08:23 +01:00
|
|
|
state=f"{'disabled' if theme == 'light' else 'normal'}",
|
2022-04-11 18:35:28 +01:00
|
|
|
)
|
|
|
|
self.menu_themes.entryconfig(
|
|
|
|
1,
|
2022-05-05 11:08:23 +01:00
|
|
|
state=f"{'disabled' if theme == 'dark' else 'normal'}",
|
2022-04-11 18:35:28 +01:00
|
|
|
)
|
|
|
|
[
|
2022-05-05 11:08:23 +01:00
|
|
|
menu.config(bg=f"{'black' if theme == 'dark' else 'white'}")
|
|
|
|
for menu in self.winfo_children()
|
2022-04-11 18:35:28 +01:00
|
|
|
if isinstance(menu, tk.Menu)
|
|
|
|
]
|
2022-05-05 11:08:23 +01:00
|
|
|
self.menu_lock.config(bg=f"{'black' if theme == 'dark' else 'white'}")
|
2022-06-16 23:53:28 +01:00
|
|
|
self.menu_configs_load.config(bg=f"{'black' if theme == 'dark' else 'white'}")
|
2022-04-11 18:35:28 +01:00
|
|
|
[
|
2022-05-05 11:08:23 +01:00
|
|
|
menu.config(bg=f"{'black' if theme == 'dark' else 'white'}")
|
2022-04-11 18:35:28 +01:00
|
|
|
for menu in self.menu_vban.winfo_children()
|
|
|
|
if isinstance(menu, tk.Menu)
|
|
|
|
]
|
2022-05-06 13:35:31 +01:00
|
|
|
[
|
|
|
|
menu.config(bg=f"{'black' if theme == 'dark' else 'white'}")
|
|
|
|
for menu in self.menu_layout.winfo_children()
|
|
|
|
if isinstance(menu, tk.Menu)
|
|
|
|
]
|
2022-09-29 13:45:06 +01:00
|
|
|
self.logger.info(
|
|
|
|
f"Finished loading theme Sunvalley {sv_ttk.get_theme().capitalize()} theme"
|
|
|
|
)
|
2022-04-11 18:35:28 +01:00
|
|
|
|
2022-09-23 20:23:55 +01:00
|
|
|
def menu_teardown(self, i):
|
2022-07-16 22:14:39 +01:00
|
|
|
# remove config load menus
|
2023-07-07 03:37:06 +01:00
|
|
|
removed = []
|
|
|
|
for key in self.target.configs.keys():
|
|
|
|
if key not in self.config_defaults:
|
|
|
|
try:
|
|
|
|
self.menu_configs_load.delete(key)
|
|
|
|
removed.append(key)
|
|
|
|
except tk._tkinter.tclError as e:
|
|
|
|
self.logger.warning(f"{type(e).__name__}: {e}")
|
|
|
|
|
|
|
|
for key in self.parent.userconfigs.keys():
|
|
|
|
if key not in self.config_defaults and key not in removed:
|
|
|
|
try:
|
|
|
|
self.menu_configs_load.delete(key)
|
|
|
|
except tk._tkinter.tclError as e:
|
|
|
|
self.logger.warning(f"{type(e).__name__}: {e}")
|
2022-07-16 22:14:39 +01:00
|
|
|
|
2022-04-11 18:35:28 +01:00
|
|
|
[
|
|
|
|
self.menu_vban.entryconfig(j, state="disabled")
|
|
|
|
for j, _ in enumerate(self.menu_vban.winfo_children())
|
|
|
|
if j != i
|
|
|
|
]
|
|
|
|
|
2022-09-23 20:23:55 +01:00
|
|
|
def menu_setup(self):
|
|
|
|
if len(self.target.configs) > len(self.config_defaults) and all(
|
|
|
|
key in self.target.configs for key in self.config_defaults
|
|
|
|
):
|
|
|
|
[
|
|
|
|
self.menu_configs_load.add_command(
|
|
|
|
label=profile, command=partial(self.load_profile, profile)
|
|
|
|
)
|
|
|
|
for profile in self.target.configs.keys()
|
|
|
|
if profile not in self.config_defaults
|
|
|
|
]
|
2023-06-26 16:08:58 +01:00
|
|
|
elif self.parent.userconfigs:
|
|
|
|
[
|
|
|
|
self.menu_configs_load.add_command(
|
|
|
|
label=name, command=partial(self.load_custom_profile, data)
|
|
|
|
)
|
|
|
|
for name, data in self.parent.userconfigs.items()
|
|
|
|
if name not in self.config_defaults
|
|
|
|
]
|
2022-09-23 20:23:55 +01:00
|
|
|
else:
|
|
|
|
self.menu_configs.entryconfig(0, state="disabled")
|
|
|
|
|
2023-06-29 15:51:17 +01:00
|
|
|
def toggle_navigation(self, cmd=None):
|
|
|
|
if cmd == "show":
|
|
|
|
self.logger.debug("show navframe")
|
|
|
|
self.parent.nav_frame.grid()
|
|
|
|
self._navigation_show.set(True)
|
|
|
|
self._navigation_hide.set(not self._navigation_show.get())
|
|
|
|
else:
|
|
|
|
self.logger.debug("hide navframe")
|
|
|
|
self.parent.nav_frame.grid_remove()
|
|
|
|
self._navigation_hide.set(True)
|
|
|
|
self._navigation_show.set(not self._navigation_hide.get())
|
|
|
|
|
2022-09-23 20:23:55 +01:00
|
|
|
def vban_connect(self, i):
|
2022-04-11 18:35:28 +01:00
|
|
|
opts = {}
|
2022-05-10 20:34:29 +01:00
|
|
|
opts |= self.vban_config[f"connection-{i+1}"]
|
2022-04-11 18:35:28 +01:00
|
|
|
kind_id = opts.pop("kind")
|
2022-06-16 23:53:28 +01:00
|
|
|
self.vban = vban_cmd.api(kind_id, **opts)
|
2022-04-11 18:35:28 +01:00
|
|
|
# login to vban interface
|
2022-09-23 20:23:55 +01:00
|
|
|
try:
|
2022-09-29 13:45:06 +01:00
|
|
|
self.logger.info(f"Attempting vban connection to {opts.get('ip')}")
|
2022-09-23 20:23:55 +01:00
|
|
|
self.vban.login()
|
2023-06-26 13:57:08 +01:00
|
|
|
except VBANCMDConnectionError as e:
|
2022-09-29 13:45:06 +01:00
|
|
|
self.vban.logout()
|
2023-06-26 13:57:08 +01:00
|
|
|
msg = (
|
|
|
|
f"Timeout attempting to establish connection to {opts.get('ip')}",
|
|
|
|
f"Please check your connection settings",
|
|
|
|
)
|
2022-09-24 08:04:59 +01:00
|
|
|
messagebox.showerror("Connection Error", "\n".join(msg))
|
2022-09-29 13:45:06 +01:00
|
|
|
msg = (str(e), f"resuming local connection")
|
|
|
|
self.logger.error(", ".join(msg))
|
2022-09-23 20:23:55 +01:00
|
|
|
self.after(1, self.enable_vban_menus)
|
|
|
|
return
|
|
|
|
self.menu_teardown(i)
|
2023-06-26 13:57:08 +01:00
|
|
|
self.vban.event.add(["pdirty", "ldirty"])
|
2022-04-11 18:35:28 +01:00
|
|
|
# destroy the current App frames
|
2022-05-10 20:34:29 +01:00
|
|
|
self.parent._destroy_top_level_frames()
|
|
|
|
_base_values.vban_connected = True
|
2022-05-14 14:05:48 +01:00
|
|
|
self.vmr.end_thread()
|
2022-07-16 22:14:39 +01:00
|
|
|
|
2022-04-11 18:35:28 +01:00
|
|
|
# build new app frames according to a kind
|
|
|
|
kind = kind_get(kind_id)
|
2022-05-10 20:34:29 +01:00
|
|
|
self.parent.build_app(kind, self.vban)
|
2022-04-11 18:35:28 +01:00
|
|
|
target_menu = getattr(self, f"menu_vban_{i+1}")
|
|
|
|
target_menu.entryconfig(0, state="disabled")
|
|
|
|
target_menu.entryconfig(1, state="normal")
|
2022-05-06 13:35:31 +01:00
|
|
|
self.menu_layout.entryconfig(
|
2022-06-16 23:53:28 +01:00
|
|
|
0, state=f"{'normal' if kind.name == 'potato' else 'disabled'}"
|
2022-04-11 18:35:28 +01:00
|
|
|
)
|
2023-06-26 16:08:58 +01:00
|
|
|
# ensure the configs are reloaded into memory
|
|
|
|
if "config" in self.parent.target.__dict__:
|
|
|
|
del self.parent.target.__dict__["config"]
|
|
|
|
if "userconfigs" in self.parent.__dict__:
|
|
|
|
del self.parent.__dict__["userconfigs"]
|
2022-09-23 20:23:55 +01:00
|
|
|
self.menu_setup()
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
def vban_disconnect(self, i):
|
2022-09-23 20:23:55 +01:00
|
|
|
self.menu_teardown(i)
|
2022-07-16 22:14:39 +01:00
|
|
|
|
2022-04-11 18:35:28 +01:00
|
|
|
# destroy the current App frames
|
2022-05-10 20:34:29 +01:00
|
|
|
self.parent._destroy_top_level_frames()
|
|
|
|
_base_values.vban_connected = False
|
2022-04-11 18:35:28 +01:00
|
|
|
# logout of vban interface
|
2022-05-14 14:05:48 +01:00
|
|
|
self.vmr.init_thread()
|
2022-05-10 20:34:29 +01:00
|
|
|
self.vban.logout()
|
2022-04-11 18:35:28 +01:00
|
|
|
# build new app frames according to a kind
|
2022-05-10 20:34:29 +01:00
|
|
|
kind = kind_get(self.vmr.type)
|
|
|
|
self.parent.build_app(kind, None)
|
2022-04-11 18:35:28 +01:00
|
|
|
target_menu = getattr(self, f"menu_vban_{i+1}")
|
|
|
|
target_menu.entryconfig(0, state="normal")
|
|
|
|
target_menu.entryconfig(1, state="disabled")
|
2022-05-06 13:35:31 +01:00
|
|
|
self.menu_layout.entryconfig(
|
2022-06-16 23:53:28 +01:00
|
|
|
0, state=f"{'normal' if kind.name == 'potato' else 'disabled'}"
|
2022-04-21 09:15:02 +01:00
|
|
|
)
|
2023-06-26 16:08:58 +01:00
|
|
|
# ensure the configs are reloaded into memory
|
|
|
|
if "config" in self.parent.target.__dict__:
|
|
|
|
del self.parent.target.__dict__["config"]
|
|
|
|
if "userconfigs" in self.parent.__dict__:
|
|
|
|
del self.parent.__dict__["userconfigs"]
|
2022-09-23 20:23:55 +01:00
|
|
|
self.menu_setup()
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
self.after(15000, self.enable_vban_menus)
|
|
|
|
|
|
|
|
def documentation(self):
|
|
|
|
webbrowser.open_new(r"https://voicemeeter.com/")
|
|
|
|
|
|
|
|
def github(self):
|
2022-05-05 11:08:23 +01:00
|
|
|
webbrowser.open_new(r"https://github.com/onyx-and-iris/voicemeeter-compact")
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
def onyxandiris(self):
|
|
|
|
webbrowser.open_new(r"https://onyxandiris.online")
|