From 2c55470f6a2c9665100a762fa206eadca5781b4b Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 10 Nov 2021 16:26:48 -0500 Subject: [PATCH] FIX float vs int in dial values --- core | 2 +- drawing/common.lua | 12 ++++++------ drawing/memory.lua | 8 +++++--- drawing/processor.lua | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core b/core index 13e3db6..192db49 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 13e3db6a9f7a0dc06be478fcd2f83cfe8ed733da +Subproject commit 192db494cae649f05342834c0c11678d4f81712c diff --git a/drawing/common.lua b/drawing/common.lua index a8ca27e..ca0d58f 100644 --- a/drawing/common.lua +++ b/drawing/common.lua @@ -142,7 +142,7 @@ local _make_tagged_percent_timeseries = function(x, y, w, h, spacing, label, upd nil, _right_text_style, _format, - text_threshold.config(theme.CRITICAL_FG, 80) + text_threshold.config(theme.CRITICAL_FG, 80, false) ), plot = M.make_percent_timeseries( x, @@ -365,7 +365,7 @@ end -------------------------------------------------------------------------------- -- ring with text data in the center -M.make_text_circle = function(x, y, r, fmt, threshhold) +M.make_text_circle = function(x, y, r, fmt, threshhold, pre_function) return { ring = M.make_circle(x, y, r), value = text_threshold.make_formatted( @@ -373,7 +373,7 @@ M.make_text_circle = function(x, y, r, fmt, threshhold) 0, text.config(normal_font_spec, theme.PRIMARY_FG, 'center', 'center'), fmt, - text_threshold.config(theme.CRITICAL_FG, threshhold) + text_threshold.config(theme.CRITICAL_FG, threshhold, pre_function) ), } end @@ -401,14 +401,14 @@ local threshold_indicator = function(threshold) ) end -M.make_dial = function(x, y, radius, thickness, threshold, _format) +M.make_dial = function(x, y, radius, thickness, threshold, _format, pre_function) return { dial = dial.make( geom.make_arc(x, y, radius, DIAL_THETA0, DIAL_THETA1), arc.config(style.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG), threshold_indicator(threshold) ), - text_circle = M.make_text_circle(x, y, radius - thickness / 2 - 2, _format, threshold), + text_circle = M.make_text_circle(x, y, radius - thickness / 2 - 2, _format, threshold, pre_function), } end @@ -529,7 +529,7 @@ M.make_threshold_text_row = function(x, y, w, label, append_end, limit) nil, _right_text_style, append_end, - text_threshold.config(theme.CRITICAL_FG, limit) + text_threshold.config(theme.CRITICAL_FG, limit, false) ) } end diff --git a/drawing/memory.lua b/drawing/memory.lua index 7f26cd2..aa913f5 100644 --- a/drawing/memory.lua +++ b/drawing/memory.lua @@ -50,7 +50,7 @@ return function(update_freq) local swaptotal = get_meminfo_field('SwapTotal') local FORMAT_PERCENT = function(x) - return string.format('%i%%', __math_floor(x)) + return string.format('%i%%', x) end local MEM_X = geometry.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS / 2 @@ -63,7 +63,8 @@ return function(update_freq) DIAL_RADIUS, DIAL_THICKNESS, 80, - FORMAT_PERCENT + FORMAT_PERCENT, + __math_floor ) ----------------------------------------------------------------------------- @@ -77,7 +78,8 @@ return function(update_freq) DIAL_RADIUS, DIAL_THICKNESS, 80, - FORMAT_PERCENT + FORMAT_PERCENT, + __math_floor ) ----------------------------------------------------------------------------- diff --git a/drawing/processor.lua b/drawing/processor.lua index a0cf595..97cab9c 100644 --- a/drawing/processor.lua +++ b/drawing/processor.lua @@ -60,7 +60,8 @@ return function(update_freq) y, DIAL_INNER_RADIUS - 2, '%s°C', - 80 + 80, + __math_floor ) } end