Skip to content

Commit cfec979

Browse files
committed
fix: Change Terminal Command Output Format to Align with Vite-Style Output | closes #22
Simple shit, just changed those print commands ; )
1 parent 58c9428 commit cfec979

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

tkreload/help.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
def show_help(auto_reload):
88
"""Displays help commands with detailed info and rich formatting."""
9-
console.print("\n[bold yellow]Tkreload Help:[/bold yellow]")
10-
console.print("[bold blue]-----------------------------------------[/bold blue]")
11-
console.print("[bold cyan]Enter + H[/bold cyan] : Display this help section.")
12-
console.print("[bold cyan]Enter + R[/bold cyan] : Restart the Tkinter app.")
13-
console.print("[bold cyan]Enter + A[/bold cyan] : Toggle auto-reload (currently [bold magenta]{}[/bold magenta]).".format("Enabled" if auto_reload else "Disabled"))
14-
console.print("[bold red]Ctrl + C[/bold red] : Exit the development server.")
15-
console.print("[bold blue]-----------------------------------------[/bold blue]\n")
9+
console.print("\n[bold yellow]Tkreload Help:[/bold yellow] [dim](detailed command info)[/dim]\n")
10+
console.print("[bold cyan]→[/bold cyan] [bold white]Press H[/bold white] : Display this help section.")
11+
console.print("[bold cyan]→[/bold cyan] [bold white]Press R[/bold white] : Restart the Tkinter app.")
12+
console.print(
13+
f"[bold cyan]→[/bold cyan] [bold white]Press A[/bold white] : Toggle auto-reload "
14+
f"(currently [bold magenta]{auto_reload}[/bold magenta])."
15+
)
16+
console.print("[bold cyan]→[/bold cyan] [bold white]Ctrl + C[/bold white] : Exit the development server.\n")

tkreload/main.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def __init__(self, app_file):
2828
self.process = None
2929
self.observer = None
3030
self.reload_count = 0
31+
self.startup_time=0
3132

3233
def run_tkinter_app(self):
3334
"""Run the given Tkinter app."""
@@ -65,18 +66,21 @@ def restart_app(self):
6566

6667
def start(self):
6768
"""Starts the application, including monitoring and handling commands."""
69+
start_time = time.time() # Record the start time
6870
self.run_tkinter_app()
6971
self.monitor_file_changes(self.restart_app)
72+
self.startup_time = (time.time() - start_time) * 1000 # Calculate startup time in milliseconds
7073

7174
try:
7275
self.console.print(
73-
"\n\n\t[bold cyan]Tkreload[/bold cyan] [bold blue]is running ✅\n\t[/bold blue]- Press [bold cyan]H[/bold cyan] for help,\n\t[bold cyan]- R[/bold cyan] to restart,\n\t[bold cyan]- A[/bold cyan] to toggle auto-reload (currently [bold magenta]{}[/bold magenta]),\n\t[bold red]- Ctrl + C[/bold red] to exit.".format(
74-
"Disabled"
75-
if not self.auto_reload_manager.get_status()
76-
else "Enabled"
77-
)
76+
f"\n[bold white]Tkreload[/bold white] [dim](ready in {self.startup_time:.2f} ms)[/dim]\n"
77+
f"\t[bold cyan]→[/bold cyan] [bold white]Auto-reload:[/bold white] [bold magenta]{'Enabled' if self.auto_reload_manager.get_status() else 'Disabled'}[/bold magenta]\n"
78+
"\t[bold cyan]→[/bold cyan] [bold white]Help:[/bold white] Press [bold cyan]H[/bold cyan]\n"
79+
"\t[bold cyan]→[/bold cyan] [bold white]Restart:[/bold white] Press [bold cyan]R[/bold cyan]\n"
80+
"\t[bold cyan]→[/bold cyan] [bold white]Exit:[/bold white] Press [bold red]Ctrl + C[/bold red]"
7881
)
7982

83+
8084
while True:
8185
if platform.system() == "Windows":
8286
if msvcrt.kbhit(): # Check for keyboard input (Windows only)

0 commit comments

Comments
 (0)