work on ui

This commit is contained in:
2026-03-07 14:22:06 +11:00
parent 3aed2e5412
commit fe410f6444
7 changed files with 103 additions and 7 deletions

11
desktop_app/ui/app.py Normal file
View File

@@ -0,0 +1,11 @@
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer
from ui.screens.pair_screen import PairScreen
class Hive(App):
theme = "rose-pine"
ENABLE_COMMAND_PALETTE = False
def on_ready(self):
self.push_screen(PairScreen())

View File

@@ -0,0 +1,7 @@
_
| |
_ __ ___ ___ ___| |__
| '_ ` _ \ / _ \/ __| '_ \
| | | | | | __/\__ \ | | |
|_| |_| |_|\___||___/_| |_|

View File

@@ -0,0 +1,39 @@
PairScreen {
align: center middle;
}
EffectLabel {
min-width: 50;
text-align: center;
text-style: bold;
}
#middle {
border: $success ascii;
width: 50;
height: 28;
padding: 0 1 1 1;
Static {
min-width: 100%;
text-align: center;
}
DataTable {
margin-top: 1;
}
LoadingIndicator {
height: 1;
margin-top: 1;
}
DataTable {
height: 5;
}
Button {
margin: 2 0 0 1;
}
}

View File

@@ -0,0 +1,32 @@
from textual.screen import Screen
from textual.containers import VerticalScroll, Vertical
from textual.widgets import Static, Button, LoadingIndicator, DataTable
from textualeffects.widgets import EffectLabel
class PairScreen(Screen):
CSS_PATH = "../assets/pair_screen.tcss"
def compose(self):
with Vertical(id="middle") as center_window:
center_window.border_title = "Pair a Node"
with open("ui/assets/banner.txt", "r") as f:
yield EffectLabel(f.read(), effect="Print")
yield Static("Make sure your mesh network node is powered and ready to pair. When you're ready, click the \"Pair\" button to connect to the mesh!")
table = DataTable()
table.add_columns("[b]Address", "RSSI")
yield table
table.add_row("hi", "[green]󰢽[/] -34 dBm")
table.add_row("hi", "[green]󰢽[/] -52 dBm")
table.add_row("hi", "[yellow]󰢽[/] -64 dBm")
table.add_row("hi", "[red]󰢼[/] -98 dBm")
table.add_row("hi", "[red]󰢼[/] -101 dBm")
yield LoadingIndicator()
yield Button("Pair", disabled=True, variant="success", id="pair-btn")