From 7cb53fe170299cdd5345617f548b489f0f9c0496 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 1 Feb 2023 12:23:45 +0100 Subject: [PATCH] Request keys option for unknown announce edge case --- nomadnet/ui/textui/Network.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/nomadnet/ui/textui/Network.py b/nomadnet/ui/textui/Network.py index 5225faa..7a8081b 100644 --- a/nomadnet/ui/textui/Network.py +++ b/nomadnet/ui/textui/Network.py @@ -311,19 +311,28 @@ class AnnounceStreamEntry(urwid.WidgetWrap): self.delegate.parent.close_list_dialogs() def confirmed(sender): - self.delegate.parent.close_list_dialogs() + def close_req(sender): + self.delegate.parent.close_list_dialogs() + + dialog_pile.contents[0] = (urwid.Text("\nKeys requested from network\n", align="center"), options) + RNS.Transport.request_path(announce[1]) + + confirmed_button = urwid.Button("Request keys", on_press=confirmed) + + dialog_pile = urwid.Pile([ + urwid.Text("The keys for the announced destination could not be recalled. You can wait for an announce to arrive, or request the keys from the network.\n", align="center"), + urwid.Columns([ + ("weight", 0.45, confirmed_button), + ("weight", 0.1, urwid.Text("")), + ("weight", 0.45, urwid.Button("Close", on_press=dismiss_dialog)), + ]) + ]) dialog = ListDialogLineBox( - urwid.Pile([ - urwid.Text("The keys for the announced destination could not be recalled. You can wait for an announce to arrive, or request the keys from the network.\n", align="center"), - urwid.Columns([ - ("weight", 0.45, urwid.Button("Request keys", on_press=confirmed)), - ("weight", 0.1, urwid.Text("")), - ("weight", 0.45, urwid.Button("Cancel", on_press=dismiss_dialog)), - ]) - ]), + dialog_pile, title="Keys Unknown" ) + confirmed_button.dialog_pile = dialog_pile dialog.delegate = self.delegate.parent bottom = self.delegate