REF don't use kwargs in text
This commit is contained in:
parent
ed2376e418
commit
2ae3da11f4
2
core
2
core
|
@ -1 +1 @@
|
||||||
Subproject commit ace0345e68a057ed013e41112db80891aeedf648
|
Subproject commit 048825bef4474d1ac3f4e132c1ee7394462e9e00
|
|
@ -17,6 +17,18 @@ local HEADER_UNDERLINE_CAP = CAIRO_LINE_CAP_ROUND
|
||||||
local HEADER_UNDERLINE_OFFSET = -20
|
local HEADER_UNDERLINE_OFFSET = -20
|
||||||
local HEADER_UNDERLINE_THICKNESS = 3
|
local HEADER_UNDERLINE_THICKNESS = 3
|
||||||
|
|
||||||
|
local _bare_text = function(x, y, text, font_spec, pattern, x_align)
|
||||||
|
return _G_Widget_.Text(x, y, text, font_spec, pattern, x_align, 'center', nil, nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
local _left_text = function(x, y, text, font_spec, pattern)
|
||||||
|
return _bare_text(x, y, text, font_spec, pattern, 'left')
|
||||||
|
end
|
||||||
|
|
||||||
|
local _right_text = function(x, y, text, font_spec, pattern)
|
||||||
|
return _bare_text(x, y, text, font_spec, pattern, 'right')
|
||||||
|
end
|
||||||
|
|
||||||
M.make_font_spec = function(f, s, bold)
|
M.make_font_spec = function(f, s, bold)
|
||||||
return {
|
return {
|
||||||
family = f,
|
family = f,
|
||||||
|
@ -38,18 +50,29 @@ M.Header = function(x, y, w, s)
|
||||||
local underline_y = bottom_y + HEADER_UNDERLINE_OFFSET
|
local underline_y = bottom_y + HEADER_UNDERLINE_OFFSET
|
||||||
|
|
||||||
local obj = {
|
local obj = {
|
||||||
text = _G_Widget_.Text{
|
-- text = _G_Widget_.Text{
|
||||||
x = x,
|
-- x = x,
|
||||||
y = y,
|
-- y = y,
|
||||||
text = s,
|
-- text = s,
|
||||||
font_spec = M.make_font_spec(_G_Patterns_.FONT, HEADER_FONT_SIZE, true),
|
-- font_spec = M.make_font_spec(_G_Patterns_.FONT, HEADER_FONT_SIZE, true),
|
||||||
-- font_size = HEADER_FONT_SIZE,
|
-- -- font_size = HEADER_FONT_SIZE,
|
||||||
x_align = 'left',
|
-- x_align = 'left',
|
||||||
y_align = 'top',
|
-- y_align = 'top',
|
||||||
text_color = _G_Patterns_.HEADER_FG,
|
-- text_color = _G_Patterns_.HEADER_FG,
|
||||||
-- slant = HEADER_FONT_SLANT,
|
-- -- slant = HEADER_FONT_SLANT,
|
||||||
-- weight = HEADER_FONT_WEIGHT
|
-- -- weight = HEADER_FONT_WEIGHT
|
||||||
},
|
-- },
|
||||||
|
text = _G_Widget_.Text(
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
s,
|
||||||
|
M.make_font_spec(_G_Patterns_.FONT, HEADER_FONT_SIZE, true),
|
||||||
|
_G_Patterns_.HEADER_FG,
|
||||||
|
'left',
|
||||||
|
'top',
|
||||||
|
nil,
|
||||||
|
nil
|
||||||
|
),
|
||||||
bottom_y = bottom_y,
|
bottom_y = bottom_y,
|
||||||
-- underline = _G_Widget_.Line{
|
-- underline = _G_Widget_.Line{
|
||||||
-- p1 = {x = x, y = underline_y},
|
-- p1 = {x = x, y = underline_y},
|
||||||
|
@ -98,18 +121,20 @@ end
|
||||||
|
|
||||||
M.initPercentPlot = function(x, y, w, h, spacing, label)
|
M.initPercentPlot = function(x, y, w, h, spacing, label)
|
||||||
return {
|
return {
|
||||||
label = _G_Widget_.Text{
|
-- label = _G_Widget_.Text{
|
||||||
x = x,
|
-- x = x,
|
||||||
y = y,
|
-- y = y,
|
||||||
text = label,
|
-- text = label,
|
||||||
x_align = 'left',
|
-- x_align = 'left',
|
||||||
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,
|
||||||
},
|
-- },
|
||||||
|
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 = x + w,
|
||||||
y = y,
|
y = y,
|
||||||
x_align = 'right',
|
x_align = 'right',
|
||||||
|
y_align = 'center',
|
||||||
append_end = '%',
|
append_end = '%',
|
||||||
critical_limit = 80,
|
critical_limit = 80,
|
||||||
text_color = _G_Patterns_.PRIMARY_FG,
|
text_color = _G_Patterns_.PRIMARY_FG,
|
||||||
|
@ -159,21 +184,23 @@ end
|
||||||
|
|
||||||
M.initLabeledScalePlot = function(x, y, w, h, f, spacing, label)
|
M.initLabeledScalePlot = function(x, y, w, h, f, spacing, label)
|
||||||
return {
|
return {
|
||||||
label = _G_Widget_.Text{
|
-- label = _G_Widget_.Text{
|
||||||
x = x,
|
-- x = x,
|
||||||
y = y,
|
-- y = y,
|
||||||
text = label,
|
-- text = label,
|
||||||
x_align = 'left',
|
-- x_align = 'left',
|
||||||
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,
|
||||||
},
|
-- },
|
||||||
value = _G_Widget_.Text{
|
label = _left_text(x, y, label, M.normal_font_spec, _G_Patterns_.INACTIVE_TEXT_FG),
|
||||||
x = x + w,
|
-- value = _G_Widget_.Text{
|
||||||
y = y,
|
-- x = x + w,
|
||||||
x_align = 'right',
|
-- y = y,
|
||||||
text_color = _G_Patterns_.PRIMARY_FG,
|
-- x_align = 'right',
|
||||||
font_spec = M.normal_font_spec,
|
-- text_color = _G_Patterns_.PRIMARY_FG,
|
||||||
},
|
-- font_spec = M.normal_font_spec,
|
||||||
|
-- },
|
||||||
|
value = _right_text(x + w, y, label, M.normal_font_spec, _G_Patterns_.PRIMARY_FG),
|
||||||
plot = M.initThemedScalePlot(x, y + spacing, w, h, f),
|
plot = M.initThemedScalePlot(x, y + spacing, w, h, f),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -269,24 +296,39 @@ end
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- text row (label with a value, aligned as far apart as possible)
|
-- text row (label with a value, aligned as far apart as possible)
|
||||||
|
|
||||||
|
|
||||||
M.initTextRow = function(x, y, w, label)
|
M.initTextRow = function(x, y, w, label)
|
||||||
return {
|
return {
|
||||||
label = _G_Widget_.Text{
|
-- label = _G_Widget_.Text{
|
||||||
x = x,
|
-- x = x,
|
||||||
y = y,
|
-- y = y,
|
||||||
x_align = 'left',
|
-- x_align = 'left',
|
||||||
text_color = _G_Patterns_.INACTIVE_TEXT_FG,
|
-- text_color = _G_Patterns_.INACTIVE_TEXT_FG,
|
||||||
text = label,
|
-- text = label,
|
||||||
font_spec = M.normal_font_spec,
|
-- font_spec = M.normal_font_spec,
|
||||||
},
|
-- },
|
||||||
value = _G_Widget_.Text{
|
label = _left_text(
|
||||||
x = x + w,
|
x,
|
||||||
y = y,
|
y,
|
||||||
x_align = 'right',
|
label,
|
||||||
text_color = _G_Patterns_.PRIMARY_FG,
|
M.normal_font_spec,
|
||||||
text = "<NA>",
|
_G_Patterns_.INACTIVE_TEXT_FG
|
||||||
font_spec = M.normal_font_spec,
|
),
|
||||||
}
|
-- value = _G_Widget_.Text{
|
||||||
|
-- x = x + w,
|
||||||
|
-- y = y,
|
||||||
|
-- x_align = 'right',
|
||||||
|
-- text_color = _G_Patterns_.PRIMARY_FG,
|
||||||
|
-- text = "<NA>",
|
||||||
|
-- font_spec = M.normal_font_spec,
|
||||||
|
-- }
|
||||||
|
value = _right_text(
|
||||||
|
x + w,
|
||||||
|
y,
|
||||||
|
nil,
|
||||||
|
M.normal_font_spec,
|
||||||
|
_G_Patterns_.PRIMARY_FG
|
||||||
|
),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -308,18 +350,26 @@ end
|
||||||
-- TODO add limit to this
|
-- TODO add limit to this
|
||||||
M.initTextRowCrit = function(x, y, w, label, append_end, limit)
|
M.initTextRowCrit = function(x, y, w, label, append_end, limit)
|
||||||
return{
|
return{
|
||||||
label = _G_Widget_.Text{
|
-- label = _G_Widget_.Text{
|
||||||
x = x,
|
-- x = x,
|
||||||
y = y,
|
-- y = y,
|
||||||
text = label,
|
-- text = label,
|
||||||
x_align = 'left',
|
-- x_align = 'left',
|
||||||
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,
|
||||||
},
|
-- },
|
||||||
|
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 = x + w,
|
||||||
y = y,
|
y = y,
|
||||||
x_align = 'right',
|
x_align = 'right',
|
||||||
|
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,
|
||||||
|
@ -350,6 +400,7 @@ M.initTextRows = function(x, y, w, spacing, labels)
|
||||||
y = y,
|
y = y,
|
||||||
spacing = spacing,
|
spacing = spacing,
|
||||||
x_align = 'left',
|
x_align = 'left',
|
||||||
|
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),
|
||||||
|
@ -359,6 +410,7 @@ M.initTextRows = function(x, y, w, spacing, labels)
|
||||||
y = y,
|
y = y,
|
||||||
spacing = spacing,
|
spacing = spacing,
|
||||||
x_align = 'right',
|
x_align = 'right',
|
||||||
|
y_align = 'center',
|
||||||
text_color = _G_Patterns_.PRIMARY_FG,
|
text_color = _G_Patterns_.PRIMARY_FG,
|
||||||
font_spec = M.normal_font_spec,
|
font_spec = M.normal_font_spec,
|
||||||
num_rows = #labels,
|
num_rows = #labels,
|
||||||
|
|
|
@ -79,6 +79,7 @@ local labels = _G_Widget_.TextColumn{
|
||||||
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',
|
||||||
'root',
|
'root',
|
||||||
'boot',
|
'boot',
|
||||||
'home',
|
'home',
|
||||||
|
|
|
@ -123,6 +123,7 @@ local cache = {
|
||||||
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',
|
||||||
'Page Cache',
|
'Page Cache',
|
||||||
'Buffers',
|
'Buffers',
|
||||||
'Kernel Slab'
|
'Kernel Slab'
|
||||||
|
@ -131,6 +132,7 @@ local cache = {
|
||||||
x = _RIGHT_X_,
|
x = _RIGHT_X_,
|
||||||
y = _LINE_1_Y_ + _TEXT_SPACING_,
|
y = _LINE_1_Y_ + _TEXT_SPACING_,
|
||||||
x_align = 'right',
|
x_align = 'right',
|
||||||
|
y_align = 'center',
|
||||||
append_end = ' %',
|
append_end = ' %',
|
||||||
text_color = _G_Patterns_.SECONDARY_FG,
|
text_color = _G_Patterns_.SECONDARY_FG,
|
||||||
font_spec = Common.normal_font_spec,
|
font_spec = Common.normal_font_spec,
|
||||||
|
|
Loading…
Reference in New Issue