From 64e8cf42219e2f7a69e207ee98f5536fe31a6da3 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Fri, 8 Nov 2024 19:31:35 +0100 Subject: [PATCH] Issue when display sensors with space in browser #2983 --- conf/glances.conf | 2 +- glances/outputs/glances_curses_browser.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/conf/glances.conf b/conf/glances.conf index 097c1f8f..0693881c 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -541,7 +541,7 @@ disable=False # Default is: system:hr_name,load:min5,cpu:total,mem:percent # You can also add stats with key, like sensors:value:Ambient (key is case sensitive) #columns=system:hr_name,load:min5,cpu:total,mem:percent,memswap:percent,sensors:value:Ambient,sensors:value:Composite -columns=system:hr_name,load:min5,cpu:total,mem:percent,memswap:percent,sensors:value:Ambient 5 +columns=system:hr_name,load:min5,cpu:total,mem:percent,memswap:percent,sensors:value:dell_smm 0 # Define the static servers list # _protocol can be: rpc (default if not defined) or rest # List is limited to 256 servers max (1 to 256) diff --git a/glances/outputs/glances_curses_browser.py b/glances/outputs/glances_curses_browser.py index bf88175b..011766ad 100644 --- a/glances/outputs/glances_curses_browser.py +++ b/glances/outputs/glances_curses_browser.py @@ -314,8 +314,11 @@ class GlancesCursesBrowser(_GlancesCurses): stats_max = screen_y - 3 y = 2 xc = x + 2 + # First line (plugin name) for k, v in column_def.items(): + logger.info(k) k_split = k.split('_') + logger.info(k_split) if len(k_split) == 1: xc += v + self.space_between_column continue @@ -324,12 +327,11 @@ class GlancesCursesBrowser(_GlancesCurses): xc += v + self.space_between_column xc = x + 2 y += 1 + # Second line (for item/key) for k, v in column_def.items(): k_split = k.split('_') if xc < screen_x and y < screen_y and v is not None: - self.term_window.addnstr( - y, xc, k_split[len(k_split) - 1].upper(), screen_x - x, self.colors_list['BOLD'] - ) + self.term_window.addnstr(y, xc, ' '.join(k_split[1:]).upper(), screen_x - x, self.colors_list['BOLD']) xc += v + self.space_between_column y += 1