From 72e3ede52fdc3514eabff3aa8c08eb9d09e04928 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 19 Apr 2023 16:15:03 +0200 Subject: [PATCH] [minor] small adjustments --- parameters.yaml | 2 +- survBot.py | 11 ++++++++++- utils.py | 6 +++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/parameters.yaml b/parameters.yaml index 68b9b9d..7821e3c 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -128,7 +128,7 @@ add_global_links: - {"text": "show recent events on map", "URL": "https://fdsnws.geophysik.ruhr-uni-bochum.de/map/?lat=39.5&lon=21&zoom=7&baselayer=mapnik"} -# html logo at page bottom +# html logo at page bottom (path relative to html directory) html_logo: "figures/Logo_RUB_BLAU_rgb.png" # E-mail notifications diff --git a/survBot.py b/survBot.py index 261965a..2a06ac2 100755 --- a/survBot.py +++ b/survBot.py @@ -503,12 +503,21 @@ class SurveillanceBot(object): outfile.write(finish_html_table()) + # add optional links below html table for dct in self.add_global_links: link_str = get_html_link(dct.get('text'), dct.get('URL')) outfile.write(get_html_text(link_str)) + # add status message outfile.write(get_html_text(self.status_message)) - outfile.write(html_footer(footer_logo=self.parameters.get('html_logo'))) + + # write footer with optional logo + logo_file = self.parameters.get('html_logo') + if not os.path.isfile(logo_file): + print(f'Specified file {logo_file} not found.') + logo_file = None + + outfile.write(html_footer(footer_logo=logo_file)) except Exception as e: print(f'Could not write HTML table to {fnout}:') diff --git a/utils.py b/utils.py index 2168c01..a34de20 100644 --- a/utils.py +++ b/utils.py @@ -35,10 +35,10 @@ def get_bg_color(check_key, status, dt_thresh=None, hex=False): def get_color(key): # some GUI default colors - colors_dict = {'FAIL': (255, 50, 0, 255), + colors_dict = {'FAIL': (255, 85, 50, 255), 'NO DATA': (255, 255, 125, 255), 'WARN': (255, 255, 80, 255), - 'OK': (125, 255, 125, 255), + 'OK': (173, 255, 133, 255), 'undefined': (230, 230, 230, 255), 'disc': (255, 160, 40, 255),} return colors_dict.get(key) @@ -60,7 +60,7 @@ def get_time_delay_color(dt, dt_thresh): def get_warn_color(count): - color = (min([255, 200 + count ** 2]), 255, 80, 255) + color = (min([255, 220 + count ** 2]), 255, 80, 255) return color