REF don't use widget module
This commit is contained in:
parent
5102b41e7b
commit
e399d19be0
2
core
2
core
|
@ -1 +1 @@
|
||||||
Subproject commit 7047ffe126f5866720d4932bcf538e9f72b4a02d
|
Subproject commit c6096a4221d45cf06f541f9c41a91ae8bfcc589b
|
|
@ -1,8 +1,8 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
local F = require 'Fundamental'
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Theme = require 'Patterns'
|
local Theme = require 'Patterns'
|
||||||
local Startup = require 'Widget'
|
|
||||||
local Dial = require 'Dial'
|
local Dial = require 'Dial'
|
||||||
local Rect = require 'Rect'
|
local Rect = require 'Rect'
|
||||||
local FillRect = require 'FillRect'
|
local FillRect = require 'FillRect'
|
||||||
|
@ -14,8 +14,8 @@ local CompoundBar = require 'CompoundBar'
|
||||||
local CriticalText = require 'CriticalText'
|
local CriticalText = require 'CriticalText'
|
||||||
local TextColumn = require 'TextColumn'
|
local TextColumn = require 'TextColumn'
|
||||||
local Line = require 'Line'
|
local Line = require 'Line'
|
||||||
local LabelPlot = require 'LabelPlot'
|
local Timeseries = require 'Timeseries'
|
||||||
local ScalePlot = require 'ScalePlot'
|
local ScaledTimeseries = require 'ScaledTimeseries'
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- constants
|
-- constants
|
||||||
|
@ -92,7 +92,7 @@ M.Header = function(x, y, w, s)
|
||||||
local underline_y = y + HEADER_UNDERLINE_OFFSET
|
local underline_y = y + HEADER_UNDERLINE_OFFSET
|
||||||
return {
|
return {
|
||||||
text = Text.build_plain(
|
text = Text.build_plain(
|
||||||
Startup.make_point(x, y),
|
F.make_point(x, y),
|
||||||
s,
|
s,
|
||||||
Text.style(
|
Text.style(
|
||||||
M.make_font_spec(FONT, HEADER_FONT_SIZE, true),
|
M.make_font_spec(FONT, HEADER_FONT_SIZE, true),
|
||||||
|
@ -103,8 +103,8 @@ M.Header = function(x, y, w, s)
|
||||||
),
|
),
|
||||||
bottom_y = bottom_y,
|
bottom_y = bottom_y,
|
||||||
underline = Line.build(
|
underline = Line.build(
|
||||||
Startup.make_point(x, underline_y),
|
F.make_point(x, underline_y),
|
||||||
Startup.make_point(x + w, underline_y),
|
F.make_point(x + w, underline_y),
|
||||||
Line.style(
|
Line.style(
|
||||||
HEADER_UNDERLINE_THICKNESS,
|
HEADER_UNDERLINE_THICKNESS,
|
||||||
Theme.HEADER_FG,
|
Theme.HEADER_FG,
|
||||||
|
@ -122,13 +122,13 @@ end
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- label plot
|
-- label plot
|
||||||
|
|
||||||
M.default_grid_style = Startup.grid_style(
|
M.default_grid_style = Timeseries.grid_style(
|
||||||
PLOT_GRID_X_N,
|
PLOT_GRID_X_N,
|
||||||
PLOT_GRID_Y_N,
|
PLOT_GRID_Y_N,
|
||||||
Theme.PLOT_GRID_FG
|
Theme.PLOT_GRID_FG
|
||||||
)
|
)
|
||||||
|
|
||||||
M.default_plot_style = Startup.plot_style(
|
M.default_plot_style = Timeseries.style(
|
||||||
PLOT_NUM_POINTS,
|
PLOT_NUM_POINTS,
|
||||||
Theme.PLOT_OUTLINE_FG,
|
Theme.PLOT_OUTLINE_FG,
|
||||||
Theme.PLOT_FILL_BORDER_PRIMARY,
|
Theme.PLOT_FILL_BORDER_PRIMARY,
|
||||||
|
@ -136,15 +136,15 @@ M.default_plot_style = Startup.plot_style(
|
||||||
M.default_grid_style
|
M.default_grid_style
|
||||||
)
|
)
|
||||||
|
|
||||||
M.percent_label_style = Startup.label_style(
|
M.percent_label_style = Timeseries.label_style(
|
||||||
Theme.INACTIVE_TEXT_FG,
|
Theme.INACTIVE_TEXT_FG,
|
||||||
M.label_font_spec,
|
M.label_font_spec,
|
||||||
function(_) return function(z) return Util.round_to_string(z * 100)..'%' end end
|
function(_) return function(z) return Util.round_to_string(z * 100)..'%' end end
|
||||||
)
|
)
|
||||||
|
|
||||||
M.initThemedLabelPlot = function(x, y, w, h, label_style, update_freq)
|
M.initThemedLabelPlot = function(x, y, w, h, label_style, update_freq)
|
||||||
return Startup.LabelPlot(
|
return Timeseries.build(
|
||||||
Startup.make_box(x, y, w, h),
|
F.make_box(x, y, w, h),
|
||||||
update_freq,
|
update_freq,
|
||||||
M.default_plot_style,
|
M.default_plot_style,
|
||||||
label_style
|
label_style
|
||||||
|
@ -156,9 +156,9 @@ end
|
||||||
|
|
||||||
M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, update_freq, format)
|
M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, update_freq, format)
|
||||||
return {
|
return {
|
||||||
label = _left_text(Startup.make_point(x, y), label),
|
label = _left_text(F.make_point(x, y), label),
|
||||||
value = CriticalText.build_formatted(
|
value = CriticalText.build_formatted(
|
||||||
Startup.make_point(x + w, y),
|
F.make_point(x + w, y),
|
||||||
nil,
|
nil,
|
||||||
M.right_text_style,
|
M.right_text_style,
|
||||||
format,
|
format,
|
||||||
|
@ -181,12 +181,12 @@ end
|
||||||
|
|
||||||
M.percent_plot_draw_static = function(pp, cr)
|
M.percent_plot_draw_static = function(pp, cr)
|
||||||
Text.draw(pp.label, cr)
|
Text.draw(pp.label, cr)
|
||||||
LabelPlot.draw_static(pp.plot, cr)
|
Timeseries.draw_static(pp.plot, cr)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.percent_plot_draw_dynamic = function(pp, cr)
|
M.percent_plot_draw_dynamic = function(pp, cr)
|
||||||
CriticalText.draw(pp.value, cr)
|
CriticalText.draw(pp.value, cr)
|
||||||
LabelPlot.draw_dynamic(pp.plot, cr)
|
Timeseries.draw_dynamic(pp.plot, cr)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO this is pretty confusing, nil means -1 which gets fed to any text
|
-- TODO this is pretty confusing, nil means -1 which gets fed to any text
|
||||||
|
@ -199,7 +199,7 @@ M.percent_plot_set = function(pp, cr, value)
|
||||||
p = value * 0.01
|
p = value * 0.01
|
||||||
end
|
end
|
||||||
Text.set(pp.value, cr, t)
|
Text.set(pp.value, cr, t)
|
||||||
LabelPlot.update(pp.plot, p)
|
Timeseries.update(pp.plot, p)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -234,15 +234,15 @@ M.converted_y_label_format_generator = function(unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.base_2_scale_data = function(m)
|
M.base_2_scale_data = function(m)
|
||||||
return Startup.scale_data(2, m, 0.9)
|
return ScaledTimeseries.scaling_parameters(2, m, 0.9)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.initThemedScalePlot = function(x, y, w, h, f, min_domain, update_freq)
|
M.initThemedScalePlot = function(x, y, w, h, f, min_domain, update_freq)
|
||||||
return Startup.ScalePlot(
|
return ScaledTimeseries.build(
|
||||||
Startup.make_box(x, y, w, h),
|
F.make_box(x, y, w, h),
|
||||||
update_freq,
|
update_freq,
|
||||||
M.default_plot_style,
|
M.default_plot_style,
|
||||||
Startup.label_style(
|
Timeseries.label_style(
|
||||||
Theme.INACTIVE_TEXT_FG,
|
Theme.INACTIVE_TEXT_FG,
|
||||||
M.label_font_spec,
|
M.label_font_spec,
|
||||||
f
|
f
|
||||||
|
@ -257,9 +257,9 @@ end
|
||||||
M.initLabeledScalePlot = function(x, y, w, h, format_fun, label_fun, spacing,
|
M.initLabeledScalePlot = function(x, y, w, h, format_fun, label_fun, spacing,
|
||||||
label, min_domain, update_freq)
|
label, min_domain, update_freq)
|
||||||
return {
|
return {
|
||||||
label = _left_text(Startup.make_point(x, y), label),
|
label = _left_text(F.make_point(x, y), label),
|
||||||
value = Text.build_formatted(
|
value = Text.build_formatted(
|
||||||
Startup.make_point(x + w, y),
|
F.make_point(x + w, y),
|
||||||
0,
|
0,
|
||||||
M.right_text_style,
|
M.right_text_style,
|
||||||
format_fun
|
format_fun
|
||||||
|
@ -274,12 +274,12 @@ end
|
||||||
|
|
||||||
M.annotated_scale_plot_draw_dynamic = function(asp, cr)
|
M.annotated_scale_plot_draw_dynamic = function(asp, cr)
|
||||||
Text.draw(asp.value, cr)
|
Text.draw(asp.value, cr)
|
||||||
ScalePlot.draw_dynamic(asp.plot, cr)
|
ScaledTimeseries.draw_dynamic(asp.plot, cr)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.annotated_scale_plot_set = function(asp, cr, value)
|
M.annotated_scale_plot_set = function(asp, cr, value)
|
||||||
Text.set(asp.value, cr, value)
|
Text.set(asp.value, cr, value)
|
||||||
ScalePlot.update(asp.plot, cr, value)
|
ScaledTimeseries.update(asp.plot, cr, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -290,7 +290,7 @@ end
|
||||||
|
|
||||||
M.arc = function(x, y, r, thickness, pattern)
|
M.arc = function(x, y, r, thickness, pattern)
|
||||||
return Arc.build(
|
return Arc.build(
|
||||||
Startup.make_semicircle(x, y, r, 90, 360),
|
F.make_semicircle(x, y, r, 90, 360),
|
||||||
Arc.style(thickness, pattern)
|
Arc.style(thickness, pattern)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -300,7 +300,7 @@ end
|
||||||
|
|
||||||
M.initRing = function(x, y, r)
|
M.initRing = function(x, y, r)
|
||||||
return Arc.build(
|
return Arc.build(
|
||||||
Startup.make_semicircle(x, y, r, 0, 360),
|
F.make_semicircle(x, y, r, 0, 360),
|
||||||
Arc.style(ARC_WIDTH, Theme.BORDER_FG)
|
Arc.style(ARC_WIDTH, Theme.BORDER_FG)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -312,7 +312,7 @@ M.initTextRing = function(x, y, r, fmt, limit)
|
||||||
return {
|
return {
|
||||||
ring = M.initRing(x, y, r),
|
ring = M.initRing(x, y, r),
|
||||||
value = CriticalText.build_formatted(
|
value = CriticalText.build_formatted(
|
||||||
Startup.make_point(x, y),
|
F.make_point(x, y),
|
||||||
nil,
|
nil,
|
||||||
Text.style(
|
Text.style(
|
||||||
M.normal_font_spec,
|
M.normal_font_spec,
|
||||||
|
@ -342,7 +342,7 @@ end
|
||||||
-- dial
|
-- dial
|
||||||
|
|
||||||
local threshold_indicator = function(threshold)
|
local threshold_indicator = function(threshold)
|
||||||
return Startup.threshold_style(
|
return F.threshold_style(
|
||||||
Theme.INDICATOR_FG_PRIMARY,
|
Theme.INDICATOR_FG_PRIMARY,
|
||||||
Theme.INDICATOR_FG_CRITICAL,
|
Theme.INDICATOR_FG_CRITICAL,
|
||||||
threshold
|
threshold
|
||||||
|
@ -351,7 +351,7 @@ end
|
||||||
|
|
||||||
M.dial = function(x, y, radius, thickness, threshold)
|
M.dial = function(x, y, radius, thickness, threshold)
|
||||||
return Dial.build(
|
return Dial.build(
|
||||||
Startup.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1),
|
F.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1),
|
||||||
Arc.style(thickness, Theme.INDICATOR_BG),
|
Arc.style(thickness, Theme.INDICATOR_BG),
|
||||||
threshold_indicator(threshold)
|
threshold_indicator(threshold)
|
||||||
)
|
)
|
||||||
|
@ -363,7 +363,7 @@ end
|
||||||
M.compound_dial = function(x, y, outer_radius, inner_radius, thickness,
|
M.compound_dial = function(x, y, outer_radius, inner_radius, thickness,
|
||||||
threshold, num_dials)
|
threshold, num_dials)
|
||||||
return CompoundDial.build(
|
return CompoundDial.build(
|
||||||
Startup.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1),
|
F.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1),
|
||||||
Arc.style(thickness, Theme.INDICATOR_BG),
|
Arc.style(thickness, Theme.INDICATOR_BG),
|
||||||
threshold_indicator(threshold),
|
threshold_indicator(threshold),
|
||||||
inner_radius,
|
inner_radius,
|
||||||
|
@ -377,14 +377,14 @@ end
|
||||||
M.compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold)
|
M.compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold)
|
||||||
return {
|
return {
|
||||||
labels = TextColumn.build(
|
labels = TextColumn.build(
|
||||||
Startup.make_point(x, y),
|
F.make_point(x, y),
|
||||||
labels,
|
labels,
|
||||||
M.left_text_style,
|
M.left_text_style,
|
||||||
nil,
|
nil,
|
||||||
spacing
|
spacing
|
||||||
),
|
),
|
||||||
bars = CompoundBar.build(
|
bars = CompoundBar.build(
|
||||||
Startup.make_point(x + pad, y),
|
F.make_point(x + pad, y),
|
||||||
w - pad,
|
w - pad,
|
||||||
Line.style(
|
Line.style(
|
||||||
thickness,
|
thickness,
|
||||||
|
@ -417,8 +417,8 @@ end
|
||||||
|
|
||||||
M.initSeparator = function(x, y, w)
|
M.initSeparator = function(x, y, w)
|
||||||
return Line.build(
|
return Line.build(
|
||||||
Startup.make_point(x, y),
|
F.make_point(x, y),
|
||||||
Startup.make_point(x + w, y),
|
F.make_point(x + w, y),
|
||||||
Line.style(
|
Line.style(
|
||||||
SEPARATOR_THICKNESS,
|
SEPARATOR_THICKNESS,
|
||||||
Theme.BORDER_FG,
|
Theme.BORDER_FG,
|
||||||
|
@ -432,8 +432,8 @@ end
|
||||||
|
|
||||||
M.initTextRow = function(x, y, w, label)
|
M.initTextRow = function(x, y, w, label)
|
||||||
return {
|
return {
|
||||||
label = _left_text(Startup.make_point(x, y), label),
|
label = _left_text(F.make_point(x, y), label),
|
||||||
value = _right_text(Startup.make_point(x + w, y), nil),
|
value = _right_text(F.make_point(x + w, y), nil),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -454,9 +454,9 @@ end
|
||||||
|
|
||||||
M.initTextRowCrit = function(x, y, w, label, append_end, limit)
|
M.initTextRowCrit = function(x, y, w, label, append_end, limit)
|
||||||
return{
|
return{
|
||||||
label = _left_text(Startup.make_point(x, y), label),
|
label = _left_text(F.make_point(x, y), label),
|
||||||
value = CriticalText.build_formatted(
|
value = CriticalText.build_formatted(
|
||||||
Startup.make_point(x + w, y),
|
F.make_point(x + w, y),
|
||||||
nil,
|
nil,
|
||||||
Text.style(
|
Text.style(
|
||||||
M.normal_font_spec,
|
M.normal_font_spec,
|
||||||
|
@ -484,8 +484,8 @@ end
|
||||||
-- text column
|
-- text column
|
||||||
|
|
||||||
M.text_column = function(x, y, spacing, labels, x_align, color)
|
M.text_column = function(x, y, spacing, labels, x_align, color)
|
||||||
return Startup.TextColumn(
|
return TextColumn.build(
|
||||||
Startup.make_point(x, y),
|
F.make_point(x, y),
|
||||||
labels,
|
labels,
|
||||||
_text_row_style(x_align, color),
|
_text_row_style(x_align, color),
|
||||||
nil,
|
nil,
|
||||||
|
@ -499,14 +499,14 @@ end
|
||||||
M.initTextRows_color = function(x, y, w, spacing, labels, color, format)
|
M.initTextRows_color = function(x, y, w, spacing, labels, color, format)
|
||||||
return {
|
return {
|
||||||
labels = TextColumn.build(
|
labels = TextColumn.build(
|
||||||
Startup.make_point(x, y),
|
F.make_point(x, y),
|
||||||
labels,
|
labels,
|
||||||
M.left_text_style,
|
M.left_text_style,
|
||||||
nil,
|
nil,
|
||||||
spacing
|
spacing
|
||||||
),
|
),
|
||||||
values = TextColumn.build_n(
|
values = TextColumn.build_n(
|
||||||
Startup.make_point(x + w, y),
|
F.make_point(x + w, y),
|
||||||
#labels,
|
#labels,
|
||||||
_text_row_style('right', color),
|
_text_row_style('right', color),
|
||||||
format,
|
format,
|
||||||
|
@ -575,7 +575,7 @@ M.default_table_style = Table.style(
|
||||||
Theme.INACTIVE_TEXT_FG,
|
Theme.INACTIVE_TEXT_FG,
|
||||||
TABLE_BODY_FORMAT
|
TABLE_BODY_FORMAT
|
||||||
),
|
),
|
||||||
Startup.padding(
|
F.padding(
|
||||||
TABLE_HORZ_PAD,
|
TABLE_HORZ_PAD,
|
||||||
TABLE_VERT_PAD,
|
TABLE_VERT_PAD,
|
||||||
TABLE_HORZ_PAD,
|
TABLE_HORZ_PAD,
|
||||||
|
@ -585,7 +585,7 @@ M.default_table_style = Table.style(
|
||||||
|
|
||||||
M.initTable = function(x, y, w, h, n, labels)
|
M.initTable = function(x, y, w, h, n, labels)
|
||||||
return Table.build(
|
return Table.build(
|
||||||
Startup.make_box(x, y, w, h),
|
F.make_box(x, y, w, h),
|
||||||
n,
|
n,
|
||||||
labels,
|
labels,
|
||||||
M.default_table_style
|
M.default_table_style
|
||||||
|
@ -597,7 +597,7 @@ end
|
||||||
|
|
||||||
M.initPanel = function(x, y, w, h, thickness)
|
M.initPanel = function(x, y, w, h, thickness)
|
||||||
return FillRect.build(
|
return FillRect.build(
|
||||||
Startup.make_box(x, y, w, h),
|
F.make_box(x, y, w, h),
|
||||||
Rect.style(thickness, Theme.BORDER_FG),
|
Rect.style(thickness, Theme.BORDER_FG),
|
||||||
Theme.PANEL_BG
|
Theme.PANEL_BG
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local Dial = require 'Dial'
|
local Dial = require 'Dial'
|
||||||
local LabelPlot = require 'LabelPlot'
|
local Timeseries = require 'Timeseries'
|
||||||
local Table = require 'Table'
|
local Table = require 'Table'
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
@ -149,7 +149,7 @@ return function(update_freq)
|
||||||
Common.text_rows_set(cache, cr, 3, Util.precision_round_to_string(
|
Common.text_rows_set(cache, cr, 3, Util.precision_round_to_string(
|
||||||
slab_reclaimable_kb / mem_total_kb * 100))
|
slab_reclaimable_kb / mem_total_kb * 100))
|
||||||
|
|
||||||
LabelPlot.update(plot, used_percent)
|
Timeseries.update(plot, used_percent)
|
||||||
|
|
||||||
for r = 1, NUM_ROWS do
|
for r = 1, NUM_ROWS do
|
||||||
Table.set(tbl, cr, 1, r, conky(TABLE_CONKY[r].comm, '(%S+)'))
|
Table.set(tbl, cr, 1, r, conky(TABLE_CONKY[r].comm, '(%S+)'))
|
||||||
|
@ -166,7 +166,7 @@ return function(update_freq)
|
||||||
|
|
||||||
Common.text_row_crit_draw_static(swap, cr)
|
Common.text_row_crit_draw_static(swap, cr)
|
||||||
Common.text_rows_draw_static(cache, cr)
|
Common.text_rows_draw_static(cache, cr)
|
||||||
LabelPlot.draw_static(plot, cr)
|
Timeseries.draw_static(plot, cr)
|
||||||
|
|
||||||
Table.draw_static(tbl, cr)
|
Table.draw_static(tbl, cr)
|
||||||
end
|
end
|
||||||
|
@ -180,7 +180,7 @@ return function(update_freq)
|
||||||
Common.text_row_crit_draw_dynamic(swap, cr)
|
Common.text_row_crit_draw_dynamic(swap, cr)
|
||||||
Common.text_rows_draw_dynamic(cache, cr)
|
Common.text_rows_draw_dynamic(cache, cr)
|
||||||
|
|
||||||
LabelPlot.draw_dynamic(plot, cr)
|
Timeseries.draw_dynamic(plot, cr)
|
||||||
|
|
||||||
Table.draw_dynamic(tbl, cr)
|
Table.draw_dynamic(tbl, cr)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue