ENH make all modules take point and return y
This commit is contained in:
parent
c5df3172a6
commit
3f6047d05d
2
core
2
core
|
@ -1 +1 @@
|
||||||
Subproject commit 1cc356773a496d9abd0a400094b7b732c390201d
|
Subproject commit 387195607eb3a481596b6da45ec0b12b5f3c97d1
|
|
@ -671,9 +671,10 @@ M.reduce_blocks_inner = function(f, y, blocks)
|
||||||
local r = pure.reduce(_combine_blocks, {y = y, objs = {}}, blocks)
|
local r = pure.reduce(_combine_blocks, {y = y, objs = {}}, blocks)
|
||||||
local us, ss, ds = table.unpack(pure.unzip(r.objs))
|
local us, ss, ds = table.unpack(pure.unzip(r.objs))
|
||||||
return {
|
return {
|
||||||
updater = f(table.unpack(non_false(pure.reverse(us)))),
|
y = r.y,
|
||||||
static_drawer = pure.sequence(table.unpack(ss)),
|
update = f(table.unpack(non_false(pure.reverse(us)))),
|
||||||
dynamic_drawer = pure.sequence(table.unpack(non_false(ds)))
|
static = pure.sequence(table.unpack(ss)),
|
||||||
|
dynamic = pure.sequence(table.unpack(non_false(ds)))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ local geometry = require 'geometry'
|
||||||
local pure = require 'pure'
|
local pure = require 'pure'
|
||||||
local impure = require 'impure'
|
local impure = require 'impure'
|
||||||
|
|
||||||
return function(pathspecs)
|
return function(pathspecs, point)
|
||||||
local MODULE_Y = 170
|
|
||||||
local SPACING = 20
|
local SPACING = 20
|
||||||
local BAR_PAD = 100
|
local BAR_PAD = 100
|
||||||
local SEPARATOR_SPACING = 20
|
local SEPARATOR_SPACING = 20
|
||||||
|
@ -17,7 +16,7 @@ return function(pathspecs)
|
||||||
common.mk_header,
|
common.mk_header,
|
||||||
'FILE SYSTEMS',
|
'FILE SYSTEMS',
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.RIGHT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -25,7 +24,7 @@ return function(pathspecs)
|
||||||
|
|
||||||
local mk_smart = function(y)
|
local mk_smart = function(y)
|
||||||
local obj = common.make_text_row(
|
local obj = common.make_text_row(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
'SMART Daemon'
|
'SMART Daemon'
|
||||||
|
@ -47,7 +46,7 @@ return function(pathspecs)
|
||||||
local mk_sep = pure.partial(
|
local mk_sep = pure.partial(
|
||||||
common.mk_seperator,
|
common.mk_seperator,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.RIGHT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -60,7 +59,7 @@ return function(pathspecs)
|
||||||
paths
|
paths
|
||||||
)
|
)
|
||||||
local obj = common.make_compound_bar(
|
local obj = common.make_compound_bar(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
BAR_PAD,
|
BAR_PAD,
|
||||||
|
@ -88,8 +87,8 @@ return function(pathspecs)
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- main functions
|
-- main functions
|
||||||
|
|
||||||
local rbs = common.reduce_blocks_(
|
return common.reduce_blocks_(
|
||||||
MODULE_Y,
|
point.y,
|
||||||
{
|
{
|
||||||
common.mk_block(mk_header, true, 0),
|
common.mk_block(mk_header, true, 0),
|
||||||
common.mk_block(mk_smart, true, 0),
|
common.mk_block(mk_smart, true, 0),
|
||||||
|
@ -97,10 +96,4 @@ return function(pathspecs)
|
||||||
common.mk_block(mk_bars, true, SEPARATOR_SPACING),
|
common.mk_block(mk_bars, true, SEPARATOR_SPACING),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
|
||||||
static = rbs.static_drawer,
|
|
||||||
dynamic = rbs.dynamic_drawer,
|
|
||||||
update = rbs.updater
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,8 +3,7 @@ local i_o = require 'i_o'
|
||||||
local common = require 'common'
|
local common = require 'common'
|
||||||
local geometry = require 'geometry'
|
local geometry = require 'geometry'
|
||||||
|
|
||||||
return function(update_freq)
|
return function(update_freq, point)
|
||||||
local MODULE_Y = 145
|
|
||||||
local SEPARATOR_SPACING = 20
|
local SEPARATOR_SPACING = 20
|
||||||
local TEXT_SPACING = 20
|
local TEXT_SPACING = 20
|
||||||
local PLOT_SEC_BREAK = 20
|
local PLOT_SEC_BREAK = 20
|
||||||
|
@ -28,7 +27,7 @@ return function(update_freq)
|
||||||
|
|
||||||
local _mk_plot = function(label, getter, y)
|
local _mk_plot = function(label, getter, y)
|
||||||
local obj = common.make_tagged_maybe_percent_timeseries(
|
local obj = common.make_tagged_maybe_percent_timeseries(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
PLOT_HEIGHT,
|
PLOT_HEIGHT,
|
||||||
|
@ -53,7 +52,7 @@ return function(update_freq)
|
||||||
common.mk_header,
|
common.mk_header,
|
||||||
'NVIDIA GRAPHICS',
|
'NVIDIA GRAPHICS',
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.LEFT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -61,7 +60,7 @@ return function(update_freq)
|
||||||
|
|
||||||
local mk_status = function(y)
|
local mk_status = function(y)
|
||||||
local obj = common.make_text_row(
|
local obj = common.make_text_row(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
'Status'
|
'Status'
|
||||||
|
@ -81,7 +80,7 @@ return function(update_freq)
|
||||||
local mk_sep = pure.partial(
|
local mk_sep = pure.partial(
|
||||||
common.mk_seperator,
|
common.mk_seperator,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.LEFT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -89,7 +88,7 @@ return function(update_freq)
|
||||||
|
|
||||||
local mk_temp = function(y)
|
local mk_temp = function(y)
|
||||||
local obj = common.make_threshold_text_row(
|
local obj = common.make_threshold_text_row(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
'Internal Temperature',
|
'Internal Temperature',
|
||||||
|
@ -113,7 +112,7 @@ return function(update_freq)
|
||||||
|
|
||||||
local mk_clock = function(y)
|
local mk_clock = function(y)
|
||||||
local obj = common.make_text_rows(
|
local obj = common.make_text_rows(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
TEXT_SPACING,
|
TEXT_SPACING,
|
||||||
|
@ -223,7 +222,7 @@ return function(update_freq)
|
||||||
-- main drawing functions
|
-- main drawing functions
|
||||||
|
|
||||||
local rbs = common.reduce_blocks_(
|
local rbs = common.reduce_blocks_(
|
||||||
MODULE_Y,
|
point.y,
|
||||||
{
|
{
|
||||||
common.mk_block(mk_header, true, 0),
|
common.mk_block(mk_header, true, 0),
|
||||||
common.mk_block(mk_status, true, 0),
|
common.mk_block(mk_status, true, 0),
|
||||||
|
@ -237,10 +236,5 @@ return function(update_freq)
|
||||||
common.mk_block(mk_vid_util, true, PLOT_SEC_BREAK)
|
common.mk_block(mk_vid_util, true, PLOT_SEC_BREAK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
return pure.map_at("update", function(f) return function() f(update_state()) end end, rbs)
|
||||||
return {
|
|
||||||
static = rbs.static_drawer,
|
|
||||||
dynamic = rbs.dynamic_drawer,
|
|
||||||
update = function() rbs.updater(update_state()) end
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,7 @@ local common = require 'common'
|
||||||
local geometry = require 'geometry'
|
local geometry = require 'geometry'
|
||||||
local pure = require 'pure'
|
local pure = require 'pure'
|
||||||
|
|
||||||
return function(update_freq)
|
return function(update_freq, point)
|
||||||
local MODULE_Y = 712
|
|
||||||
local DIAL_THICKNESS = 8
|
local DIAL_THICKNESS = 8
|
||||||
local DIAL_RADIUS = 32
|
local DIAL_RADIUS = 32
|
||||||
local DIAL_SPACING = 40
|
local DIAL_SPACING = 40
|
||||||
|
@ -28,18 +27,18 @@ return function(update_freq)
|
||||||
common.mk_header,
|
common.mk_header,
|
||||||
'MEMORY',
|
'MEMORY',
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.RIGHT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- mem stats (dial + text)
|
-- mem stats (dial + text)
|
||||||
|
|
||||||
local mk_stats = function(y)
|
local mk_stats = function(y)
|
||||||
local MEM_X = geometry.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS / 2
|
local MEM_X = point.x + DIAL_RADIUS + DIAL_THICKNESS / 2
|
||||||
local DIAL_DIAMETER = DIAL_RADIUS * 2 + DIAL_THICKNESS
|
local DIAL_DIAMETER = DIAL_RADIUS * 2 + DIAL_THICKNESS
|
||||||
local SWAP_X = MEM_X + DIAL_DIAMETER + DIAL_SPACING
|
local SWAP_X = MEM_X + DIAL_DIAMETER + DIAL_SPACING
|
||||||
local CACHE_X = SWAP_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2
|
local CACHE_X = SWAP_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2
|
||||||
local CACHE_WIDTH = geometry.RIGHT_X + geometry.SECTION_WIDTH - CACHE_X
|
local CACHE_WIDTH = point.x + geometry.SECTION_WIDTH - CACHE_X
|
||||||
local format_percent = function(x)
|
local format_percent = function(x)
|
||||||
return string.format('%i%%', x)
|
return string.format('%i%%', x)
|
||||||
end
|
end
|
||||||
|
@ -98,7 +97,7 @@ return function(update_freq)
|
||||||
|
|
||||||
local mk_plot = function(y)
|
local mk_plot = function(y)
|
||||||
local obj = common.make_percent_timeseries(
|
local obj = common.make_percent_timeseries(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
PLOT_HEIGHT,
|
PLOT_HEIGHT,
|
||||||
|
@ -127,7 +126,7 @@ return function(update_freq)
|
||||||
end,
|
end,
|
||||||
NUM_ROWS)
|
NUM_ROWS)
|
||||||
local obj = common.make_text_table(
|
local obj = common.make_text_table(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
TABLE_HEIGHT,
|
TABLE_HEIGHT,
|
||||||
|
@ -190,7 +189,7 @@ return function(update_freq)
|
||||||
-- main functions
|
-- main functions
|
||||||
|
|
||||||
local rbs = common.reduce_blocks_(
|
local rbs = common.reduce_blocks_(
|
||||||
MODULE_Y,
|
point.y,
|
||||||
{
|
{
|
||||||
common.mk_block(mk_header, true, 0),
|
common.mk_block(mk_header, true, 0),
|
||||||
common.mk_block(mk_stats, true, 0),
|
common.mk_block(mk_stats, true, 0),
|
||||||
|
@ -198,10 +197,5 @@ return function(update_freq)
|
||||||
common.mk_block(mk_tbl, true, TABLE_SECTION_BREAK),
|
common.mk_block(mk_tbl, true, TABLE_SECTION_BREAK),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
return pure.map_at("update", function(f) return function() f(read_state()) end end, rbs)
|
||||||
return {
|
|
||||||
static = rbs.static_drawer,
|
|
||||||
dynamic = rbs.dynamic_drawer,
|
|
||||||
update = function() rbs.updater(read_state()) end,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ local common = require 'common'
|
||||||
local geometry = require 'geometry'
|
local geometry = require 'geometry'
|
||||||
local sys = require 'sys'
|
local sys = require 'sys'
|
||||||
|
|
||||||
return function(update_freq)
|
return function(update_freq, point)
|
||||||
local PLOT_SEC_BREAK = 20
|
local PLOT_SEC_BREAK = 20
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_HEIGHT = 56
|
||||||
local INTERFACE_PATHS = sys.get_net_interface_paths()
|
local INTERFACE_PATHS = sys.get_net_interface_paths()
|
||||||
|
@ -33,7 +33,7 @@ return function(update_freq)
|
||||||
|
|
||||||
local make_plot = function(y, label, init)
|
local make_plot = function(y, label, init)
|
||||||
return common.make_rate_timeseries(
|
return common.make_rate_timeseries(
|
||||||
geometry.CENTER_RIGHT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
PLOT_HEIGHT,
|
PLOT_HEIGHT,
|
||||||
|
@ -51,8 +51,8 @@ return function(update_freq)
|
||||||
-- header
|
-- header
|
||||||
|
|
||||||
local header = common.make_header(
|
local header = common.make_header(
|
||||||
geometry.CENTER_RIGHT_X,
|
point.x,
|
||||||
geometry.TOP_Y,
|
point.y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
'NETWORK'
|
'NETWORK'
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
local common = require 'common'
|
local common = require 'common'
|
||||||
local geometry = require 'geometry'
|
local geometry = require 'geometry'
|
||||||
|
|
||||||
return function()
|
return function(point)
|
||||||
local TEXT_SPACING = 20
|
local TEXT_SPACING = 20
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
local __string_gmatch = string.gmatch
|
local __string_gmatch = string.gmatch
|
||||||
|
|
||||||
local header = common.make_header(
|
local header = common.make_header(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
geometry.TOP_Y,
|
point.y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
'PACMAN'
|
'PACMAN'
|
||||||
)
|
)
|
||||||
|
|
||||||
local rows = common.make_text_rows(
|
local rows = common.make_text_rows(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
TEXT_SPACING,
|
TEXT_SPACING,
|
||||||
|
|
|
@ -4,8 +4,7 @@ local common = require 'common'
|
||||||
local geometry = require 'geometry'
|
local geometry = require 'geometry'
|
||||||
local sys = require 'sys'
|
local sys = require 'sys'
|
||||||
|
|
||||||
return function(update_freq, battery)
|
return function(update_freq, battery, point)
|
||||||
local MODULE_Y = 380
|
|
||||||
local TEXT_SPACING = 20
|
local TEXT_SPACING = 20
|
||||||
local PLOT_SEC_BREAK = 20
|
local PLOT_SEC_BREAK = 20
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_HEIGHT = 56
|
||||||
|
@ -41,7 +40,7 @@ return function(update_freq, battery)
|
||||||
|
|
||||||
local mk_rate_plot = function(label, read, y)
|
local mk_rate_plot = function(label, read, y)
|
||||||
local obj = common.make_rate_timeseries(
|
local obj = common.make_rate_timeseries(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
PLOT_HEIGHT,
|
PLOT_HEIGHT,
|
||||||
|
@ -68,7 +67,7 @@ return function(update_freq, battery)
|
||||||
common.mk_header,
|
common.mk_header,
|
||||||
'POWER',
|
'POWER',
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.RIGHT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -94,7 +93,7 @@ return function(update_freq, battery)
|
||||||
|
|
||||||
local mk_bat = function(y)
|
local mk_bat = function(y)
|
||||||
local obj = common.make_tagged_scaled_timeseries(
|
local obj = common.make_tagged_scaled_timeseries(
|
||||||
geometry.RIGHT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
PLOT_HEIGHT,
|
PLOT_HEIGHT,
|
||||||
|
@ -118,8 +117,8 @@ return function(update_freq, battery)
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- main functions
|
-- main functions
|
||||||
|
|
||||||
local rbs = common.reduce_blocks_(
|
return common.reduce_blocks_(
|
||||||
MODULE_Y,
|
point.y,
|
||||||
{
|
{
|
||||||
common.mk_block(mk_header, true, 0),
|
common.mk_block(mk_header, true, 0),
|
||||||
common.mk_block(mk_pkg0, true, 0),
|
common.mk_block(mk_pkg0, true, 0),
|
||||||
|
@ -127,10 +126,4 @@ return function(update_freq, battery)
|
||||||
common.mk_block(mk_bat, true, TEXT_SPACING),
|
common.mk_block(mk_bat, true, TEXT_SPACING),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
|
||||||
static = rbs.static_drawer,
|
|
||||||
dynamic = rbs.dynamic_drawer,
|
|
||||||
update = rbs.updater
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,12 +8,11 @@ local pure = require 'pure'
|
||||||
|
|
||||||
local __math_floor = math.floor
|
local __math_floor = math.floor
|
||||||
|
|
||||||
return function(update_freq)
|
return function(update_freq, point)
|
||||||
-- local SHOW_DIALS = true
|
-- local SHOW_DIALS = true
|
||||||
-- local SHOW_TIMESERIES = true
|
-- local SHOW_TIMESERIES = true
|
||||||
-- local SHOW_TABLE = true
|
-- local SHOW_TABLE = true
|
||||||
|
|
||||||
local MODULE_Y = 614
|
|
||||||
local DIAL_INNER_RADIUS = 30
|
local DIAL_INNER_RADIUS = 30
|
||||||
local DIAL_OUTER_RADIUS = 42
|
local DIAL_OUTER_RADIUS = 42
|
||||||
local DIAL_THICKNESS = 5.5
|
local DIAL_THICKNESS = 5.5
|
||||||
|
@ -31,7 +30,7 @@ return function(update_freq)
|
||||||
common.mk_header,
|
common.mk_header,
|
||||||
'PROCESSOR',
|
'PROCESSOR',
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.LEFT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -78,7 +77,7 @@ return function(update_freq)
|
||||||
local cores = {}
|
local cores = {}
|
||||||
-- TODO what happens when the number of cores changes?
|
-- TODO what happens when the number of cores changes?
|
||||||
for c = 1, ncores do
|
for c = 1, ncores do
|
||||||
local dial_x = geometry.LEFT_X + DIAL_OUTER_RADIUS +
|
local dial_x = point.x + DIAL_OUTER_RADIUS +
|
||||||
(geometry.SECTION_WIDTH - 2 * DIAL_OUTER_RADIUS) * (c - 1) / 3
|
(geometry.SECTION_WIDTH - 2 * DIAL_OUTER_RADIUS) * (c - 1) / 3
|
||||||
local dial_y = y + DIAL_OUTER_RADIUS
|
local dial_y = y + DIAL_OUTER_RADIUS
|
||||||
cores[c] = create_core(dial_x, dial_y)
|
cores[c] = create_core(dial_x, dial_y)
|
||||||
|
@ -122,7 +121,7 @@ return function(update_freq)
|
||||||
local mk_hwp_freq = function(y)
|
local mk_hwp_freq = function(y)
|
||||||
local hwp_paths = cpu.get_hwp_paths()
|
local hwp_paths = cpu.get_hwp_paths()
|
||||||
local cpu_status = common.make_text_rows(
|
local cpu_status = common.make_text_rows(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
TEXT_SPACING,
|
TEXT_SPACING,
|
||||||
|
@ -149,7 +148,7 @@ return function(update_freq)
|
||||||
local mk_sep = pure.partial(
|
local mk_sep = pure.partial(
|
||||||
common.mk_seperator,
|
common.mk_seperator,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
geometry.LEFT_X
|
point.x
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -157,7 +156,7 @@ return function(update_freq)
|
||||||
|
|
||||||
local mk_load_plot = function(y)
|
local mk_load_plot = function(y)
|
||||||
local total_load = common.make_tagged_percent_timeseries(
|
local total_load = common.make_tagged_percent_timeseries(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
PLOT_HEIGHT,
|
PLOT_HEIGHT,
|
||||||
|
@ -187,7 +186,7 @@ return function(update_freq)
|
||||||
NUM_ROWS
|
NUM_ROWS
|
||||||
)
|
)
|
||||||
local tbl = common.make_text_table(
|
local tbl = common.make_text_table(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
TABLE_HEIGHT,
|
TABLE_HEIGHT,
|
||||||
|
@ -214,7 +213,7 @@ return function(update_freq)
|
||||||
-- main functions
|
-- main functions
|
||||||
|
|
||||||
local rbs = common.reduce_blocks(
|
local rbs = common.reduce_blocks(
|
||||||
MODULE_Y,
|
point.y,
|
||||||
{
|
{
|
||||||
common.mk_block(mk_header, true, 0),
|
common.mk_block(mk_header, true, 0),
|
||||||
common.mk_block(mk_cores, true, 0),
|
common.mk_block(mk_cores, true, 0),
|
||||||
|
@ -225,14 +224,13 @@ return function(update_freq)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
local update = function(trigger)
|
return pure.map_at(
|
||||||
rbs.updater(update_state(trigger, state.cpu_loads))
|
"update",
|
||||||
end
|
function(f)
|
||||||
|
return function(trigger)
|
||||||
-- TODO return the bottom y/height of the entire module
|
f(update_state(trigger, state.cpu_loads))
|
||||||
return {
|
end
|
||||||
static = rbs.static_drawer,
|
end,
|
||||||
dynamic = rbs.dynamic_drawer,
|
rbs
|
||||||
update = update
|
)
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ local common = require 'common'
|
||||||
local geometry = require 'geometry'
|
local geometry = require 'geometry'
|
||||||
local sys = require 'sys'
|
local sys = require 'sys'
|
||||||
|
|
||||||
return function(update_freq, devices)
|
return function(update_freq, devices, point)
|
||||||
local PLOT_SEC_BREAK = 20
|
local PLOT_SEC_BREAK = 20
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_HEIGHT = 56
|
||||||
-- TODO currently this will find any block device
|
-- TODO currently this will find any block device
|
||||||
|
@ -18,7 +18,7 @@ return function(update_freq, devices)
|
||||||
|
|
||||||
local make_plot = function(y, label, init)
|
local make_plot = function(y, label, init)
|
||||||
return common.make_rate_timeseries(
|
return common.make_rate_timeseries(
|
||||||
geometry.CENTER_LEFT_X,
|
point.x,
|
||||||
y,
|
y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
PLOT_HEIGHT,
|
PLOT_HEIGHT,
|
||||||
|
@ -36,8 +36,8 @@ return function(update_freq, devices)
|
||||||
-- header
|
-- header
|
||||||
|
|
||||||
local header = common.make_header(
|
local header = common.make_header(
|
||||||
geometry.CENTER_LEFT_X,
|
point.x,
|
||||||
geometry.TOP_Y,
|
point.y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
'INPUT / OUTPUT'
|
'INPUT / OUTPUT'
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,6 +4,24 @@ local geometry = require 'geometry'
|
||||||
local geom = require 'geom'
|
local geom = require 'geom'
|
||||||
local fill_rect = require 'fill_rect'
|
local fill_rect = require 'fill_rect'
|
||||||
|
|
||||||
|
local _combine_modules = function(acc, new)
|
||||||
|
local n = new(acc.point)
|
||||||
|
table.insert(acc.funs, n.fun)
|
||||||
|
acc.point = geom.make_point(acc.point.x, acc.point + n.y)
|
||||||
|
return acc
|
||||||
|
end
|
||||||
|
|
||||||
|
local reduce_modules_inner = function(y, mods)
|
||||||
|
local r = pure.reduce(_combine_modules, {y = y, mods = {}}, mods)
|
||||||
|
-- local us, ss, ds = table.unpack(pure.unzip(r.mods))
|
||||||
|
return pure.unzip(r.mods)
|
||||||
|
-- return {
|
||||||
|
-- updater = pure.sequence(table.unpack(us)),
|
||||||
|
-- draw_static = pure.sequence(table.unpack(ss)),
|
||||||
|
-- draw_dynamic = pure.sequence(table.unpack(ds))
|
||||||
|
-- }
|
||||||
|
end
|
||||||
|
|
||||||
return function(module_sets)
|
return function(module_sets)
|
||||||
local __cairo_set_source_surface = cairo_set_source_surface
|
local __cairo_set_source_surface = cairo_set_source_surface
|
||||||
local __cairo_image_surface_create = cairo_image_surface_create
|
local __cairo_image_surface_create = cairo_image_surface_create
|
||||||
|
@ -65,6 +83,7 @@ return function(module_sets)
|
||||||
__cairo_paint(cr)
|
__cairo_paint(cr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- return a table with update, static, and dynamic components
|
||||||
return function(cr)
|
return function(cr)
|
||||||
for i = 1, #cs do
|
for i = 1, #cs do
|
||||||
draw_static_surface(cr, cs[i])
|
draw_static_surface(cr, cs[i])
|
||||||
|
|
|
@ -2,20 +2,20 @@ local i_o = require 'i_o'
|
||||||
local common = require 'common'
|
local common = require 'common'
|
||||||
local geometry = require 'geometry'
|
local geometry = require 'geometry'
|
||||||
|
|
||||||
return function()
|
return function(point)
|
||||||
local TEXT_SPACING = 20
|
local TEXT_SPACING = 20
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
|
|
||||||
local header = common.make_header(
|
local header = common.make_header(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
geometry.TOP_Y,
|
point.y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
'SYSTEM'
|
'SYSTEM'
|
||||||
)
|
)
|
||||||
|
|
||||||
local rows = common.make_text_rows(
|
local rows = common.make_text_rows(
|
||||||
geometry.LEFT_X,
|
point.x,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
geometry.SECTION_WIDTH,
|
geometry.SECTION_WIDTH,
|
||||||
TEXT_SPACING,
|
TEXT_SPACING,
|
||||||
|
|
20
main.lua
20
main.lua
|
@ -17,6 +17,8 @@ package.path = ABS_PATH..'?.lua;'..
|
||||||
ABS_PATH..'core/widget/line/?.lua;'
|
ABS_PATH..'core/widget/line/?.lua;'
|
||||||
|
|
||||||
local i_o = require 'i_o'
|
local i_o = require 'i_o'
|
||||||
|
local geom = require 'geom'
|
||||||
|
local geometry = require 'geometry'
|
||||||
local sys = require 'sys'
|
local sys = require 'sys'
|
||||||
local system = require 'system'
|
local system = require 'system'
|
||||||
local network = require 'network'
|
local network = require 'network'
|
||||||
|
@ -46,15 +48,15 @@ function conky_start(update_interval)
|
||||||
{'/tmp', 'tmpfs'}
|
{'/tmp', 'tmpfs'}
|
||||||
}
|
}
|
||||||
|
|
||||||
local mem = memory(update_freq)
|
local mem = memory(update_freq, geom.make_point(geometry.RIGHT_X, 712))
|
||||||
local rw = readwrite(update_freq, devices)
|
local rw = readwrite(update_freq, devices, geom.make_point(geometry.CENTER_LEFT_X, geometry.TOP_Y))
|
||||||
local net = network(update_freq)
|
local net = network(update_freq, geom.make_point(geometry.CENTER_RIGHT_X, geometry.TOP_Y))
|
||||||
local pwr = power(update_freq, battery)
|
local pwr = power(update_freq, battery, geom.make_point(geometry.RIGHT_X, 380))
|
||||||
local fs = filesystem(fs_paths)
|
local fs = filesystem(fs_paths, geom.make_point(geometry.RIGHT_X, 170))
|
||||||
local stm = system()
|
local stm = system(geom.make_point(geometry.LEFT_X, geometry.TOP_Y))
|
||||||
local gfx = graphics(update_freq)
|
local gfx = graphics(update_freq, geom.make_point(geometry.LEFT_X, 145))
|
||||||
local proc = processor(update_freq)
|
local proc = processor(update_freq, geom.make_point(geometry.LEFT_X, 614))
|
||||||
local pcm = pacman()
|
local pcm = pacman(geom.make_point(geometry.RIGHT_X, geometry.TOP_Y))
|
||||||
|
|
||||||
local using_ac = sys.battery_status_reader(battery)
|
local using_ac = sys.battery_status_reader(battery)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue