module level loggers added

This commit is contained in:
onyx-and-iris 2023-06-26 13:52:24 +01:00
parent d4df11f62d
commit cfc1279f6c
2 changed files with 14 additions and 7 deletions

View File

@ -1,10 +1,12 @@
import logging
import tkinter as tk
from math import log
from tkinter import ttk
from . import builders
from .data import _base_values, _configuration
logger = logging.getLogger(__name__)
class ChannelLabelFrame(ttk.LabelFrame):
"""Base class for a single channel"""
@ -14,6 +16,7 @@ class ChannelLabelFrame(ttk.LabelFrame):
self.parent = parent
self.index = index
self.id = id
self.logger = logger.getChild(self.__class__.__name__)
self.styletable = self.parent.parent.styletable
self.builder = builders.ChannelLabelFrameBuilder(self, index, id)
@ -40,18 +43,21 @@ class ChannelLabelFrame(ttk.LabelFrame):
return self.parent.target
def getter(self, param):
if hasattr(self.target, param):
try:
return getattr(self.target, param)
except AttributeError as e:
self.logger(f"{type(e).__name__}: {e}")
def setter(self, param, value):
if hasattr(self.target, param):
if param in dir(self.target): # avoid calling getattr (with hasattr)
setattr(self.target, param, value)
def scale_callback(self, *args):
"""callback function for scale widget"""
self.setter("gain", self.gain.get())
self.gainlabel.set(round(self.gain.get(), 1))
val = round(self.gain.get(), 1)
self.setter("gain", val)
self.gainlabel.set(val)
def toggle_mute(self, *args):
self.target.mute = self.mute.get()

View File

@ -6,13 +6,14 @@ from . import builders
from .data import _configuration
from .gainlayer import SubMixFrame
logger = logging.getLogger(__name__)
class Navigation(ttk.Frame):
logger = logging.getLogger("navigation.navigation")
def __init__(self, parent):
super().__init__(parent)
self.parent = parent
self.logger = logger.getChild(self.__class__.__name__)
self.grid(row=0, column=3, padx=(0, 2), pady=(5, 5), sticky=(tk.W, tk.E))
self.styletable = self.parent.styletable