diff --git a/ui/curses_ui.py b/ui/curses_ui.py index 54e6a97..7e6cf8c 100644 --- a/ui/curses_ui.py +++ b/ui/curses_ui.py @@ -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() diff --git a/utilities/utils.py b/utilities/utils.py index fd28845..02a1e72 100644 --- a/utilities/utils.py +++ b/utilities/utils.py @@ -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)