1+ import os
2+
13from rich .console import Console
24from rich .panel import Panel
35from rich .table import Table
810# Global console for UI functions
911_console = Console ()
1012
13+ # Check if we should use simple UI (e.g., when running in Tilt)
14+ _use_simple_ui = os .getenv ("DEBUGWAND_SIMPLE_UI" ) == "1"
15+
1116
1217def render_pods_table (pods : list [PodInfo ]):
1318 table = Table ()
@@ -83,16 +88,35 @@ def render_processes_table(pod_processes: list[tuple[PodInfo, list[ProcessInfo]]
8388def print_reload_mode_warning (worker_pid : int ):
8489 """Print a formatted warning about reload mode detection."""
8590 _console .print ()
86- _console .print (
87- Panel (
88- f"The app is running with [cyan]--reload[/cyan], which spawns worker processes.\n "
89- f"Injecting into the [green bold]WORKER[/green bold] process (PID [cyan]{ worker_pid } [/cyan]).\n "
90- f"Process monitoring enabled - debugpy will auto-reinject on worker restarts." ,
91- border_style = "yellow" ,
92- title = "Reload Mode" ,
93- expand = False ,
91+
92+ if _use_simple_ui :
93+ # Simple output for environments like Tilt
94+ _console .print (
95+ "[yellow]=============================== Reload Mode ===============================[/yellow]"
9496 )
95- )
97+ _console .print (
98+ "The app is running with [cyan]--reload[/cyan], which spawns worker processes."
99+ )
100+ _console .print (
101+ f"Injecting into the [green bold]WORKER[/green bold] process (PID [cyan]{ worker_pid } [/cyan])."
102+ )
103+ _console .print (
104+ "Process monitoring enabled - debugpy will auto-reinject on worker restarts."
105+ )
106+ _console .print ("[yellow]" + "=" * 75 + "[/yellow]" )
107+ else :
108+ # Fancy panel for normal terminals
109+ _console .print (
110+ Panel (
111+ f"The app is running with [cyan]--reload[/cyan], which spawns worker processes.\n "
112+ f"Injecting into the [green bold]WORKER[/green bold] process (PID [cyan]{ worker_pid } [/cyan]).\n "
113+ f"Process monitoring enabled - debugpy will auto-reinject on worker restarts." ,
114+ border_style = "yellow" ,
115+ title = "Reload Mode" ,
116+ expand = False ,
117+ )
118+ )
119+
96120 _console .print (
97121 f"[green]✅[/green] Auto-selecting worker process: [cyan bold]PID { worker_pid } [/cyan bold]"
98122 )
@@ -116,13 +140,25 @@ def print_step(message: str, prefix: str = "🔧"):
116140def print_connection_info (port : int ):
117141 """Print formatted connection instructions with VSCode config."""
118142 _console .print ()
119- _console .print (
120- Panel (
121- f"[green bold]🎉 Ready to Debug![/green bold]\n \n "
122- f"Connect your debugger to: [cyan bold]localhost:{ port } [/cyan bold]" ,
123- border_style = "green" ,
124- expand = False ,
143+
144+ if _use_simple_ui :
145+ # Simple output for environments like Tilt
146+ _console .print ("[green]" + "=" * 42 + "[/green]" )
147+ _console .print ("[green bold]🎉 Ready to Debug![/green bold]" )
148+ _console .print ()
149+ _console .print (
150+ f"Connect your debugger to: [cyan bold]localhost:{ port } [/cyan bold]"
151+ )
152+ _console .print ("[green]" + "=" * 42 + "[/green]" )
153+ else :
154+ # Fancy panel for normal terminals
155+ _console .print (
156+ Panel (
157+ f"[green bold]🎉 Ready to Debug![/green bold]\n \n "
158+ f"Connect your debugger to: [cyan bold]localhost:{ port } [/cyan bold]" ,
159+ border_style = "green" ,
160+ expand = False ,
161+ )
125162 )
126- )
127163
128164 _console .print ("\n [dim]Press Ctrl+C to stop port-forwarding and exit.[/dim]\n " )
0 commit comments