From 675946e2b795c662254a45f6648cd0f5697ff3be Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 3 Sep 2021 23:34:39 +0200 Subject: [PATCH] Improved browser UI. --- nomadnet/ui/textui/Browser.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/nomadnet/ui/textui/Browser.py b/nomadnet/ui/textui/Browser.py index c3c611d..6e2befe 100644 --- a/nomadnet/ui/textui/Browser.py +++ b/nomadnet/ui/textui/Browser.py @@ -35,8 +35,8 @@ class Browser: REQUEST_FAILED = 0x07 REQUEST_TIMEOUT = 0x08 RECEIVING_RESPONSE = 0x09 - DONE = 0xFF DISCONECTED = 0xFE + DONE = 0xFF def __init__(self, app, app_name, aspects, destination_hash = None, path = None, auth_identity = None, delegate = None): self.app = app @@ -79,12 +79,16 @@ class Browser: return RNS.hexrep(self.destination_hash, delimit=False)+":"+path def handle_link(self, link_target): - RNS.log("Browser handling link to: "+str(link_target), RNS.LOG_DEBUG) - try: - self.retrieve_url(link_target) - except Exception as e: - self.browser_footer = urwid.Text("Could not open link: "+str(e)) - self.frame.contents["footer"] = (self.browser_footer, self.frame.options()) + if self.status >= Browser.DISCONECTED: + RNS.log("Browser handling link to: "+str(link_target), RNS.LOG_DEBUG) + try: + self.retrieve_url(link_target) + except Exception as e: + self.browser_footer = urwid.Text("Could not open link: "+str(e)) + self.frame.contents["footer"] = (self.browser_footer, self.frame.options()) + else: + RNS.log("Browser aleady hadling link, cannot handle link to: "+str(link_target), RNS.LOG_DEBUG) + def micron_released_focus(self):