Skip to content

Commit

Permalink
FIX: NAV-150 - Wait for static logo to load before starting app
Browse files Browse the repository at this point in the history
- Avoids missing of logo.
  • Loading branch information
munterfi committed Aug 27, 2024
1 parent b79fe3e commit 3563059
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions public_transit_viewer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 12 additions & 0 deletions public_transit_viewer/utils.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down

0 comments on commit 3563059

Please sign in to comment.