Added node saving from announce stream

This commit is contained in:
Mark Qvist 2021-09-25 16:57:29 +02:00
parent 848514ec54
commit efc24d361b
3 changed files with 21 additions and 7 deletions

View File

@ -436,8 +436,8 @@ announce_at_start = yes
intro_time = 1
# You can specify the display theme.
# theme = dark
theme = light
# theme = light
theme = dark
# Specify the number of colors to use
# valid colormodes are:
@ -492,12 +492,12 @@ enable_node = no
node_name = None
# Automatic announce interval in minutes.
# 12 hours by default.
# 6 hours by default.
announce_interval = 720
announce_interval = 360
# Whether to announce when the node starts
announce_at_start = No
announce_at_start = Yes
'''.splitlines()

View File

@ -423,7 +423,8 @@ class ConversationsDisplay():
if trust_level != DirectoryEntry.TRUSTED:
display_text += " <"+source_hash+">"
else:
if trust_level != DirectoryEntry.UNTRUSTED:
if unread:
if source_hash != self.currently_displayed_conversation:
display_text += " "+g["unread"]

View File

@ -110,6 +110,12 @@ class AnnounceInfo(urwid.WidgetWrap):
self.parent.browser.retrieve_url(RNS.hexrep(source_hash, delimit=False))
show_announce_stream(None)
def save_node(sender):
node_entry = DirectoryEntry(source_hash, display_name=data_str, trust_level=trust_level, hosts_node=True)
self.app.directory.remember(node_entry)
self.app.ui.main_display.sub_displays.network_display.directory_change_callback()
show_announce_stream(None)
def converse(sender):
show_announce_stream(None)
try:
@ -133,8 +139,15 @@ class AnnounceInfo(urwid.WidgetWrap):
if is_node:
type_button = ("weight", 0.45, urwid.Button("Connect", on_press=connect))
save_button = ("weight", 0.45, urwid.Button("Save", on_press=save_node))
else:
type_button = ("weight", 0.45, urwid.Button("Converse", on_press=converse))
save_button = None
if is_node:
button_columns = urwid.Columns([("weight", 0.45, urwid.Button("Back", on_press=show_announce_stream)), ("weight", 0.1, urwid.Text("")), save_button, ("weight", 0.1, urwid.Text("")), type_button])
else:
button_columns = urwid.Columns([("weight", 0.45, urwid.Button("Back", on_press=show_announce_stream)), ("weight", 0.1, urwid.Text("")), type_button])
pile_widgets = [
urwid.Text("Time : "+ts_string, align="left"),
@ -145,7 +158,7 @@ class AnnounceInfo(urwid.WidgetWrap):
urwid.Divider(g["divider1"]),
urwid.Text(["Announce Data: \n", (data_style, data_str)], align="left"),
urwid.Divider(g["divider1"]),
urwid.Columns([("weight", 0.45, urwid.Button("Back", on_press=show_announce_stream)), ("weight", 0.1, urwid.Text("")), type_button])
button_columns
]
if is_node: