Skip to content

Commit

Permalink
Merge pull request #2 from natankeddem/fixremoves
Browse files Browse the repository at this point in the history
Fixes for removal of keys and restrictions.
  • Loading branch information
natankeddem authored May 6, 2024
2 parents a069cfe + 2b6f0e4 commit edc5987
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions autopve/tabs/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def add_key(key: str, value: str = ""):
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
Expand Down
12 changes: 5 additions & 7 deletions autopve/tabs/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ def add_restriction(restriction: str):
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] = []
Expand Down

0 comments on commit edc5987

Please sign in to comment.