use autocompletion and tooltip to tell user what are valid subschemas

This commit is contained in:
flukx 2024-08-17 12:41:01 +02:00
parent ff8449f980
commit 3896f46817

View file

@ -289,11 +289,15 @@ def show_part_changer(ui_element: nicegui.ui.element, part: Part) -> None:
continue
ui.input(
label=level.levelname,
value=location_info.get(level.levelname, "")
value=location_info.get(level.levelname, ""),
autocomplete=level.get_valid_subs() # is not None because of check before
).props(
'autogrow dense' + (' autofocus' if levelname == focus else '')
).on_value_change(
lambda event, s=level, ui_ele=location_ui_element: save_location(event, s, ui_ele)
).tooltip(
", ".join(level.get_valid_subs(shortcuts='()')) if level.get_valid_subs()
else "Any value is valid. Probably integers are reasonable."
)
additional_info = [(key, value) for key, value in location_info.items()
if not any(key == schema.levelname for schema in schema_hierachy)]