ENH use string.print instead of prefix/suffix

This commit is contained in:
Nathan Dwarshuis 2021-07-10 19:07:45 -04:00
parent e2f622fd22
commit a7db545cd3
6 changed files with 15 additions and 21 deletions

2
core

@ -1 +1 @@
Subproject commit a2c1c089c9933b191c5ef4fd1569b3ede80acdd3
Subproject commit 9a9a86cdacf0cbbcc37eb2db908ec4ade78d3e99

View File

@ -44,7 +44,7 @@ M.right_text_style = _G_Widget_.text_style(
)
local _bare_text = function(pt, text, style)
local fmt = _G_Widget_.text_format(false, false, false)
local fmt = _G_Widget_.text_format(false, false)
return _G_Widget_.Text(pt, text, style, fmt)
end
@ -86,7 +86,7 @@ M.Header = function(x, y, w, s)
'left',
'top'
),
_G_Widget_.text_format(false, false, false)
_G_Widget_.text_format(false, false)
),
bottom_y = bottom_y,
-- underline = _G_Widget_.Line{
@ -155,8 +155,7 @@ M.initPercentPlot = function(x, y, w, h, spacing, label)
'center'
),
_G_Widget_.text_format(
false,
'%',
'%s%%',
false
),
_G_Patterns_.CRITICAL_FG,
@ -279,7 +278,7 @@ end
--------------------------------------------------------------------------------
-- ring with text data in the center
M.initTextRing = function(x, y, r, append_end, limit)
M.initTextRing = function(x, y, r, fmt, limit)
return {
ring = M.initRing(x, y, r),
-- value = _G_Widget_.CriticalText{
@ -302,11 +301,7 @@ M.initTextRing = function(x, y, r, append_end, limit)
'center',
'center'
),
_G_Widget_.text_format(
false,
append_end,
false
),
_G_Widget_.text_format(fmt, false),
_G_Patterns_.CRITICAL_FG,
limit
),
@ -428,7 +423,6 @@ M.initTextRowCrit = function(x, y, w, label, append_end, limit)
'center'
),
_G_Widget_.text_format(
false,
append_end,
false
),
@ -465,7 +459,7 @@ M.initTextRows = function(x, y, w, spacing, labels)
_G_Widget_.make_point(x, y),
labels,
M.left_text_style,
_G_Widget_.text_format(false, false, false),
_G_Widget_.text_format(false, false),
spacing
),
-- values = _G_Widget_.TextColumn{
@ -482,7 +476,7 @@ M.initTextRows = function(x, y, w, spacing, labels)
_G_Widget_.make_point(x + w, y),
#labels,
M.right_text_style,
_G_Widget_.text_format(false, false, false),
_G_Widget_.text_format(false, false),
spacing
)
}

View File

@ -99,7 +99,7 @@ local labels = _G_Widget_.TextColumn(
'left',
'center'
),
_G_Widget_.text_format(false, false, false),
_G_Widget_.text_format(false, false),
_SPACING_
)

View File

@ -43,7 +43,7 @@ local internal_temp = Common.initTextRowCrit(
_INTERNAL_TEMP_Y_,
_G_INIT_DATA_.SECTION_WIDTH,
'Internal Temperature',
'°C',
'%s°C',
80
)

View File

@ -86,7 +86,7 @@ local text_ring = Common.initTextRing(
DIAL_X,
DIAL_Y,
DIAL_RADIUS - _DIAL_THICKNESS_ / 2 - 2,
'%',
'%s%%',
80
)
@ -100,7 +100,7 @@ local swap = Common.initTextRowCrit(
-- TODO this is silly
_RIGHT_X_ - _TEXT_LEFT_X_,
'Swap Usage',
' %',
'%s%%',
80
)
@ -143,7 +143,7 @@ local cache = {
'left',
'center'
),
_G_Widget_.text_format(false, false, false),
_G_Widget_.text_format(false, false),
_TEXT_SPACING_
),
percents = _G_Widget_.initTextColumnN(
@ -158,7 +158,7 @@ local cache = {
'right',
'center'
),
_G_Widget_.text_format(false, '%', false),
_G_Widget_.text_format('%s%%', false),
_TEXT_SPACING_
),
}

View File

@ -87,7 +87,7 @@ local _create_core_ = function(cores, id, x, y)
x,
y,
_DIAL_INNER_RADIUS_ - 2,
'°C',
'%s°C',
90
),
coretemp_path = string.format(CORETEMP_PATH, hwmon_index, 'temp'..(id + 2)..'_input'),