other things around saving changes

This commit is contained in:
flukx 2024-08-16 15:34:19 +02:00
parent b055102ebd
commit 982d1b99ec

View file

@ -4,12 +4,11 @@ import asyncio
import itertools
import re
import time
from typing import Optional, Iterable
from typing import Optional, Iterable, Callable
import nicegui
from nicegui import ui
from part import Part
import part_list_io
import datacleanup
def antilen(string: str):
@ -209,8 +208,7 @@ def search_page(parts: list[Part]) -> None:
def show_part_changer(ui_element: nicegui.ui.element, part: Part,
save_function: Callable[[], None]) -> None:
def show_part_changer(ui_element: nicegui.ui.element, part: Part) -> None:
"""Clear content of ui element and instead display editing fields.
Args:
@ -237,8 +235,9 @@ def show_part_changer(ui_element: nicegui.ui.element, part: Part,
ui.label(member + ":")
input_fields[member] = ui.input(part.get(member, "")).on_value_change(
lambda e, m=member: save_value(e, m))
ui.button("").on_click(lambda m=member, i=input_fields[member]: delete_member(m, i))
ui.button("Save").on_click(save_function)
ui.button("").on_click(
lambda m=member, i=input_fields[member]:
delete_member(m, i))
if __name__ in {"__main__", "__mp_main__"}: