set signs on unprinted on sign change

This commit is contained in:
flukx 2024-08-29 23:16:29 +02:00
parent 4992d7b91a
commit e777be80fe

View file

@ -341,9 +341,14 @@ def show_thing_changer(ui_element: nicegui.ui.element, thing: Thing) -> None:
def save_sign_value(event, member):
"""Copy input field value to sign member."""
if not event.value:
if hasattr(thing.sign, "printed") and hasattr(thing.sign, member):
del vars(thing.sign)["printed"]
del vars(thing.sign)[member]
else:
previous = vars(thing.sign)[member]
vars(thing.sign)[member] = try_conversion(event.value, (int, float, "bool"))
if previous != vars(thing.sign)[member] and hasattr(thing.sign, "printed"):
del vars(thing.sign)["printed"]
def save_list_value(event, member):
"""Split input field at '; ' and save ta thing member."""