Merge pull request #2 from natankeddem/fixremoves

Fixes for removal of keys and restrictions.
This commit is contained in:
Natan Keddem
2024-05-06 18:53:31 -04:00
committed by GitHub
2 changed files with 7 additions and 7 deletions

View File

@ -70,6 +70,8 @@ class Setting(Tab):
def remove_key(key):
self._scroll.remove(self._elements[key]["row"])
del self._elements[key]
if key in storage.answer(self.answer)[self.type]:
del storage.answer(self.answer)[self.type][key]
def set_key(key, value: str):
v: Any = None

View File

@ -48,13 +48,11 @@ class System(Tab):
with self.scroll:
with ui.row() as row:
row.tailwind.width("full").align_items("center").justify_content("between")
with ui.row() as row:
row.tailwind.align_items("center")
self._elements[restriction] = {
"control": el.FInput(value=restriction, read_only=True),
"row": row,
}
self._elements[restriction]["control"].tailwind.width("[420px]")
self._elements[restriction] = {
"control": el.FInput(value=restriction, read_only=True),
"row": row,
}
self._elements[restriction]["control"].tailwind.width("[420px]")
ui.button(icon="remove", on_click=lambda _, r=restriction: remove_restriction(r))
if self.type not in storage.answer(self.answer):
storage.answer(self.answer)[self.type] = []