mirror of
https://github.com/pdxlocations/contact.git
synced 2026-03-28 17:12:35 +01:00
Compare commits
10 Commits
value-in-l
...
single-pan
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68578b534a | ||
|
|
27b0ca7482 | ||
|
|
d939561e2d | ||
|
|
9ab3c4dbf9 | ||
|
|
d79b751599 | ||
|
|
0a00e08431 | ||
|
|
f2627e0ed4 | ||
|
|
a3f0232641 | ||
|
|
3987c183d8 | ||
|
|
fcb1a42ef2 |
@@ -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 54 PM" src="https://github.com/user-attachments/assets/447c5d30-0850-4a4f-b0d4-976e4c5e329d" />
|
||||
|
||||
## Commands
|
||||
|
||||
- `↑→↓←` = Navigate around the UI.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user