1
0
forked from iarv/contact

Make removing node from DB work

Since the Python API doesn't update the nodes table itself, we can just
modify it ourselves. This fixes removing a node so it doesn't just pop
right back up immediately and seems to actually work now.
This commit is contained in:
Russell Schmidt
2025-04-02 14:36:23 -05:00
parent 3c9b81f391
commit d22b3abc2f

View File

@@ -300,6 +300,14 @@ def main_ui(stdscr):
confirmation = get_list_input(f"Remove {get_name_from_database(globals.node_list[globals.selected_node])} from nodedb?", "no", ["yes", "no"])
if confirmation == "yes":
globals.interface.localNode.removeNode(globals.node_list[globals.selected_node])
# Directly modifying the interface from client code - good? Bad? If it's stupid but it works, it's not supid?
del(globals.interface.nodesByNum[globals.node_list[globals.selected_node]])
# Convert to "!hex" representation that interface.nodes uses
hexid = f"!{hex(globals.node_list[globals.selected_node])[2:]}"
del(globals.interface.nodes[hexid])
globals.node_list.pop(globals.selected_node)
draw_messages_window()