Issue when display sensors with space in browser #2983

This commit is contained in:
nicolargo 2024-11-08 19:31:35 +01:00
parent cd70a8091f
commit 64e8cf4221
2 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -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