REF don't build panels in module code
This commit is contained in:
parent
aebb40db59
commit
8b3244c727
|
@ -683,7 +683,7 @@ return function(config)
|
|||
style.closed_poly(thickness, CAIRO_LINE_JOIN_MITER),
|
||||
patterns.border
|
||||
),
|
||||
patterns.panel
|
||||
patterns.panel.bg
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -715,7 +715,12 @@ return function(config)
|
|||
return pure.map(function(b) return mk_block(table.unpack(b)) end, bs)
|
||||
end
|
||||
|
||||
local flatten_sections = function(top, ...)
|
||||
local mk_separator = function(width, x, y)
|
||||
local separator = M.make_separator(x, y, width)
|
||||
return M.mk_acc_static(width, 0, pure.partial(line.draw, separator))
|
||||
end
|
||||
|
||||
local flatten_sections = function(point, width, top, ...)
|
||||
local f = function(acc, new)
|
||||
if #new.blocks == 0 then
|
||||
return acc
|
||||
|
@ -723,26 +728,24 @@ return function(config)
|
|||
return new.blocks
|
||||
else
|
||||
return pure.flatten(
|
||||
{acc, {mk_block(new.sep_fun, true, new.top)}, new.blocks}
|
||||
{
|
||||
acc,
|
||||
{mk_block(pure.partial(mk_separator, width, point.x), true, new.top)},
|
||||
new.blocks
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
return pure.reduce(f, active_blocks(top), {...})
|
||||
end
|
||||
|
||||
M.mk_section = function(top, sep_fun, ...)
|
||||
M.mk_section = function(top, ...)
|
||||
return {
|
||||
top = top,
|
||||
sep_fun = sep_fun,
|
||||
blocks = active_blocks({...})
|
||||
}
|
||||
end
|
||||
|
||||
M.mk_seperator = function(width, x, y)
|
||||
local separator = M.make_separator(x, y, width)
|
||||
return M.mk_acc_static(width, 0, pure.partial(line.draw, separator))
|
||||
end
|
||||
|
||||
M.mk_acc = function(w, h, u, s, d)
|
||||
return {w = w, h = h, obj = {u, s, d}}
|
||||
end
|
||||
|
@ -760,7 +763,7 @@ return function(config)
|
|||
function(cr) M.draw_header(cr, obj) end
|
||||
)
|
||||
end
|
||||
local blocks = flatten_sections(top_blocks, ...)
|
||||
local blocks = flatten_sections(point, width, top_blocks, ...)
|
||||
local r = pure.reduce(
|
||||
_combine_blocks,
|
||||
{w = 0, next_y = point.y, final_y = point.y, objs = {}},
|
||||
|
|
|
@ -27,8 +27,6 @@ return function(config, main_state, common, width, point)
|
|||
)
|
||||
end
|
||||
|
||||
local mk_sep = pure.partial(common.mk_seperator, width, point.x)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- filesystem bar chart
|
||||
|
||||
|
@ -75,6 +73,6 @@ return function(config, main_state, common, width, point)
|
|||
width = width,
|
||||
update_wrapper = nil,
|
||||
top = {{mk_smart, config.show_smart, SEPARATOR_SPACING}},
|
||||
common.mk_section(SEPARATOR_SPACING, mk_sep, {mk_bars, true, 0})
|
||||
common.mk_section(SEPARATOR_SPACING, {mk_bars, true, 0})
|
||||
}
|
||||
end
|
||||
|
|
|
@ -71,12 +71,6 @@ return function(update_freq, config, common, width, point)
|
|||
return common.mk_acc(width, 0, update, static, dynamic)
|
||||
end
|
||||
|
||||
local mk_sep = pure.partial(
|
||||
common.mk_seperator,
|
||||
width,
|
||||
point.x
|
||||
)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- gpu temperature
|
||||
|
||||
|
@ -223,17 +217,14 @@ return function(update_freq, config, common, width, point)
|
|||
top = {{mk_status, true, SEPARATOR_SPACING}},
|
||||
common.mk_section(
|
||||
SEPARATOR_SPACING,
|
||||
mk_sep,
|
||||
{mk_temp, config.show_temp, SEPARATOR_SPACING}
|
||||
),
|
||||
common.mk_section(
|
||||
SEPARATOR_SPACING,
|
||||
mk_sep,
|
||||
{mk_clock, config.show_clock, SEPARATOR_SPACING}
|
||||
),
|
||||
common.mk_section(
|
||||
SEPARATOR_SPACING,
|
||||
mk_sep,
|
||||
{mk_gpu_util, config.show_gpu_util, PLOT_SEC_BREAK},
|
||||
{mk_mem_util, config.show_mem_util, PLOT_SEC_BREAK},
|
||||
{mk_vid_util, config.show_vid_util, 0}
|
||||
|
|
|
@ -131,15 +131,6 @@ return function(update_freq, config, main_state, common, width, point)
|
|||
)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- frequency
|
||||
|
||||
local mk_sep = pure.partial(
|
||||
common.mk_seperator,
|
||||
width,
|
||||
point.x
|
||||
)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- total load plot
|
||||
|
||||
|
@ -229,7 +220,6 @@ return function(update_freq, config, main_state, common, width, point)
|
|||
},
|
||||
common.mk_section(
|
||||
SEPARATOR_SPACING,
|
||||
mk_sep,
|
||||
{mk_load_plot, config.show_plot, TABLE_SECTION_BREAK},
|
||||
{mk_tbl, config.show_table, 0}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue