From d22b3abc2f79a41e5aea5cc757718c5eae5a0ae8 Mon Sep 17 00:00:00 2001 From: Russell Schmidt Date: Wed, 2 Apr 2025 14:36:23 -0500 Subject: [PATCH] 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. --- contact/ui/curses_ui.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contact/ui/curses_ui.py b/contact/ui/curses_ui.py index 0fdfd3a..831ef9a 100644 --- a/contact/ui/curses_ui.py +++ b/contact/ui/curses_ui.py @@ -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()