From 1e277c8da571519bbec865e6619a44a4cbed7489 Mon Sep 17 00:00:00 2001 From: Parthib Roy Date: Sun, 9 Feb 2025 23:33:28 -0800 Subject: [PATCH] fix importing issues --- .../impactx/dashboard/Input/components.py | 18 ++++++++++++++++-- src/python/impactx/dashboard/Input/defaults.py | 8 -------- src/python/impactx/dashboard/__init__.py | 2 ++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/python/impactx/dashboard/Input/components.py b/src/python/impactx/dashboard/Input/components.py index 4fc6e7696..01b3be7f6 100644 --- a/src/python/impactx/dashboard/Input/components.py +++ b/src/python/impactx/dashboard/Input/components.py @@ -1,6 +1,6 @@ from typing import Optional -from .. import setup_server, vuetify +from .. import setup_server, html, vuetify from .generalFunctions import generalFunctions server, state, ctrl = setup_server() @@ -41,7 +41,21 @@ def documentation_icon(section_name: str) -> vuetify.VIcon: """ def open_documentation(): - new_url = DashboardDefaults.DOCUMENTATION.get(section_name) + """ + Retrieves the documentation link with the provided section_name + and opens the documentation sidebar on the dashoard. + """ + + DOCUMENTATION = { + "input_parameters": "https://impactx.readthedocs.io/en/latest/usage/python.html#impactx.ImpactX", + "lattice_configuration": "https://impactx.readthedocs.io/en/latest/usage/python.html#lattice-elements", + "distribution_parameters": "https://impactx.readthedocs.io/en/latest/usage/python.html#initial-beam-distributions", + "space_charge": "https://impactx.readthedocs.io/en/latest/usage/parameters.html#space-charge", + "csr": "https://impactx.readthedocs.io/en/latest/usage/parameters.html#coherent-synchrotron-radiation-csr", + } + + + new_url = DOCUMENTATION.get(section_name) if state.documentation_drawer_open and state.documentation_url == new_url: state.documentation_drawer_open = False else: diff --git a/src/python/impactx/dashboard/Input/defaults.py b/src/python/impactx/dashboard/Input/defaults.py index 926a301d3..f452470a3 100644 --- a/src/python/impactx/dashboard/Input/defaults.py +++ b/src/python/impactx/dashboard/Input/defaults.py @@ -113,11 +113,3 @@ class DashboardDefaults: "beta": "m", "emitt": "m", } - - DOCUMENTATION = { - "input_parameters": "https://impactx.readthedocs.io/en/latest/usage/python.html#impactx.ImpactX", - "lattice_configuration": "https://impactx.readthedocs.io/en/latest/usage/python.html#lattice-elements", - "distribution_parameters": "https://impactx.readthedocs.io/en/latest/usage/python.html#initial-beam-distributions", - "space_charge": "https://impactx.readthedocs.io/en/latest/usage/parameters.html#space-charge", - "csr": "https://impactx.readthedocs.io/en/latest/usage/parameters.html#coherent-synchrotron-radiation-csr", - } diff --git a/src/python/impactx/dashboard/__init__.py b/src/python/impactx/dashboard/__init__.py index 875ecc666..16645e994 100644 --- a/src/python/impactx/dashboard/__init__.py +++ b/src/python/impactx/dashboard/__init__.py @@ -1,4 +1,5 @@ from trame.widgets import vuetify as vuetify +from trame.widgets import html # isort: off @@ -20,6 +21,7 @@ __all__ = [ "JupyterApp", "setup_server", + "html", "vuetify", "AnalyzeSimulation", "NavigationComponents",