moved from textual to nicegui

This commit is contained in:
2026-05-15 14:47:35 +10:00
parent becad2595c
commit 1f3b570bd1
14 changed files with 131 additions and 342 deletions

View File

@@ -1,6 +1,14 @@
from api.node import MeshNode
from datetime import datetime
class Message:
def __init__(self, content: str, sender: MeshNode):
def __init__(self, content: str, sender: MeshNode, timestamp=None):
self.content = content
self.sender = sender
self.sender = sender
self.timestamp = timestamp or "now"
def __str__(self):
return f"{self.sender.name}: {self.content}"
def __repr__(self):
return f"Message(content={self.content}, sender={self.sender})"

View File

@@ -19,9 +19,8 @@ class BluetoothPacket:
data: dict
class MeshNode:
def __init__(self, client: BleakClient, app):
def __init__(self, client: BleakClient):
self.client = client
self.app = app
self.name = "None"
self.rx_queue = asyncio.Queue()
@@ -50,7 +49,6 @@ class MeshNode:
await self.client.write_gatt_char(NODE_BLUETOOTH_TX_UUID, b"ping")
def notification_received(self, sender, data):
self.app.log(f"Receive: {data}")
self.rx_queue.put_nowait(data)
async def discover(app):