voicemeeter-compact/vmcompact/banner.py

36 lines
1.1 KiB
Python
Raw Permalink Normal View History

import logging
2022-04-11 18:35:28 +01:00
import tkinter as tk
from tkinter import ttk
from .data import _base_values, _configuration
2022-04-11 18:35:28 +01:00
logger = logging.getLogger(__name__)
2022-04-11 18:35:28 +01:00
class Banner(ttk.Frame):
def __init__(self, parent):
super().__init__()
self.parent = parent
self.parent.subject.add(self)
self.logger = logger.getChild(self.__class__.__name__)
self.submix = tk.StringVar(value=self.target.bus[_configuration.submixes].label)
2022-04-11 18:35:28 +01:00
self.label = ttk.Label(
self,
text=f"SUBMIX: {self.submix.get().upper()}",
)
self.label.grid(column=0, row=0, sticky=(tk.N, tk.S, tk.W, tk.E))
2022-04-11 18:35:28 +01:00
@property
def target(self):
"""returns the current interface"""
return self.parent.target
2022-04-11 18:35:28 +01:00
def on_update(self, subject):
if subject == "submix":
if not _base_values.dragging:
self.logger.debug("checking submix for banner")
self.submix.set(self.target.bus[_configuration.submixes].label)
self.label["text"] = f"SUBMIX: {self.submix.get().upper()}"