Use nodesByNum instead of iterating over nodes

Removes no longer used function that also iterated over nodes
This commit is contained in:
Russell Schmidt
2025-02-01 11:50:34 -06:00
parent aa2d3bded4
commit 466f385c31
2 changed files with 4 additions and 20 deletions
+4 -5
View File
@@ -10,12 +10,11 @@ import ui.dialog
import globals
def draw_node_details():
nodes_snapshot = list(globals.interface.nodes.values())
node = None
for node in nodes_snapshot:
if globals.node_list[globals.selected_node] == node['num']:
break
try:
node = globals.interface.nodesByNum[globals.node_list[globals.selected_node]]
except KeyError:
return
function_win.erase()
function_win.box()
-15
View File
@@ -57,21 +57,6 @@ def convert_to_camel_case(string):
camel_case_string = ''.join(word.capitalize() for word in words)
return camel_case_string
def get_name_from_number(number, type='long'):
name = ""
nodes_snapshot = list(globals.interface.nodes.values())
for node in nodes_snapshot:
if number == node['num']:
if type == 'long':
return node['user']['longName']
elif type == 'short':
return node['user']['shortName']
else:
pass
# If no match is found, use the ID as a string
return str(decimal_to_hex(number))
def get_time_ago(timestamp):
now = datetime.now()
dt = datetime.fromtimestamp(timestamp)