REF update core

This commit is contained in:
Nathan Dwarshuis 2021-08-08 18:19:37 -04:00
parent 7112878934
commit 75216dd660
6 changed files with 56 additions and 56 deletions

2
core

@ -1 +1 @@
Subproject commit aed6053cb838fc9a5d8cda8d355ea61f03e32c3f Subproject commit 269053d225210b16ce6faef9d30885a11c93de55

View File

@ -5,18 +5,18 @@ local format = require 'format'
local theme = require 'theme' local theme = require 'theme'
local dial = require 'dial' local dial = require 'dial'
local rect = require 'rect' local rect = require 'rect'
local fillrect = require 'fillrect' local fill_rect = require 'fill_rect'
local compounddial = require 'compounddial' local compound_dial = require 'compound_dial'
local arc = require 'arc' local arc = require 'arc'
local circle = require 'circle' local circle = require 'circle'
local text = require 'text' local text = require 'text'
local tbl = require 'texttable' local tbl = require 'text_table'
local compoundbar = require 'compoundbar' local compound_bar = require 'compound_bar'
local thresholdtext = require 'thresholdtext' local text_threshold = require 'text_threshold'
local textcolumn = require 'textcolumn' local text_column = require 'text_column'
local line = require 'line' local line = require 'line'
local timeseries = require 'timeseries' local timeseries = require 'timeseries'
local scaledtimeseries = require 'scaledtimeseries' local scaled_timeseries = require 'scaled_timeseries'
local style = require 'style' local style = require 'style'
local source = require 'source' local source = require 'source'
@ -136,12 +136,12 @@ end
local _make_tagged_percent_timeseries = function(x, y, w, h, spacing, label, update_freq, format) local _make_tagged_percent_timeseries = function(x, y, w, h, spacing, label, update_freq, format)
return { return {
label = _left_text(geom.make_point(x, y), label), label = _left_text(geom.make_point(x, y), label),
value = thresholdtext.make_formatted( value = text_threshold.make_formatted(
geom.make_point(x + w, y), geom.make_point(x + w, y),
nil, nil,
_right_text_style, _right_text_style,
format, format,
thresholdtext.config(theme.CRITICAL_FG, 80) text_threshold.config(theme.CRITICAL_FG, 80)
), ),
plot = M.make_percent_timeseries( plot = M.make_percent_timeseries(
x, x,
@ -157,11 +157,11 @@ end
-- scaled timeseries helper functions -- scaled timeseries helper functions
local _base_2_scale_data = function(m) local _base_2_scale_data = function(m)
return scaledtimeseries.scaling_parameters(2, m, 0.9) return scaled_timeseries.scaling_parameters(2, m, 0.9)
end end
local _make_scaled_timeseries = function(x, y, w, h, f, min_domain, update_freq) local _make_scaled_timeseries = function(x, y, w, h, f, min_domain, update_freq)
return scaledtimeseries.make( return scaled_timeseries.make(
geom.make_box(x, y, w, h), geom.make_box(x, y, w, h),
update_freq, update_freq,
_default_plot_config, _default_plot_config,
@ -232,7 +232,7 @@ M.tagged_percent_timeseries_draw_static = function(pp, cr)
end end
M.tagged_percent_timeseries_draw_dynamic = function(obj, cr) M.tagged_percent_timeseries_draw_dynamic = function(obj, cr)
thresholdtext.draw(obj.value, cr) text_threshold.draw(obj.value, cr)
timeseries.draw_dynamic(obj.plot, cr) timeseries.draw_dynamic(obj.plot, cr)
end end
@ -305,12 +305,12 @@ end
M.tagged_scaled_timeseries_draw_dynamic = function(asp, cr) M.tagged_scaled_timeseries_draw_dynamic = function(asp, cr)
text.draw(asp.value, cr) text.draw(asp.value, cr)
scaledtimeseries.draw_dynamic(asp.plot, cr) scaled_timeseries.draw_dynamic(asp.plot, cr)
end end
M.tagged_scaled_timeseries_set = function(asp, value) M.tagged_scaled_timeseries_set = function(asp, value)
text.set(asp.value, value) text.set(asp.value, value)
scaledtimeseries.update(asp.plot, value) scaled_timeseries.update(asp.plot, value)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -346,7 +346,7 @@ end
M.update_rate_timeseries = function(obj, value) M.update_rate_timeseries = function(obj, value)
local rate = obj.derive(obj.prev_value, value) local rate = obj.derive(obj.prev_value, value)
text.set(obj.value, rate) text.set(obj.value, rate)
scaledtimeseries.update(obj.plot, rate) scaled_timeseries.update(obj.plot, rate)
obj.prev_value = value obj.prev_value = value
end end
@ -366,12 +366,12 @@ end
M.make_text_circle = function(x, y, r, fmt, limit) M.make_text_circle = function(x, y, r, fmt, limit)
return { return {
ring = M.make_circle(x, y, r), ring = M.make_circle(x, y, r),
value = thresholdtext.make_formatted( value = text_threshold.make_formatted(
geom.make_point(x, y), geom.make_point(x, y),
0, 0,
text.config(normal_font_spec, theme.PRIMARY_FG, 'center', 'center'), text.config(normal_font_spec, theme.PRIMARY_FG, 'center', 'center'),
fmt, fmt,
thresholdtext.config(theme.CRITICAL_FG, limit) text_threshold.config(theme.CRITICAL_FG, limit)
), ),
} }
end end
@ -381,11 +381,11 @@ M.text_circle_draw_static = function(tr, cr)
end end
M.text_circle_draw_dynamic = function(tr, cr) M.text_circle_draw_dynamic = function(tr, cr)
thresholdtext.draw(tr.value, cr) text_threshold.draw(tr.value, cr)
end end
M.text_circle_set = function(tr, value) M.text_circle_set = function(tr, value)
thresholdtext.set(tr.value, value) text_threshold.set(tr.value, value)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -430,7 +430,7 @@ end
M.make_compound_dial = function(x, y, outer_radius, inner_radius, thickness, M.make_compound_dial = function(x, y, outer_radius, inner_radius, thickness,
threshold, num_dials) threshold, num_dials)
return compounddial.make( return compound_dial.make(
geom.make_arc(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1), geom.make_arc(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1),
arc.config(style.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG), arc.config(style.line(thickness, CAIRO_LINE_CAP_BUTT), theme.INDICATOR_BG),
threshold_indicator(threshold), threshold_indicator(threshold),
@ -444,14 +444,14 @@ end
M.make_compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold) M.make_compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold)
return { return {
labels = textcolumn.make( labels = text_column.make(
geom.make_point(x, y), geom.make_point(x, y),
labels, labels,
_left_text_style, _left_text_style,
nil, nil,
spacing spacing
), ),
bars = compoundbar.make( bars = compound_bar.make(
geom.make_point(x + pad, y), geom.make_point(x + pad, y),
w - pad, w - pad,
line.config( line.config(
@ -468,16 +468,16 @@ M.make_compound_bar = function(x, y, w, pad, labels, spacing, thickness, thresho
end end
M.compound_bar_draw_static = function(cb, cr) M.compound_bar_draw_static = function(cb, cr)
textcolumn.draw(cb.labels, cr) text_column.draw(cb.labels, cr)
compoundbar.draw_static(cb.bars, cr) compound_bar.draw_static(cb.bars, cr)
end end
M.compound_bar_draw_dynamic = function(cb, cr) M.compound_bar_draw_dynamic = function(cb, cr)
compoundbar.draw_dynamic(cb.bars, cr) compound_bar.draw_dynamic(cb.bars, cr)
end end
M.compound_bar_set = function(cb, i, value) M.compound_bar_set = function(cb, i, value)
compoundbar.set(cb.bars, i, value) compound_bar.set(cb.bars, i, value)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -522,12 +522,12 @@ end
M.make_threshold_text_row = function(x, y, w, label, append_end, limit) M.make_threshold_text_row = function(x, y, w, label, append_end, limit)
return{ return{
label = _left_text(geom.make_point(x, y), label), label = _left_text(geom.make_point(x, y), label),
value = thresholdtext.make_formatted( value = text_threshold.make_formatted(
geom.make_point(x + w, y), geom.make_point(x + w, y),
nil, nil,
_right_text_style, _right_text_style,
append_end, append_end,
thresholdtext.config(theme.CRITICAL_FG, limit) text_threshold.config(theme.CRITICAL_FG, limit)
) )
} }
end end
@ -535,11 +535,11 @@ end
M.threshold_text_row_draw_static = M.text_row_draw_static M.threshold_text_row_draw_static = M.text_row_draw_static
M.threshold_text_row_draw_dynamic = function(row, cr) M.threshold_text_row_draw_dynamic = function(row, cr)
thresholdtext.draw(row.value, cr) text_threshold.draw(row.value, cr)
end end
M.threshold_text_row_set = function(row, value) M.threshold_text_row_set = function(row, value)
thresholdtext.set(row.value, value) text_threshold.set(row.value, value)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -547,14 +547,14 @@ end
M.make_text_rows_formatted = function(x, y, w, spacing, labels, format) M.make_text_rows_formatted = function(x, y, w, spacing, labels, format)
return { return {
labels = textcolumn.make( labels = text_column.make(
geom.make_point(x, y), geom.make_point(x, y),
labels, labels,
_left_text_style, _left_text_style,
nil, nil,
spacing spacing
), ),
values = textcolumn.make_n( values = text_column.make_n(
geom.make_point(x + w, y), geom.make_point(x + w, y),
#labels, #labels,
_right_text_style, _right_text_style,
@ -577,15 +577,15 @@ M.make_text_rows = function(x, y, w, spacing, labels)
end end
M.text_rows_draw_static = function(rows, cr) M.text_rows_draw_static = function(rows, cr)
textcolumn.draw(rows.labels, cr) text_column.draw(rows.labels, cr)
end end
M.text_rows_draw_dynamic = function(rows, cr) M.text_rows_draw_dynamic = function(rows, cr)
textcolumn.draw(rows.values, cr) text_column.draw(rows.values, cr)
end end
M.text_rows_set = function(rows, i, value) M.text_rows_set = function(rows, i, value)
textcolumn.set(rows.values, i, value) text_column.set(rows.values, i, value)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -639,7 +639,7 @@ end
-- panel -- panel
M.make_panel = function(x, y, w, h, thickness) M.make_panel = function(x, y, w, h, thickness)
return fillrect.make( return fill_rect.make(
geom.make_box(x, y, w, h), geom.make_box(x, y, w, h),
rect.config( rect.config(
style.closed_poly(thickness, CAIRO_LINE_JOIN_MITER), style.closed_poly(thickness, CAIRO_LINE_JOIN_MITER),

View File

@ -1,5 +1,5 @@
local timeseries = require 'timeseries' local timeseries = require 'timeseries'
local texttable = require 'texttable' local text_table = require 'text_table'
local i_o = require 'i_o' local i_o = require 'i_o'
local common = require 'common' local common = require 'common'
local geometry = require 'geometry' local geometry = require 'geometry'
@ -161,9 +161,9 @@ return function(update_freq)
timeseries.update(plot, used_percent) timeseries.update(plot, used_percent)
for r = 1, NUM_ROWS do for r = 1, NUM_ROWS do
texttable.set(tbl, 1, r, i_o.conky(TABLE_CONKY[r].comm, '(%S+)')) text_table.set(tbl, 1, r, i_o.conky(TABLE_CONKY[r].comm, '(%S+)'))
texttable.set(tbl, 2, r, i_o.conky(TABLE_CONKY[r].pid)) text_table.set(tbl, 2, r, i_o.conky(TABLE_CONKY[r].pid))
texttable.set(tbl, 3, r, i_o.conky(TABLE_CONKY[r].mem)) text_table.set(tbl, 3, r, i_o.conky(TABLE_CONKY[r].mem))
end end
end end
@ -173,7 +173,7 @@ return function(update_freq)
common.dial_draw_static(swap, cr) common.dial_draw_static(swap, cr)
common.text_rows_draw_static(cache, cr) common.text_rows_draw_static(cache, cr)
timeseries.draw_static(plot, cr) timeseries.draw_static(plot, cr)
texttable.draw_static(tbl, cr) text_table.draw_static(tbl, cr)
end end
local draw_dynamic = function(cr) local draw_dynamic = function(cr)
@ -181,7 +181,7 @@ return function(update_freq)
common.dial_draw_dynamic(swap, cr) common.dial_draw_dynamic(swap, cr)
common.text_rows_draw_dynamic(cache, cr) common.text_rows_draw_dynamic(cache, cr)
timeseries.draw_dynamic(plot, cr) timeseries.draw_dynamic(plot, cr)
texttable.draw_dynamic(tbl, cr) text_table.draw_dynamic(tbl, cr)
end end
return {dynamic = draw_dynamic, static = draw_static, update = update} return {dynamic = draw_dynamic, static = draw_static, update = update}

View File

@ -1,6 +1,6 @@
local compounddial = require 'compounddial' local compound_dial = require 'compound_dial'
local line = require 'line' local line = require 'line'
local texttable = require 'texttable' local text_table = require 'text_table'
local i_o = require 'i_o' local i_o = require 'i_o'
local common = require 'common' local common = require 'common'
local geometry = require 'geometry' local geometry = require 'geometry'
@ -141,7 +141,7 @@ return function(update_freq)
for _, load_data in pairs(cpu_loads) do for _, load_data in pairs(cpu_loads) do
local cur = load_data.percent_active local cur = load_data.percent_active
load_sum = load_sum + cur load_sum = load_sum + cur
compounddial.set(cores[load_data.conky_core_id].loads, load_data.conky_thread_id, cur) compound_dial.set(cores[load_data.conky_core_id].loads, load_data.conky_thread_id, cur)
end end
for conky_core_id, path in pairs(coretemp_paths) do for conky_core_id, path in pairs(coretemp_paths) do
@ -162,9 +162,9 @@ return function(update_freq)
for r = 1, NUM_ROWS do for r = 1, NUM_ROWS do
local pid = i_o.conky(TABLE_CONKY[r].pid, '(%d+)') -- may have leading spaces local pid = i_o.conky(TABLE_CONKY[r].pid, '(%d+)') -- may have leading spaces
if pid ~= '' then if pid ~= '' then
texttable.set(tbl, 1, r, i_o.read_file('/proc/'..pid..'/comm', '(%C+)')) text_table.set(tbl, 1, r, i_o.read_file('/proc/'..pid..'/comm', '(%C+)'))
texttable.set(tbl, 2, r, pid) text_table.set(tbl, 2, r, pid)
texttable.set(tbl, 3, r, i_o.conky(TABLE_CONKY[r].cpu)) text_table.set(tbl, 3, r, i_o.conky(TABLE_CONKY[r].cpu))
end end
end end
end end
@ -174,7 +174,7 @@ return function(update_freq)
for i = 1, #cores do for i = 1, #cores do
common.text_circle_draw_static(cores[i].coretemp, cr) common.text_circle_draw_static(cores[i].coretemp, cr)
compounddial.draw_static(cores[i].loads, cr) compound_dial.draw_static(cores[i].loads, cr)
end end
common.text_rows_draw_static(cpu_status, cr) common.text_rows_draw_static(cpu_status, cr)
@ -182,19 +182,19 @@ return function(update_freq)
common.tagged_percent_timeseries_draw_static(total_load, cr) common.tagged_percent_timeseries_draw_static(total_load, cr)
texttable.draw_static(tbl, cr) text_table.draw_static(tbl, cr)
end end
local draw_dynamic = function(cr) local draw_dynamic = function(cr)
for i = 1, #cores do for i = 1, #cores do
compounddial.draw_dynamic(cores[i].loads, cr) compound_dial.draw_dynamic(cores[i].loads, cr)
common.text_circle_draw_dynamic(cores[i].coretemp, cr) common.text_circle_draw_dynamic(cores[i].coretemp, cr)
end end
common.text_rows_draw_dynamic(cpu_status, cr) common.text_rows_draw_dynamic(cpu_status, cr)
common.tagged_percent_timeseries_draw_dynamic(total_load, cr) common.tagged_percent_timeseries_draw_dynamic(total_load, cr)
texttable.draw_dynamic(tbl, cr) text_table.draw_dynamic(tbl, cr)
end end
return {static = draw_static, dynamic = draw_dynamic, update = update} return {static = draw_static, dynamic = draw_dynamic, update = update}

View File

@ -1,6 +1,6 @@
local common = require 'common' local common = require 'common'
local geometry = require 'geometry' local geometry = require 'geometry'
local fillrect = require 'fillrect' local fill_rect = require 'fill_rect'
return function(left_modules, center_modules, right_modules) return function(left_modules, center_modules, right_modules)
local __cairo_set_source_surface = cairo_set_source_surface local __cairo_set_source_surface = cairo_set_source_surface
@ -26,7 +26,7 @@ return function(left_modules, center_modules, right_modules)
__cairo_translate(cr, -cs_x, -cs_y) __cairo_translate(cr, -cs_x, -cs_y)
fillrect.draw(panel, cr) fill_rect.draw(panel, cr)
for _, f in pairs(modules) do for _, f in pairs(modules) do
f(cr) f(cr)
end end

View File

@ -14,7 +14,7 @@ package.path = ABS_PATH..'?.lua;'..
ABS_PATH..'core/widget/text/?.lua;'.. ABS_PATH..'core/widget/text/?.lua;'..
ABS_PATH..'core/widget/timeseries/?.lua;'.. ABS_PATH..'core/widget/timeseries/?.lua;'..
ABS_PATH..'core/widget/rect/?.lua;'.. ABS_PATH..'core/widget/rect/?.lua;'..
ABS_PATH..'core/widget/poly/?.lua;' ABS_PATH..'core/widget/line/?.lua;'
local i_o = require 'i_o' local i_o = require 'i_o'
local system = require 'system' local system = require 'system'