From 0d060dbfdd88720edbca01c6d79697ad4a4da376 Mon Sep 17 00:00:00 2001 From: frederik Date: Thu, 1 May 2025 20:24:17 +0200 Subject: [PATCH] cleanup: use helper to set font --- scripts/daily_plot.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/scripts/daily_plot.py b/scripts/daily_plot.py index f1ae997..c79026b 100755 --- a/scripts/daily_plot.py +++ b/scripts/daily_plot.py @@ -13,7 +13,7 @@ import seaborn as sns from matplotlib import rcParams from matplotlib.colors import LogNorm -from utils.helpers import DB_PATH, get_settings +from utils.helpers import DB_PATH, FONT_DIR, get_settings, get_font def get_data(now=None): @@ -183,22 +183,12 @@ def create_plot(df_plt_today, now, is_top=None): def load_fonts(): - conf = get_settings() # Add every font at the specified location - font_dir = [os.path.expanduser('~/BirdNET-Pi/homepage/static')] + font_dir = [FONT_DIR] for font in font_manager.findSystemFonts(font_dir, fontext='ttf'): font_manager.fontManager.addfont(font) # Set font family globally - if conf['DATABASE_LANG'] == 'ar': - rcParams['font.family'] = 'Noto Sans Arabic' - elif conf['DATABASE_LANG'] in ['ja', 'zh']: - rcParams['font.family'] = 'Noto Sans JP' - elif conf['DATABASE_LANG'] == 'ko': - rcParams['font.family'] = 'Noto Sans KR' - elif conf['DATABASE_LANG'] == 'th': - rcParams['font.family'] = 'Noto Sans Thai' - else: - rcParams['font.family'] = 'Roboto Flex' + rcParams['font.family'] = get_font()['font.family'] def main(daemon, sleep_m):