2021-07-29 22:18:29 -04:00
|
|
|
local common = require 'common'
|
|
|
|
local geometry = require 'geometry'
|
2017-07-19 00:36:15 -04:00
|
|
|
|
2021-07-18 00:06:49 -04:00
|
|
|
return function()
|
|
|
|
local TEXT_SPACING = 20
|
|
|
|
|
|
|
|
local __string_match = string.match
|
|
|
|
local __string_gmatch = string.gmatch
|
|
|
|
|
2021-07-29 23:04:39 -04:00
|
|
|
local header = common.make_header(
|
2021-07-29 22:18:29 -04:00
|
|
|
geometry.RIGHT_X,
|
|
|
|
geometry.TOP_Y,
|
|
|
|
geometry.SECTION_WIDTH,
|
2021-07-18 00:06:49 -04:00
|
|
|
'PACMAN'
|
|
|
|
)
|
|
|
|
|
2021-07-29 23:04:39 -04:00
|
|
|
local rows = common.make_text_rows(
|
2021-07-29 22:18:29 -04:00
|
|
|
geometry.RIGHT_X,
|
2021-07-18 00:06:49 -04:00
|
|
|
header.bottom_y,
|
2021-07-29 22:18:29 -04:00
|
|
|
geometry.SECTION_WIDTH,
|
2021-07-18 00:06:49 -04:00
|
|
|
TEXT_SPACING,
|
|
|
|
{'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'}
|
|
|
|
)
|
|
|
|
|
2021-07-26 23:45:54 -04:00
|
|
|
local update = function(pacman_stats)
|
2021-07-18 00:06:49 -04:00
|
|
|
local stats = __string_match(pacman_stats, '%d+%s+[^%s]+%s+[^%s]+%s+(.*)$')
|
|
|
|
if stats then
|
|
|
|
local i = 1
|
|
|
|
for v in __string_gmatch(stats, '%d+') do
|
2021-07-29 22:18:29 -04:00
|
|
|
common.text_rows_set(rows, i, v)
|
2021-07-18 00:06:49 -04:00
|
|
|
i = i + 1
|
|
|
|
end
|
|
|
|
else
|
|
|
|
for i=1, 5 do
|
2021-07-29 22:18:29 -04:00
|
|
|
common.text_rows_set(rows, i, 'N/A')
|
2021-07-18 00:06:49 -04:00
|
|
|
end
|
2019-10-10 22:52:49 -04:00
|
|
|
end
|
|
|
|
end
|
2017-07-19 00:36:15 -04:00
|
|
|
|
2021-07-18 00:06:49 -04:00
|
|
|
local draw_static = function(cr)
|
2021-07-29 23:04:39 -04:00
|
|
|
common.draw_header(cr, header)
|
2021-07-29 22:18:29 -04:00
|
|
|
common.text_rows_draw_static(rows, cr)
|
2021-07-18 00:06:49 -04:00
|
|
|
end
|
2018-08-05 11:22:07 -04:00
|
|
|
|
2021-07-27 23:47:26 -04:00
|
|
|
local draw_dynamic = function(cr)
|
2021-07-29 22:18:29 -04:00
|
|
|
common.text_rows_draw_dynamic(rows, cr)
|
2021-07-18 00:06:49 -04:00
|
|
|
end
|
2017-07-19 00:36:15 -04:00
|
|
|
|
2021-07-27 23:47:26 -04:00
|
|
|
return {static = draw_static, dynamic = draw_dynamic, update = update}
|
2021-07-17 00:17:22 -04:00
|
|
|
end
|