Compare commits

..

10 Commits

Author SHA1 Message Date
pdxlocations
68578b534a hide help on small screens 2025-08-22 14:39:43 -07:00
pdxlocations
27b0ca7482 allow smaller windows 2025-08-22 12:17:34 -07:00
pdxlocations
d939561e2d refactor 2025-08-22 11:29:30 -07:00
pdxlocations
9ab3c4dbf9 Bonus, redraw settings when new line in packetlog 2025-08-21 23:15:45 -07:00
pdxlocations
d79b751599 fix packet log crash 2025-08-21 23:05:27 -07:00
pdxlocations
0a00e08431 fix single-pane crash 2025-08-21 22:45:56 -07:00
pdxlocations
f2627e0ed4 focus arrows fix 2025-08-21 00:18:53 -07:00
pdxlocations
a3f0232641 fix save check 2025-08-21 00:05:06 -07:00
pdxlocations
3987c183d8 shift focus on message send 2025-08-20 23:54:36 -07:00
pdxlocations
fcb1a42ef2 init 2025-08-20 23:49:17 -07:00
4 changed files with 8 additions and 47 deletions

View File

@@ -32,10 +32,6 @@ All messages will saved in a SQLite DB and restored upon relaunch of the app. Y
By navigating to Settings -> App Settings, you may customize your UI's icons, colors, and more!
For smaller displays you may wish to enable `single_pane_mode`:
<img width="486" height="194" alt="Screenshot 2025-08-22 at 11 15 54PM" src="https://github.com/user-attachments/assets/447c5d30-0850-4a4f-b0d4-976e4c5e329d" />
## Commands
- `↑→↓←` = Navigate around the UI.

View File

@@ -7,7 +7,6 @@ from typing import Union
from contact.utilities.utils import get_channels, get_readable_duration, get_time_ago, refresh_node_list
from contact.settings import settings_menu
from contact.message_handlers.tx_handler import send_message, send_traceroute
from contact.utilities.utils import parse_protobuf
from contact.ui.colors import get_color
from contact.utilities.db_handler import get_name_from_database, update_node_info_in_db, is_chat_archived
from contact.utilities.input_handlers import get_list_input
@@ -16,7 +15,6 @@ import contact.ui.dialog
from contact.ui.nav_utils import move_main_highlight, draw_main_arrows, get_msg_window_lines, wrap_text
from contact.utilities.singleton import ui_state, interface_state, menu_state
MIN_COL = 1 # "effectively zero" without breaking curses
root_win = None # set in main_ui
@@ -834,14 +832,14 @@ def draw_packetlog_win() -> None:
else get_name_from_database(packet["to"], "short").ljust(columns[1])
)
if "decoded" in packet:
port = str(packet["decoded"].get("portnum", "")).ljust(columns[2])
parsed_payload = parse_protobuf(packet)
port = packet["decoded"]["portnum"].ljust(columns[2])
payload = (packet["decoded"]["payload"]).ljust(columns[3])
else:
port = "NO KEY".ljust(columns[2])
parsed_payload = "NO KEY"
payload = "NO KEY".ljust(columns[3])
# Combine and truncate if necessary
logString = f"{from_id} {to_id} {port} {parsed_payload}"
logString = f"{from_id} {to_id} {port} {payload}"
logString = logString[: width - 3]
# Add to the window

View File

@@ -1,11 +1,8 @@
import datetime
import time
from typing import Optional, Union
from google.protobuf.message import DecodeError
from meshtastic import protocols
from meshtastic.protobuf import config_pb2, mesh_pb2, portnums_pb2
from meshtastic.protobuf import config_pb2
import contact.ui.default_config as config
from contact.utilities.singleton import ui_state, interface_state
@@ -139,7 +136,6 @@ def get_time_ago(timestamp):
return f"{value} {unit} ago"
return "now"
def add_new_message(channel_id, prefix, message):
if channel_id not in ui_state.all_messages:
ui_state.all_messages[channel_id] = []
@@ -166,33 +162,4 @@ def add_new_message(channel_id, prefix, message):
ui_state.all_messages[channel_id].append((f"-- {current_hour} --", ""))
# Add the message
ui_state.all_messages[channel_id].append((prefix, message))
def parse_protobuf(packet: dict) -> Union[str, dict]:
"""Attempt to parse a decoded payload using the registered protobuf handler."""
try:
decoded = packet.get("decoded") or {}
portnum = decoded.get("portnum")
payload = decoded.get("payload")
if isinstance(payload, str):
return payload
handler = protocols.get(portnums_pb2.PortNum.Value(portnum)) if portnum is not None else None
if handler is not None and handler.protobufFactory is not None:
try:
pb = handler.protobufFactory()
pb.ParseFromString(bytes(payload))
if hasattr(pb, "device_metrics") and pb.HasField("device_metrics"):
return str(pb.device_metrics).replace("\n", " ").replace("\r", " ").strip()
if hasattr(pb, "environment_metrics") and pb.HasField("environment_metrics"):
return str(pb.environment_metrics).replace("\n", " ").replace("\r", " ").strip()
return str(pb).replace("\n", " ").replace("\r", " ").strip()
except DecodeError:
return payload
return payload
except Exception:
return payload
ui_state.all_messages[channel_id].append((prefix,message))

View File

@@ -1,6 +1,6 @@
[project]
name = "contact"
version = "1.4.0"
version = "1.3.17"
description = "This Python curses client for Meshtastic is a terminal-based client designed to manage device settings, enable mesh chat communication, and handle configuration backups and restores."
authors = [
{name = "Ben Lipsey",email = "ben@pdxlocations.com"}