2022-04-11 18:35:28 +01:00
|
|
|
from dataclasses import dataclass
|
|
|
|
from voicemeeter import kinds
|
|
|
|
|
2022-05-10 20:34:29 +01:00
|
|
|
from .configurations import get_configuration
|
|
|
|
|
|
|
|
configuration = get_configuration("app")
|
|
|
|
|
|
|
|
|
|
|
|
class SingletonMeta(type):
|
|
|
|
_instances = {}
|
|
|
|
|
|
|
|
def __call__(cls, *args, **kwargs):
|
|
|
|
if cls not in cls._instances:
|
|
|
|
instance = super().__call__(*args, **kwargs)
|
|
|
|
cls._instances[cls] = instance
|
|
|
|
return cls._instances[cls]
|
|
|
|
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
@dataclass
|
2022-05-10 20:34:29 +01:00
|
|
|
class Configurations(metaclass=SingletonMeta):
|
|
|
|
# width of a single labelframe
|
|
|
|
level_width: int = 75
|
|
|
|
# height of a single labelframe
|
2022-04-11 18:35:28 +01:00
|
|
|
level_height: int = 100
|
|
|
|
|
2022-05-10 20:34:29 +01:00
|
|
|
# is the gui extended
|
|
|
|
extended: bool = configuration["extends"]["extended"]
|
|
|
|
# direction the gui extends
|
|
|
|
extends_horizontal: bool = configuration["extends"]["extends_horizontal"]
|
|
|
|
# are themes enabled
|
|
|
|
themes_enabled: bool = configuration["theme"]["enabled"]
|
|
|
|
# light or dark
|
|
|
|
theme_mode: str = configuration["theme"]["mode"]
|
|
|
|
# size of mousewheel scroll step
|
|
|
|
mwscroll_step: int = configuration["mwscroll_step"]["size"]
|
|
|
|
|
|
|
|
@property
|
|
|
|
def profile(self):
|
|
|
|
if "profiles" in configuration:
|
|
|
|
return configuration["profiles"]["profile"]
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class BaseValues(metaclass=SingletonMeta):
|
2022-04-11 18:35:28 +01:00
|
|
|
# are we dragging a scale with mouse 1
|
|
|
|
in_scale_button_1: bool = False
|
|
|
|
# are we dragging main window with mouse 1
|
|
|
|
dragging: bool = False
|
|
|
|
# a vban connection established
|
|
|
|
vban_connected: bool = False
|
|
|
|
# bus assigned as current submix
|
|
|
|
submixes: int = 0
|
2022-04-13 06:50:49 +01:00
|
|
|
# pdirty delay
|
2022-04-13 18:11:39 +01:00
|
|
|
pdelay: int = 5
|
2022-04-13 06:50:49 +01:00
|
|
|
# ldirty delay
|
|
|
|
ldelay: int = 50
|
2022-04-14 17:25:26 +01:00
|
|
|
# size of strip level array for a kind
|
|
|
|
strip_level_array_size: int = None
|
|
|
|
# size of bus level array for a kind
|
|
|
|
bus_level_array_size: int = None
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
|
2022-05-10 20:34:29 +01:00
|
|
|
_base_values = BaseValues()
|
|
|
|
_configuration = Configurations()
|
2022-04-11 18:35:28 +01:00
|
|
|
|
|
|
|
_kinds = {kind.id: kind for kind in kinds.all}
|
|
|
|
|
|
|
|
_kinds_all = _kinds.values()
|
|
|
|
|
|
|
|
|
|
|
|
def kind_get(kind_id):
|
|
|
|
return _kinds[kind_id]
|