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,
_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

View File

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

View File

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