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

View File

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

View File

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

View File

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

View File

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