Skip to content

Commit b3d4f01

Browse files
committed
Add material descriptions
1 parent cf45696 commit b3d4f01

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

src/fourc_webviewer/gui_utils.py

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,12 @@ def _prop_value_table():
451451
with html.Td(classes="text-center"):
452452
html.P(v_text=("item_key",))
453453
html.P(
454-
v_if=("json_schema['properties']?.[selected_section_name]?.['properties']?.[item_key]?.['description']",),
455-
v_text=("json_schema['properties']?.[selected_section_name]?.['properties']?.[item_key]?.['description'] || 'no description'",),
454+
v_if=(
455+
"json_schema['properties']?.[selected_section_name]?.['properties']?.[item_key]?.['description']",
456+
),
457+
v_text=(
458+
"json_schema['properties']?.[selected_section_name]?.['properties']?.[item_key]?.['description'] || 'no description'",
459+
),
456460
style="font-size: 0.8em; color: #aaa; padding-left: 20px; padding-right: 20px;",
457461
)
458462
html.Td(
@@ -496,7 +500,7 @@ def _materials_panel():
496500
items=("Object.keys(materials_section)",),
497501
)
498502
# show material type
499-
with html.Div(classes="d-flex align-center ga-3 mb-5 pl-5 w-full"):
503+
with html.Div(classes="d-flex align-center ga-3 mb-1 pl-5 w-full"):
500504
html.Span("TYPE: ", classes="text-h6")
501505
# view mode: text
502506
html.Span(
@@ -516,8 +520,20 @@ def _materials_panel():
516520
dense=True,
517521
hide_details=True,
518522
)
523+
html.P(
524+
classes="ga-3 mb-5 pl-5 pr-5 w-full",
525+
v_if=("edit_mode == all_edit_modes['view_mode']",),
526+
v_text=(
527+
"json_schema?.properties?.MATERIALS?.items?.oneOf?"
528+
".find(v => v.properties?.[materials_section[selected_material]?.TYPE])?.properties?"
529+
".[materials_section[selected_material]?.TYPE]?.description || 'Error on material description'",
530+
),
531+
style="color: #999;",
532+
)
533+
519534
# show relationships to other materials (linked materials
520535
# and master material) -> only in view mode
536+
521537
with html.Div(
522538
v_if=("edit_mode == all_edit_modes['view_mode']",),
523539
):
@@ -558,6 +574,7 @@ def _materials_panel():
558574
html.Th(
559575
"Value",
560576
classes="text-center font-weight-bold",
577+
style="width: 50%;",
561578
)
562579
with html.Tbody():
563580
with html.Tr(
@@ -566,7 +583,19 @@ def _materials_panel():
566583
),
567584
classes="text-center",
568585
):
569-
html.Td(v_text=("param_key",))
586+
# html.Td("awdawdawd")#v_text=("param_key",))
587+
with html.Td(classes="text-center"):
588+
html.P(v_text=("param_key",))
589+
html.P(
590+
v_text=(
591+
"json_schema?.properties?.MATERIALS?.items?.oneOf?"
592+
".find(v => v.properties?.[materials_section[selected_material]?.TYPE])?"
593+
".properties?.[materials_section[selected_material]?.TYPE]?.properties?"
594+
".[param_key]?.description || 'Error on parameter description'",
595+
),
596+
# v_text=("json_schema?.properties?.MATERIALS?.items?.oneOf?.find(v => v.properties?.['MAT_electrode'])?.properties?.['MAT_electrode']?.description || 'no description'",),
597+
style="font-size: 0.8em; color: #aaa; padding-left: 20px; padding-right: 20px;",
598+
)
570599
html.Td(
571600
v_text=("param_val",),
572601
)

0 commit comments

Comments
 (0)