FIX float vs int in dial values

This commit is contained in:
Nathan Dwarshuis 2021-11-10 16:26:48 -05:00
parent 06b2d0c8e1
commit 2c55470f6a
4 changed files with 14 additions and 11 deletions

2
core

@ -1 +1 @@
Subproject commit 13e3db6a9f7a0dc06be478fcd2f83cfe8ed733da Subproject commit 192db494cae649f05342834c0c11678d4f81712c

View File

@ -142,7 +142,7 @@ local _make_tagged_percent_timeseries = function(x, y, w, h, spacing, label, upd
nil, nil,
_right_text_style, _right_text_style,
_format, _format,
text_threshold.config(theme.CRITICAL_FG, 80) text_threshold.config(theme.CRITICAL_FG, 80, false)
), ),
plot = M.make_percent_timeseries( plot = M.make_percent_timeseries(
x, x,
@ -365,7 +365,7 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- ring with text data in the center -- 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 { return {
ring = M.make_circle(x, y, r), ring = M.make_circle(x, y, r),
value = text_threshold.make_formatted( value = text_threshold.make_formatted(
@ -373,7 +373,7 @@ M.make_text_circle = function(x, y, r, fmt, threshhold)
0, 0,
text.config(normal_font_spec, theme.PRIMARY_FG, 'center', 'center'), text.config(normal_font_spec, theme.PRIMARY_FG, 'center', 'center'),
fmt, fmt,
text_threshold.config(theme.CRITICAL_FG, threshhold) text_threshold.config(theme.CRITICAL_FG, threshhold, pre_function)
), ),
} }
end end
@ -401,14 +401,14 @@ local threshold_indicator = function(threshold)
) )
end end
M.make_dial = function(x, y, radius, thickness, threshold, _format) M.make_dial = function(x, y, radius, thickness, threshold, _format, pre_function)
return { return {
dial = dial.make( dial = dial.make(
geom.make_arc(x, y, radius, DIAL_THETA0, DIAL_THETA1), geom.make_arc(x, y, radius, DIAL_THETA0, DIAL_THETA1),
arc.config(style.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG), arc.config(style.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG),
threshold_indicator(threshold) 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 end
@ -529,7 +529,7 @@ M.make_threshold_text_row = function(x, y, w, label, append_end, limit)
nil, nil,
_right_text_style, _right_text_style,
append_end, append_end,
text_threshold.config(theme.CRITICAL_FG, limit) text_threshold.config(theme.CRITICAL_FG, limit, false)
) )
} }
end end

View File

@ -50,7 +50,7 @@ return function(update_freq)
local swaptotal = get_meminfo_field('SwapTotal') local swaptotal = get_meminfo_field('SwapTotal')
local FORMAT_PERCENT = function(x) local FORMAT_PERCENT = function(x)
return string.format('%i%%', __math_floor(x)) return string.format('%i%%', x)
end end
local MEM_X = geometry.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS / 2 local MEM_X = geometry.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS / 2
@ -63,7 +63,8 @@ return function(update_freq)
DIAL_RADIUS, DIAL_RADIUS,
DIAL_THICKNESS, DIAL_THICKNESS,
80, 80,
FORMAT_PERCENT FORMAT_PERCENT,
__math_floor
) )
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@ -77,7 +78,8 @@ return function(update_freq)
DIAL_RADIUS, DIAL_RADIUS,
DIAL_THICKNESS, DIAL_THICKNESS,
80, 80,
FORMAT_PERCENT FORMAT_PERCENT,
__math_floor
) )
----------------------------------------------------------------------------- -----------------------------------------------------------------------------

View File

@ -60,7 +60,8 @@ return function(update_freq)
y, y,
DIAL_INNER_RADIUS - 2, DIAL_INNER_RADIUS - 2,
'%s°C', '%s°C',
80 80,
__math_floor
) )
} }
end end