From c65a1f3970b8b7598692c5690e289428ccf90635 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sat, 22 Apr 2023 21:32:35 -0500 Subject: [PATCH] +sub-headers, -repetition. -padding for fit --- gpustats.py | 41 ++++++++++++++++++++++++++++------------- stats.css | 2 +- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/gpustats.py b/gpustats.py index fb83212..897b7d8 100755 --- a/gpustats.py +++ b/gpustats.py @@ -151,12 +151,19 @@ class MiscDisplay(Static): self.timer_temp = None def compose(self) -> ComposeResult: + yield Horizontal(Label("[underline]Temperatures:"), + Label("", classes="statvalue")) for temp_node in temp_files: # capitalize the first letter for display caption = temp_node[0].upper() + temp_node[1:] - yield Horizontal(Label(f'[bold]{caption}[/] temp:',), Label("", id="temp_" + temp_node, classes="statvalue")) - yield Horizontal(Label("[underline]Current[/] fan RPM:",), Label("", id="fan_rpm", classes="statvalue")) - yield Horizontal(Label("[underline]Target[/] fan RPM:",), Label("", id="fan_rpm_target", classes="statvalue")) + yield Horizontal(Label(f'[bold] {caption}:[/]',), + Label("", id="temp_" + temp_node, classes="statvalue")) + yield Horizontal(Label("[underline]Fan RPM:"), + Label("", classes="statvalue")) + yield Horizontal(Label("[bold] Current:[/]",), + Label("", id="fan_rpm", classes="statvalue")) + yield Horizontal(Label("[bold] Target:[/]",), + Label("", id="fan_rpm_target", classes="statvalue")) def on_mount(self) -> None: """Event handler called when widget is added to the app.""" @@ -211,10 +218,16 @@ class ClockDisplay(Static): self.timer_clocks = None def compose(self) -> ComposeResult: - yield Horizontal(Label("Core clock:",), Label("", id="clk_core_val", classes="statvalue")) - yield Horizontal(Label("Utilization:",), Label("", id="util_pct", classes="statvalue")) - yield Horizontal(Label("Core voltage:",), Label("", id="clk_voltage_val", classes="statvalue")) - yield Horizontal(Label("Memory clock:"), Label("", id="clk_memory_val", classes="statvalue")) + yield Horizontal(Label("[underline]Core:"), + Label("", classes="statvalue")) + yield Horizontal(Label(" GPU Clock:",), + Label("", id="clk_core_val", classes="statvalue")) + yield Horizontal(Label(" Memory clock:"), + Label("", id="clk_memory_val", classes="statvalue")) + yield Horizontal(Label(" Utilization:",), + Label("", id="util_pct", classes="statvalue")) + yield Horizontal(Label(" Voltage:",), + Label("", id="clk_voltage_val", classes="statvalue")) def on_mount(self) -> None: """Event handler called when widget is added to the app.""" @@ -256,13 +269,15 @@ class PowerDisplay(Static): self.timer_micro_watts = None def compose(self) -> ComposeResult: - yield Horizontal(Label("Power usage:",), + yield Horizontal(Label("[underline]Power:"), + Label("", classes="statvalue")) + yield Horizontal(Label(" Usage:",), Label("", id="pwr_avg_val", classes="statvalue")) - yield Horizontal(Label("Power limit:",), + yield Horizontal(Label(" [bold]Set[/] limit:",), Label("", id="pwr_lim_val", classes="statvalue")) - yield Horizontal(Label("[underline]Default[/] limit:",), + yield Horizontal(Label(" [bold]Default[/] limit:",), Label("", id="pwr_def_val", classes="statvalue")) - yield Horizontal(Label("Board capability:",), + yield Horizontal(Label(" Board capability:",), Label("", id="pwr_cap_val", classes="statvalue")) def on_mount(self) -> None: @@ -312,8 +327,8 @@ if __name__ == "__main__": default=1.0, help="The delay (in seconds) between polling for data", ) - args = p.parse_args() - interval = args.interval + p_args = p.parse_args() + interval = p_args.interval # CARD = args.card # detect AMD GPU, exit if unfound diff --git a/stats.css b/stats.css index 95f74a3..86448e9 100644 --- a/stats.css +++ b/stats.css @@ -6,7 +6,7 @@ GPUStatsWidget { height: 11; /* margin: 1;*/ min-width: 50; - padding: 1; +/* padding: 1;*/ } /* for colors, see: https://textual.textualize.io/guide/design/#theme-reference */