aegis_gui.app

 1import dash
 2import dash_bootstrap_components as dbc
 3from aegis_gui import layout
 4from aegis_gui.guisettings.GuiSettings import gui_settings
 5
 6
 7@dash.callback(
 8    [dash.Output(f"link-nav-{page}", "active") for page in ["home", "config", "plot", "simlog", "wiki", "news"]],
 9    [dash.Input("url", "pathname")],
10)
11def toggle_active_links(pathname):
12    if pathname is None:
13        # Default to home if pathname is None
14        pathname = "/"
15    return [
16        pathname == f"/{page}" or (page == "home" and pathname == "/")
17        for page in ["home", "config", "plot", "simlog", "wiki", "news"]
18    ]
19
20
21def get_app():
22    app = dash.Dash(
23        __name__,
24        suppress_callback_exceptions=True,
25        update_title="",
26        url_base_pathname=gui_settings.BASE_HREF,
27        external_stylesheets=[
28            # dbc.themes.BOOTSTRAP,
29            # dbc.icons.BOOTSTRAP,
30        ],  # Do not use external_stylesheets
31        # Dark mode is handled by Bootstrap 5.3+ `data-bs-theme="dark"` on <html>
32        # (toggled by the clientside callback in offcanvas.py). Custom AEGIS surfaces
33        # respond via [data-bs-theme=dark] selectors in styles_colors.css.
34        use_pages=True,
35    )
36
37    # Bootstrap ICONS: https://icons.getbootstrap.com/
38
39    app._favicon = "favicon.ico"
40    app.title = "AEGIS visualizer"
41    app.layout = layout.get_app_layout()
42
43    return app
def get_app():
22def get_app():
23    app = dash.Dash(
24        __name__,
25        suppress_callback_exceptions=True,
26        update_title="",
27        url_base_pathname=gui_settings.BASE_HREF,
28        external_stylesheets=[
29            # dbc.themes.BOOTSTRAP,
30            # dbc.icons.BOOTSTRAP,
31        ],  # Do not use external_stylesheets
32        # Dark mode is handled by Bootstrap 5.3+ `data-bs-theme="dark"` on <html>
33        # (toggled by the clientside callback in offcanvas.py). Custom AEGIS surfaces
34        # respond via [data-bs-theme=dark] selectors in styles_colors.css.
35        use_pages=True,
36    )
37
38    # Bootstrap ICONS: https://icons.getbootstrap.com/
39
40    app._favicon = "favicon.ico"
41    app.title = "AEGIS visualizer"
42    app.layout = layout.get_app_layout()
43
44    return app