Improved LXMF Peer display

This commit is contained in:
Mark Qvist 2021-11-04 22:28:35 +01:00
parent f5b356d8b8
commit fe0a3b6a3e
2 changed files with 17 additions and 4 deletions

View File

@ -123,6 +123,13 @@ class Directory:
else: else:
return "<"+RNS.hexrep(source_hash, delimit=False)+">" return "<"+RNS.hexrep(source_hash, delimit=False)+">"
def alleged_display_str(self, source_hash):
if source_hash in self.directory_entries:
return self.directory_entries[source_hash].display_name
else:
return None
def trust_level(self, source_hash, announced_display_name=None): def trust_level(self, source_hash, announced_display_name=None):
if source_hash in self.directory_entries: if source_hash in self.directory_entries:
if announced_display_name == None: if announced_display_name == None:

View File

@ -941,7 +941,7 @@ class NodeInfo(urwid.WidgetWrap):
self.t_active_links = NodeInfo.links_timer self.t_active_links = NodeInfo.links_timer
self.t_active_links.update_stat() self.t_active_links.update_stat()
announce_button = urwid.Button("Announce Now", on_press=announce_query) announce_button = urwid.Button("Announce", on_press=announce_query)
connect_button = urwid.Button("Browse", on_press=connect_query) connect_button = urwid.Button("Browse", on_press=connect_query)
pile = urwid.Pile([ pile = urwid.Pile([
@ -954,9 +954,9 @@ class NodeInfo(urwid.WidgetWrap):
urwid.Columns([ urwid.Columns([
("weight", 0.3, urwid.Button("Back", on_press=show_peer_info)), ("weight", 0.3, urwid.Button("Back", on_press=show_peer_info)),
("weight", 0.1, urwid.Text("")), ("weight", 0.1, urwid.Text("")),
("weight", 0.3, connect_button), ("weight", 0.4, connect_button),
("weight", 0.1, urwid.Text("")), ("weight", 0.1, urwid.Text("")),
("weight", 0.3, announce_button) ("weight", 0.5, announce_button)
]) ])
]) ])
else: else:
@ -1236,13 +1236,19 @@ class LXMFPeerEntry(urwid.WidgetWrap):
self.app = app self.app = app
g = self.app.ui.glyphs g = self.app.ui.glyphs
node_identity = RNS.Identity.recall(destination_hash)
display_str = RNS.prettyhexrep(destination_hash) display_str = RNS.prettyhexrep(destination_hash)
if node_identity != None:
node_hash = RNS.Destination.hash_from_name_and_identity("nomadnetwork.node", node_identity)
display_name = self.app.directory.alleged_display_str(node_hash)
if display_name != None:
display_str += "\n "+str(display_name)
sym = g["sent"] sym = g["sent"]
style = "list_unknown" style = "list_unknown"
focus_style = "list_focus" focus_style = "list_focus"
widget = ListEntry(sym+" "+display_str+"\n Last heard "+pretty_date(int(peer.last_heard))+"\n "+str(len(peer.unhandled_messages))+" unhandled") widget = ListEntry(sym+" "+display_str+"\n Last heard "+pretty_date(int(peer.last_heard))+"\n "+str(len(peer.unhandled_messages))+" unhandled messages")
# urwid.connect_signal(widget, "click", delegate.connect_node, node) # urwid.connect_signal(widget, "click", delegate.connect_node, node)
self.display_widget = urwid.AttrMap(widget, style, focus_style) self.display_widget = urwid.AttrMap(widget, style, focus_style)