fix(ui): add proper CSS layout for detail screens
All checks were successful
Build and Release .deb / build-deb (push) Successful in 21s
All checks were successful
Build and Release .deb / build-deb (push) Successful in 21s
- Add dock: top and fixed height for toolbar buttons - DataTable now fills remaining space with height: 1fr - Add borders and padding for better visual separation
This commit is contained in:
parent
76eb75d4a6
commit
1715a6cf01
1 changed files with 20 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from textual.screen import Screen
|
||||
from textual.widgets import DataTable, Button, Static
|
||||
from textual.widgets import DataTable, Button
|
||||
from textual.containers import Vertical, Horizontal
|
||||
|
||||
try:
|
||||
|
|
@ -9,8 +9,24 @@ except Exception:
|
|||
PYPERCLIP_OK = False
|
||||
|
||||
|
||||
SCREEN_CSS = """
|
||||
align: left top;
|
||||
padding: 1 2;
|
||||
#toolbar {
|
||||
height: auto;
|
||||
dock: top;
|
||||
margin-bottom: 1;
|
||||
}
|
||||
DataTable {
|
||||
height: 1fr;
|
||||
border: solid $primary;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
class PackageListScreen(Screen):
|
||||
BINDINGS = [("b", "back", "Retour")]
|
||||
CSS = SCREEN_CSS
|
||||
|
||||
def __init__(self, packages: list[dict]):
|
||||
super().__init__()
|
||||
|
|
@ -18,7 +34,7 @@ class PackageListScreen(Screen):
|
|||
|
||||
def compose(self):
|
||||
with Vertical():
|
||||
with Horizontal(id="pkg-toolbar"):
|
||||
with Horizontal(id="toolbar"):
|
||||
yield Button("⬅ Retour", id="pkg-back", variant="default")
|
||||
table = DataTable(id="pkg-table")
|
||||
table.add_columns("Nom", "Version actuelle", "Nouvelle version", "Taille")
|
||||
|
|
@ -36,6 +52,7 @@ class PackageListScreen(Screen):
|
|||
|
||||
class CVEListScreen(Screen):
|
||||
BINDINGS = [("b", "back", "Retour")]
|
||||
CSS = SCREEN_CSS
|
||||
|
||||
def __init__(self, cves: list[dict]):
|
||||
super().__init__()
|
||||
|
|
@ -44,7 +61,7 @@ class CVEListScreen(Screen):
|
|||
|
||||
def compose(self):
|
||||
with Vertical():
|
||||
with Horizontal(id="cve-toolbar"):
|
||||
with Horizontal(id="toolbar"):
|
||||
yield Button("⬅ Retour", id="cve-back", variant="default")
|
||||
table = DataTable(id="cve-table")
|
||||
table.add_columns("CVE-ID", "Paquet", "Lien")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue