mirror of
https://github.com/pdxlocations/contact.git
synced 2026-03-28 17:12:35 +01:00
This reverts commit a4a15e57b4.
This commit is contained in:
@@ -9,5 +9,4 @@ myNodeNum = 0
|
||||
selected_channel = 0
|
||||
selected_message = 0
|
||||
selected_node = 0
|
||||
current_window = 0
|
||||
connected = False
|
||||
current_window = 0
|
||||
2
main.py
2
main.py
@@ -14,7 +14,6 @@ import traceback
|
||||
|
||||
from utilities.arg_parser import setup_parser
|
||||
from utilities.interfaces import initialize_interface
|
||||
from ui.curses_ui import on_connection
|
||||
from message_handlers.rx_handler import on_receive
|
||||
from ui.curses_ui import main_ui, draw_splash
|
||||
from utilities.utils import get_channels, get_node_list, get_nodeNum
|
||||
@@ -48,7 +47,6 @@ def main(stdscr):
|
||||
globals.channel_list = get_channels()
|
||||
globals.node_list = get_node_list()
|
||||
pub.subscribe(on_receive, 'meshtastic.receive')
|
||||
pub.subscribe(on_connection, "meshtastic.connection")
|
||||
init_nodedb()
|
||||
load_messages_from_db()
|
||||
logging.info("Starting main UI")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import logging
|
||||
import time
|
||||
from datetime import datetime
|
||||
from utilities.utils import get_node_list
|
||||
from ui.curses_ui import draw_packetlog_win, draw_node_list, draw_messages_window, draw_channel_list, add_notification
|
||||
from db_handler import save_message_to_db, maybe_store_nodeinfo_in_db, get_name_from_database
|
||||
@@ -8,6 +7,8 @@ import default_config as config
|
||||
import globals
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
def on_receive(packet, interface):
|
||||
|
||||
# Update packet log
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import curses
|
||||
import textwrap
|
||||
import logging
|
||||
from pubsub import pub
|
||||
from utilities.utils import get_channels, get_time_ago
|
||||
from settings import settings_menu
|
||||
from message_handlers.tx_handler import send_message, send_traceroute
|
||||
@@ -11,31 +9,6 @@ import default_config as config
|
||||
import ui.dialog
|
||||
import globals
|
||||
|
||||
def on_connection(interface, topic=pub.AUTO_TOPIC) -> None:
|
||||
"""Callback invoked when we connect/disconnect from a radio."""
|
||||
connection_status = topic.getName()
|
||||
|
||||
if connection_status == "meshtastic.connection.established":
|
||||
globals.connected = True
|
||||
elif connection_status == "meshtastic.connection.lost":
|
||||
globals.connected = False
|
||||
|
||||
logging.info(f"Connection changed: {connection_status}")
|
||||
draw_connection_indicator()
|
||||
|
||||
def draw_connection_indicator():
|
||||
"""Draw a connection indicator (green dot if connected, red if disconnected) in the input window."""
|
||||
|
||||
height, width = entry_win.getmaxyx()
|
||||
|
||||
indicator_x = width - 3
|
||||
indicator_y = 1
|
||||
|
||||
entry_win.addstr(indicator_y, indicator_x, "✔" if globals.connected else "✖", get_color("input", bold=True))
|
||||
curses.curs_set(0)
|
||||
entry_win.refresh()
|
||||
|
||||
|
||||
def draw_node_details():
|
||||
node = None
|
||||
try:
|
||||
@@ -474,8 +447,7 @@ def main_ui(stdscr):
|
||||
handle_resize(stdscr, True)
|
||||
|
||||
while True:
|
||||
draw_connection_indicator()
|
||||
draw_text_field(entry_win, f"Input: {input_text[-(stdscr.getmaxyx()[1] - 12):]}", get_color("input"))
|
||||
draw_text_field(entry_win, f"Input: {input_text[-(stdscr.getmaxyx()[1] - 10):]}", get_color("input"))
|
||||
|
||||
# Get user input from entry window
|
||||
char = entry_win.get_wch()
|
||||
|
||||
Reference in New Issue
Block a user