diff --git a/public_transit_viewer/main.py b/public_transit_viewer/main.py index 6948754..6a32338 100644 --- a/public_transit_viewer/main.py +++ b/public_transit_viewer/main.py @@ -9,9 +9,12 @@ time_form_row, ) from public_transit_viewer.connection import output_connection +from public_transit_viewer.utils import wait_for_logo_to_load connections: list[Connection] | None = None +wait_for_logo_to_load(LOGO_PATH) + st.set_page_config( page_title="Naviqore - Router", page_icon=str(LOGO_PATH), diff --git a/public_transit_viewer/utils.py b/public_transit_viewer/utils.py index 1d2cf33..877c6dc 100644 --- a/public_transit_viewer/utils.py +++ b/public_transit_viewer/utils.py @@ -1,5 +1,17 @@ +import time +from pathlib import Path + import matplotlib.colors as m_colors import matplotlib.pyplot as plt +import streamlit as st + + +def wait_for_logo_to_load(logo_path: Path, retries: int = 3, delay: int = 1): + for _ in range(retries): + if logo_path.exists(): + return + time.sleep(delay) + st.error("Logo not found") def get_color_map_hex_value(