28 lines
752 B
Python
28 lines
752 B
Python
from textual.reactive import Reactive
|
|
from textual.app import RenderResult
|
|
from textual.widgets import Static, Label
|
|
|
|
class EnvelopeHeader(Static):
|
|
|
|
subject = Reactive("")
|
|
from_ = Reactive("")
|
|
to = Reactive("")
|
|
date = Reactive("")
|
|
cc = Reactive("")
|
|
bcc = Reactive("")
|
|
|
|
"""Header for the email viewer."""
|
|
def on_mount(self) -> None:
|
|
"""Mount the header."""
|
|
|
|
def render(self) -> RenderResult:
|
|
return f"[b]{self.subject}[/b] [dim]({self.date})[/] \r\n" \
|
|
f"[dim]From:[/dim] {self.from_} [dim]To:[/dim] {self.to} \r\n" \
|
|
f"[dim]Date:[/dim] {self.date} \r\n" \
|
|
f"[dim]CC:[/dim] {self.cc} \r\n" \
|
|
f"[dim]BCC:[/dim] {self.bcc} \r\n" \
|
|
|
|
|
|
|
|
|