REF don't use kwargs in textcolumn

This commit is contained in:
Nathan Dwarshuis 2021-07-09 22:22:49 -04:00
parent 2ae3da11f4
commit c683b68204
5 changed files with 200 additions and 91 deletions

2
core

@ -1 +1 @@
Subproject commit 048825bef4474d1ac3f4e132c1ee7394462e9e00 Subproject commit 63598c9257f2272808a98c6192276b18a9981ac9

View File

@ -130,17 +130,30 @@ M.initPercentPlot = function(x, y, w, h, spacing, label)
-- font_spec = M.normal_font_spec, -- font_spec = M.normal_font_spec,
-- }, -- },
label = _left_text(x, y, label, M.normal_font_spec, _G_Patterns_.INACTIVE_TEXT_FG), label = _left_text(x, y, label, M.normal_font_spec, _G_Patterns_.INACTIVE_TEXT_FG),
value = _G_Widget_.CriticalText{ value = _G_Widget_.CriticalText(
x = x + w, x + w,
y = y, y,
x_align = 'right', nil,
y_align = 'center', M.normal_font_spec,
append_end = '%', _G_Patterns_.PRIMARY_FG,
critical_limit = 80, _G_Patterns_.CRITICAL_FG,
text_color = _G_Patterns_.PRIMARY_FG, 80,
critical_color = _G_Patterns_.PRIMARY_FG, 'right',
font_spec = M.normal_font_spec, 'center',
}, nil,
'%'
),
-- value = _G_Widget_.CriticalText{
-- x = x + w,
-- y = y,
-- x_align = 'right',
-- y_align = 'center',
-- append_end = '%',
-- critical_limit = 80,
-- text_color = _G_Patterns_.PRIMARY_FG,
-- critical_color = _G_Patterns_.PRIMARY_FG,
-- font_spec = M.normal_font_spec,
-- },
plot = M.initThemedLabelPlot(x, y + spacing, w, h), plot = M.initThemedLabelPlot(x, y + spacing, w, h),
} }
end end
@ -249,17 +262,30 @@ end
M.initTextRing = function(x, y, r, append_end, limit) M.initTextRing = function(x, y, r, append_end, limit)
return { return {
ring = M.initRing(x, y, r), ring = M.initRing(x, y, r),
value = _G_Widget_.CriticalText{ -- value = _G_Widget_.CriticalText{
x = x, -- x = x,
y = y, -- y = y,
x_align = 'center', -- x_align = 'center',
y_align = 'center', -- y_align = 'center',
append_end = append_end, -- append_end = append_end,
critical_limit = limit, -- critical_limit = limit,
text_color = _G_Patterns_.PRIMARY_FG, -- text_color = _G_Patterns_.PRIMARY_FG,
critical_color = _G_Patterns_.CRITICAL_FG, -- critical_color = _G_Patterns_.CRITICAL_FG,
font_spec = M.normal_font_spec, -- font_spec = M.normal_font_spec,
}, -- },
value = _G_Widget_.CriticalText(
x,
y,
nil,
M.normal_font_spec,
_G_Patterns_.PRIMARY_FG,
_G_Patterns_.CRITICAL_FG,
limit,
'center',
'center',
nil,
append_end
),
} }
end end
@ -365,18 +391,31 @@ M.initTextRowCrit = function(x, y, w, label, append_end, limit)
M.normal_font_spec, M.normal_font_spec,
_G_Patterns_.INACTIVE_TEXT_FG _G_Patterns_.INACTIVE_TEXT_FG
), ),
value = _G_Widget_.CriticalText{ -- value = _G_Widget_.CriticalText{
x = x + w, -- x = x + w,
y = y, -- y = y,
x_align = 'right', -- x_align = 'right',
y_align = 'center', -- y_align = 'center',
text_color = _G_Patterns_.PRIMARY_FG, -- text_color = _G_Patterns_.PRIMARY_FG,
critical_color = _G_Patterns_.CRITICAL_FG, -- critical_color = _G_Patterns_.CRITICAL_FG,
critical_limit = limit, -- critical_limit = limit,
append_end = append_end, -- append_end = append_end,
text = '<NA>', -- text = '<NA>',
font_spec = M.normal_font_spec, -- font_spec = M.normal_font_spec,
} -- }
value = _G_Widget_.CriticalText(
x + w,
y,
nil,
M.normal_font_spec,
_G_Patterns_.PRIMARY_FG,
_G_Patterns_.CRITICAL_FG,
limit,
'right',
'center',
nil,
append_end
)
} }
end end
@ -395,26 +434,50 @@ end
M.initTextRows = function(x, y, w, spacing, labels) M.initTextRows = function(x, y, w, spacing, labels)
return { return {
labels = _G_Widget_.TextColumn{ labels = _G_Widget_.TextColumn(
x = x, -- x = x,
y = y, -- y = y,
spacing = spacing, -- spacing = spacing,
x_align = 'left', -- x_align = 'left',
y_align = 'center', -- y_align = 'center',
text_color = _G_Patterns_.INACTIVE_TEXT_FG, -- text_color = _G_Patterns_.INACTIVE_TEXT_FG,
font_spec = M.normal_font_spec, -- font_spec = M.normal_font_spec,
table.unpack(labels), -- table.unpack(labels),
}, x,
values = _G_Widget_.TextColumn{ y,
x = x + w, spacing,
y = y, nil,
spacing = spacing, M.normal_font_spec,
x_align = 'right', _G_Patterns_.INACTIVE_TEXT_FG,
y_align = 'center', 'left',
text_color = _G_Patterns_.PRIMARY_FG, 'center',
font_spec = M.normal_font_spec, nil,
num_rows = #labels, nil,
} labels
),
-- values = _G_Widget_.TextColumn{
-- x = x + w,
-- y = y,
-- spacing = spacing,
-- x_align = 'right',
-- y_align = 'center',
-- text_color = _G_Patterns_.PRIMARY_FG,
-- font_spec = M.normal_font_spec,
-- num_rows = #labels,
-- }
values = _G_Widget_.initTextColumnN(
x + w,
y,
spacing,
nil,
M.normal_font_spec,
_G_Patterns_.PRIMARY_FG,
'right',
'center',
nil,
nil,
#labels
)
} }
end end

View File

@ -72,21 +72,39 @@ local bars = _G_Widget_.CompoundBar(
0.8 0.8
) )
local labels = _G_Widget_.TextColumn{ -- local labels = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.RIGHT_X, -- x = _G_INIT_DATA_.RIGHT_X,
y = _BAR_Y_, -- y = _BAR_Y_,
spacing = _SPACING_, -- spacing = _SPACING_,
text_color = _G_Patterns_.INACTIVE_TEXT_FG, -- text_color = _G_Patterns_.INACTIVE_TEXT_FG,
font_spec = Common.normal_font_spec, -- font_spec = Common.normal_font_spec,
x_align = 'left', -- x_align = 'left',
y_align = 'center', -- y_align = 'center',
'root', -- 'root',
-- 'boot',
-- 'home',
-- 'data',
-- 'dcache',
-- 'tmpfs',
-- }
local labels = _G_Widget_.TextColumn(
_G_INIT_DATA_.RIGHT_X,
_BAR_Y_,
_SPACING_,
nil,
Common.normal_font_spec,
_G_Patterns_.INACTIVE_TEXT_FG,
'left',
'center',
nil,
nil,
{'root',
'boot', 'boot',
'home', 'home',
'data', 'data',
'dcache', 'dcache',
'tmpfs', 'tmpfs'}
} )
_SPACING_ = nil _SPACING_ = nil
_BAR_PAD_ = nil _BAR_PAD_ = nil

View File

@ -115,31 +115,59 @@ local swap = Common.initTextRowCrit(
80 80
) )
-- local cache = {
-- labels = _G_Widget_.TextColumn{
-- x = _TEXT_LEFT_X_,
-- y = _LINE_1_Y_ + _TEXT_SPACING_,
-- spacing = _TEXT_SPACING_,
-- text_color = _G_Patterns_.INACTIVE_TEXT_FG,
-- font_spec = Common.normal_font_spec,
-- x_align = 'left',
-- y_align = 'center',
-- 'Page Cache',
-- 'Buffers',
-- 'Kernel Slab'
-- },
-- percents = _G_Widget_.TextColumn{
-- x = _RIGHT_X_,
-- y = _LINE_1_Y_ + _TEXT_SPACING_,
-- x_align = 'right',
-- y_align = 'center',
-- append_end = ' %',
-- text_color = _G_Patterns_.SECONDARY_FG,
-- font_spec = Common.normal_font_spec,
-- '<cached_kb>',
-- '<buffers_kb>',
-- '<kernel_slab>'
-- },
-- }
local cache = { local cache = {
labels = _G_Widget_.TextColumn{ labels = _G_Widget_.TextColumn(
x = _TEXT_LEFT_X_, _TEXT_LEFT_X_,
y = _LINE_1_Y_ + _TEXT_SPACING_, _LINE_1_Y_ + _TEXT_SPACING_,
spacing = _TEXT_SPACING_, _TEXT_SPACING_,
text_color = _G_Patterns_.INACTIVE_TEXT_FG, nil,
font_spec = Common.normal_font_spec, Common.normal_font_spec,
x_align = 'left', _G_Patterns_.INACTIVE_TEXT_FG,
y_align = 'center', 'left',
'Page Cache', 'center',
'Buffers', nil,
'Kernel Slab' nil,
}, {'Page Cache', 'Buffers', 'Kernel Slab'}
percents = _G_Widget_.TextColumn{ ),
x = _RIGHT_X_, percents = _G_Widget_.initTextColumnN(
y = _LINE_1_Y_ + _TEXT_SPACING_, _RIGHT_X_,
x_align = 'right', _LINE_1_Y_ + _TEXT_SPACING_,
y_align = 'center', _TEXT_SPACING_,
append_end = ' %', nil,
text_color = _G_Patterns_.SECONDARY_FG, Common.normal_font_spec,
font_spec = Common.normal_font_spec, _G_Patterns_.SECONDARY_FG,
'<cached_kb>', 'right',
'<buffers_kb>', 'center',
'<kernel_slab>' nil,
}, ' %',
3
),
} }
local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2 local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2

View File

@ -61,7 +61,7 @@ M.PLOT_FILL_BORDER_PRIMARY = Color.gradient_rgb{
} }
M.PLOT_FILL_BG_PRIMARY = Color.gradient_rgba{ M.PLOT_FILL_BG_PRIMARY = Color.gradient_rgba{
[0.2] = {PLOT_BLUE3, 0.0}, [0.2] = {PLOT_BLUE3, 0.5},
[1.0] = {PLOT_BLUE4, 1.0} [1.0] = {PLOT_BLUE4, 1.0}
} }