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

View File

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

View File

@ -115,31 +115,59 @@ local swap = Common.initTextRowCrit(
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 = {
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>'
},
labels = _G_Widget_.TextColumn(
_TEXT_LEFT_X_,
_LINE_1_Y_ + _TEXT_SPACING_,
_TEXT_SPACING_,
nil,
Common.normal_font_spec,
_G_Patterns_.INACTIVE_TEXT_FG,
'left',
'center',
nil,
nil,
{'Page Cache', 'Buffers', 'Kernel Slab'}
),
percents = _G_Widget_.initTextColumnN(
_RIGHT_X_,
_LINE_1_Y_ + _TEXT_SPACING_,
_TEXT_SPACING_,
nil,
Common.normal_font_spec,
_G_Patterns_.SECONDARY_FG,
'right',
'center',
nil,
' %',
3
),
}
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{
[0.2] = {PLOT_BLUE3, 0.0},
[0.2] = {PLOT_BLUE3, 0.5},
[1.0] = {PLOT_BLUE4, 1.0}
}