File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments