Merge branch 'additions_zenith'

master
Mark Qvist 2026-05-21 12:11:37 +02:00
commit b852b385c2
3 changed files with 51 additions and 12 deletions

View File

@ -141,12 +141,21 @@ class Browser:
def current_url(self):
if self.destination_hash == None:
return ""
else:
if self.path == None:
path = ""
else:
path = self.path
return RNS.hexrep(self.destination_hash, delimit=False)+":"+path
path = "" if self.path == None else self.path
url = RNS.hexrep(self.destination_hash, delimit=False)+":"+path
if isinstance(self.request_data, dict) and self.request_data:
parts = []
for k, v in self.request_data.items():
if not isinstance(k, str):
continue
if not k.startswith("var_"):
continue
parts.append(k[4:]+"="+str(v))
if parts:
url += "`" + "|".join(parts)
return url
def url_hash(self, url):
if url == None:

View File

@ -814,10 +814,23 @@ class ConversationsDisplay():
self.dialog_open = True
item = self.ilb.get_selected_item()
if item == None:
self.dialog_open = False
return
source_hash_text = item.source_hash
display_name = self.ilb.get_selected_item().display_name
if display_name == None:
source_hash_text = getattr(item, "source_hash", None)
if source_hash_text is None:
blocked = getattr(item, "blocked_dest_hash", None)
if isinstance(blocked, (bytes, bytearray)):
source_hash_text = RNS.hexrep(blocked, delimit=False)
if source_hash_text is None:
self.dialog_open = False
return
display_name = getattr(item, "display_name", None)
if display_name is None:
try:
display_name = self.app.directory.display_name(bytes.fromhex(source_hash_text))
except Exception:
display_name = None
if display_name is None:
display_name = ""
e_id = urwid.Edit(caption="Addr : ",edit_text=source_hash_text)
@ -877,8 +890,8 @@ class ConversationsDisplay():
r_propagated = urwid.RadioButton(method_button_group, "Use propagation nodes", state=propagated_selected)
def dismiss_dialog(sender):
self.update_conversation_list()
self.dialog_open = False
self.update_conversation_list()
def confirmed(sender):
try:
@ -899,8 +912,8 @@ class ConversationsDisplay():
entry = DirectoryEntry(source_hash, display_name, trust_level, preferred_delivery=delivery, sort_rank=sort_rank, notes=notes_value)
self.app.directory.remember(entry)
self._refresh_open_conversation_widget(source_hash_text)
self.update_conversation_list()
self.dialog_open = False
self.update_conversation_list()
self.app.ui.main_display.sub_displays.network_display.directory_change_callback()
except Exception as e:
RNS.log("Could not save directory entry. The contained exception was: "+str(e), RNS.LOG_VERBOSE)

View File

@ -72,6 +72,22 @@ def _rows_above(attrmaps, index, cols):
return total
class GuideColumns(urwid.Columns):
def keypress(self, size, key):
if key == "up" and self.focus_position == 1:
disp = getattr(self, "guide_display", None)
if disp is not None:
scrollable = getattr(disp, "_content_scrollable", None)
if scrollable is not None:
try:
if scrollable.get_scrollpos() <= 0:
nomadnet.NomadNetworkApp.get_shared_instance().ui.main_display.frame.focus_position = "header"
return None
except Exception:
pass
return super().keypress(size, key)
class GuideLinkDelegate:
def __init__(self, app, reader=None):
self.app = app
@ -190,13 +206,14 @@ class GuideDisplay():
self.right_area = urwid.LineBox(urwid.Filler(topic_text, urwid.TOP))
self.columns = urwid.Columns(
self.columns = GuideColumns(
[
(urwid.WEIGHT, GuideDisplay.list_width, self.left_area),
(urwid.WEIGHT, 1-GuideDisplay.list_width, self.right_area)
],
dividechars=0, focus_column=0
)
self.columns.guide_display = self
self.shortcuts_display = GuideDisplayShortcuts(self.app)
self.widget = self.columns