Skip to content

Commit bd5244c

Browse files
committed
Added (better) metadata builder TUX application. Now with BLACK
1 parent d402bec commit bd5244c

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

src/toolviper/utils/application.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,32 @@ def compose(self) -> ComposeResult:
191191
yield Button("Write", variant="success", id="btn-done")
192192
yield Footer()
193193

194+
def notify(
195+
self,
196+
message: str,
197+
*,
198+
title: str = "",
199+
severity: str = "information",
200+
timeout: float = 3.0,
201+
) -> None:
202+
"""Override notify to redirect to RichLog."""
203+
try:
204+
log_widget = self.query_one("#system-log", RichLog)
205+
color = {
206+
"information": "blue",
207+
"warning": "yellow",
208+
"error": "red",
209+
}.get(severity, "white")
210+
211+
prefix = f"[{color} bold]{severity.upper()}[/{color} bold]"
212+
if title:
213+
prefix += f" [[bold]{title}[/bold]]"
214+
215+
log_widget.write(f"{prefix}: {message}")
216+
except Exception:
217+
# Fallback to default notify if log widget is not available
218+
super().notify(message, title=title, severity=severity, timeout=timeout)
219+
194220
def on_mount(self) -> None:
195221
# Redirect stdout and stderr to RichLog
196222
log_widget = self.query_one("#system-log", RichLog)

0 commit comments

Comments
 (0)