Reorganize project structure
This commit is contained in:
4
checkaddy_app/widgets/__init__.py
Normal file
4
checkaddy_app/widgets/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .detail_line import DetailLine
|
||||
from .metric_card import MetricCard
|
||||
|
||||
__all__ = ["MetricCard", "DetailLine"]
|
||||
17
checkaddy_app/widgets/detail_line.py
Normal file
17
checkaddy_app/widgets/detail_line.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class DetailLine(Static):
|
||||
def __init__(self, label: str, value: str = "-", element_id: str = "") -> None:
|
||||
super().__init__(id=element_id, classes="detail-row")
|
||||
self.label = label
|
||||
self.value = value
|
||||
|
||||
def on_mount(self) -> None:
|
||||
self.set_value(self.value)
|
||||
|
||||
def set_value(self, value: str) -> None:
|
||||
self.value = value
|
||||
self.update(f"[dim]{self.label}:[/] {value}")
|
||||
17
checkaddy_app/widgets/metric_card.py
Normal file
17
checkaddy_app/widgets/metric_card.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class MetricCard(Static):
|
||||
def __init__(self, title: str, value: str = "-", element_id: str = "") -> None:
|
||||
super().__init__(id=element_id, classes="metric-card")
|
||||
self.title = title
|
||||
self.value = value
|
||||
|
||||
def on_mount(self) -> None:
|
||||
self.set_value(self.value)
|
||||
|
||||
def set_value(self, value: str) -> None:
|
||||
self.value = value
|
||||
self.update("[dim]" + self.title + "[/]" + chr(10) + "[b]" + value + "[/]")
|
||||
Reference in New Issue
Block a user