diff --git a/src/fourc_webviewer/fourc_webserver.py b/src/fourc_webviewer/fourc_webserver.py index 6e0c93e..7a6086c 100644 --- a/src/fourc_webviewer/fourc_webserver.py +++ b/src/fourc_webviewer/fourc_webserver.py @@ -9,6 +9,7 @@ import numpy as np import pyvista as pv +from fourcipp import CONFIG from trame.app import get_server from trame.decorators import TrameApp, change, controller @@ -295,6 +296,8 @@ def init_general_sections_state_and_server_vars(self): approach to add them up to the main section SOLVERS. """ + self.state.json_schema = CONFIG["json_schema"] + # define substrings of section names to exclude substr_to_exclude = ["DESIGN", "TOPOLOGY", "ELEMENTS", "NODE", "FUNCT"] # define full section names to exclude diff --git a/src/fourc_webviewer/gui_utils.py b/src/fourc_webviewer/gui_utils.py index e96397a..4e49f57 100644 --- a/src/fourc_webviewer/gui_utils.py +++ b/src/fourc_webviewer/gui_utils.py @@ -448,7 +448,19 @@ def _prop_value_table(): ), key="item_key", ): - html.Td(v_text=("item_key",), classes="text-center") + with html.Td(classes="text-center"): + with vuetify.VTooltip(location="bottom"): + with html.Template(v_slot_activator="{ props }"): + html.P(v_text=("item_key",), v_bind="props") + html.P( + v_text=( + "json_schema['properties']?.[selected_section_name]?.['properties']?.[item_key]?.['description'] || 'no description'", + ), + v_if=( + "json_schema['properties']?.[selected_section_name]?.['properties']?.[item_key]?.['description']", + ), + style="max-width: 450px;", + ) html.Td( v_if="edit_mode == all_edit_modes['view_mode']", v_text=("item_val",), @@ -490,7 +502,7 @@ def _materials_panel(): items=("Object.keys(materials_section)",), ) # show material type - with html.Div(classes="d-flex align-center ga-3 mb-5 pl-5 w-full"): + with html.Div(classes="d-flex align-center ga-3 mb-1 pl-5 w-full"): html.Span("TYPE: ", classes="text-h6") # view mode: text html.Span( @@ -510,8 +522,20 @@ def _materials_panel(): dense=True, hide_details=True, ) + html.P( + classes="ga-3 mb-5 pl-5 pr-5 w-full", + v_if=("edit_mode == all_edit_modes['view_mode']",), + v_text=( + "json_schema?.properties?.MATERIALS?.items?.oneOf?" + ".find(v => v.properties?.[materials_section[selected_material]?.TYPE])?.properties?" + ".[materials_section[selected_material]?.TYPE]?.description || 'Error on material description'", + ), + style="color: #999;", + ) + # show relationships to other materials (linked materials # and master material) -> only in view mode + with html.Div( v_if=("edit_mode == all_edit_modes['view_mode']",), ): @@ -552,6 +576,7 @@ def _materials_panel(): html.Th( "Value", classes="text-center font-weight-bold", + style="width: 50%;", ) with html.Tbody(): with html.Tr( @@ -560,7 +585,19 @@ def _materials_panel(): ), classes="text-center", ): - html.Td(v_text=("param_key",)) + with html.Td(classes="text-center"): + with vuetify.VTooltip(location="bottom"): + with html.Template(v_slot_activator="{ props }"): + html.P(v_text=("param_key",), v_bind="props") + html.P( + v_text=( + "json_schema?.properties?.MATERIALS?.items?.oneOf?" + ".find(v => v.properties?.[materials_section[selected_material]?.TYPE])?" + ".properties?.[materials_section[selected_material]?.TYPE]?.properties?" + ".[param_key]?.description || 'Error on parameter description'", + ), + style="max-width: 450px;", + ) html.Td( v_text=("param_val",), )