From c683b6820459f581ba47992724c2cbbda4c12e50 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Fri, 9 Jul 2021 22:22:49 -0400 Subject: [PATCH] REF don't use kwargs in textcolumn --- core | 2 +- drawing/Common.lua | 171 ++++++++++++++++++++++++++++------------- drawing/FileSystem.lua | 40 +++++++--- drawing/Memory.lua | 76 ++++++++++++------ schema/Patterns.lua | 2 +- 5 files changed, 200 insertions(+), 91 deletions(-) diff --git a/core b/core index 048825b..63598c9 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 048825bef4474d1ac3f4e132c1ee7394462e9e00 +Subproject commit 63598c9257f2272808a98c6192276b18a9981ac9 diff --git a/drawing/Common.lua b/drawing/Common.lua index b0ec0e8..3cf6605 100644 --- a/drawing/Common.lua +++ b/drawing/Common.lua @@ -130,17 +130,30 @@ M.initPercentPlot = function(x, y, w, h, spacing, label) -- font_spec = M.normal_font_spec, -- }, label = _left_text(x, y, label, M.normal_font_spec, _G_Patterns_.INACTIVE_TEXT_FG), - value = _G_Widget_.CriticalText{ - x = x + w, - y = y, - x_align = 'right', - y_align = 'center', - append_end = '%', - critical_limit = 80, - text_color = _G_Patterns_.PRIMARY_FG, - critical_color = _G_Patterns_.PRIMARY_FG, - font_spec = M.normal_font_spec, - }, + value = _G_Widget_.CriticalText( + x + w, + y, + nil, + M.normal_font_spec, + _G_Patterns_.PRIMARY_FG, + _G_Patterns_.CRITICAL_FG, + 80, + 'right', + 'center', + nil, + '%' + ), + -- value = _G_Widget_.CriticalText{ + -- x = x + w, + -- y = y, + -- x_align = 'right', + -- y_align = 'center', + -- append_end = '%', + -- critical_limit = 80, + -- text_color = _G_Patterns_.PRIMARY_FG, + -- critical_color = _G_Patterns_.PRIMARY_FG, + -- font_spec = M.normal_font_spec, + -- }, plot = M.initThemedLabelPlot(x, y + spacing, w, h), } end @@ -249,17 +262,30 @@ end M.initTextRing = function(x, y, r, append_end, limit) return { ring = M.initRing(x, y, r), - value = _G_Widget_.CriticalText{ - x = x, - y = y, - x_align = 'center', - y_align = 'center', - append_end = append_end, - critical_limit = limit, - text_color = _G_Patterns_.PRIMARY_FG, - critical_color = _G_Patterns_.CRITICAL_FG, - font_spec = M.normal_font_spec, - }, + -- value = _G_Widget_.CriticalText{ + -- x = x, + -- y = y, + -- x_align = 'center', + -- y_align = 'center', + -- append_end = append_end, + -- critical_limit = limit, + -- text_color = _G_Patterns_.PRIMARY_FG, + -- critical_color = _G_Patterns_.CRITICAL_FG, + -- font_spec = M.normal_font_spec, + -- }, + value = _G_Widget_.CriticalText( + x, + y, + nil, + M.normal_font_spec, + _G_Patterns_.PRIMARY_FG, + _G_Patterns_.CRITICAL_FG, + limit, + 'center', + 'center', + nil, + append_end + ), } end @@ -365,18 +391,31 @@ M.initTextRowCrit = function(x, y, w, label, append_end, limit) M.normal_font_spec, _G_Patterns_.INACTIVE_TEXT_FG ), - value = _G_Widget_.CriticalText{ - x = x + w, - y = y, - x_align = 'right', - y_align = 'center', - text_color = _G_Patterns_.PRIMARY_FG, - critical_color = _G_Patterns_.CRITICAL_FG, - critical_limit = limit, - append_end = append_end, - text = '', - font_spec = M.normal_font_spec, - } + -- value = _G_Widget_.CriticalText{ + -- x = x + w, + -- y = y, + -- x_align = 'right', + -- y_align = 'center', + -- text_color = _G_Patterns_.PRIMARY_FG, + -- critical_color = _G_Patterns_.CRITICAL_FG, + -- critical_limit = limit, + -- append_end = append_end, + -- text = '', + -- font_spec = M.normal_font_spec, + -- } + value = _G_Widget_.CriticalText( + x + w, + y, + nil, + M.normal_font_spec, + _G_Patterns_.PRIMARY_FG, + _G_Patterns_.CRITICAL_FG, + limit, + 'right', + 'center', + nil, + append_end + ) } end @@ -395,26 +434,50 @@ end M.initTextRows = function(x, y, w, spacing, labels) return { - labels = _G_Widget_.TextColumn{ - x = x, - y = y, - spacing = spacing, - x_align = 'left', - y_align = 'center', - text_color = _G_Patterns_.INACTIVE_TEXT_FG, - font_spec = M.normal_font_spec, - table.unpack(labels), - }, - values = _G_Widget_.TextColumn{ - x = x + w, - y = y, - spacing = spacing, - x_align = 'right', - y_align = 'center', - text_color = _G_Patterns_.PRIMARY_FG, - font_spec = M.normal_font_spec, - num_rows = #labels, - } + labels = _G_Widget_.TextColumn( + -- x = x, + -- y = y, + -- spacing = spacing, + -- x_align = 'left', + -- y_align = 'center', + -- text_color = _G_Patterns_.INACTIVE_TEXT_FG, + -- font_spec = M.normal_font_spec, + -- table.unpack(labels), + x, + y, + spacing, + nil, + M.normal_font_spec, + _G_Patterns_.INACTIVE_TEXT_FG, + 'left', + 'center', + nil, + nil, + labels + ), + -- values = _G_Widget_.TextColumn{ + -- x = x + w, + -- y = y, + -- spacing = spacing, + -- x_align = 'right', + -- y_align = 'center', + -- text_color = _G_Patterns_.PRIMARY_FG, + -- font_spec = M.normal_font_spec, + -- num_rows = #labels, + -- } + values = _G_Widget_.initTextColumnN( + x + w, + y, + spacing, + nil, + M.normal_font_spec, + _G_Patterns_.PRIMARY_FG, + 'right', + 'center', + nil, + nil, + #labels + ) } end diff --git a/drawing/FileSystem.lua b/drawing/FileSystem.lua index 745d1c2..1b77e23 100644 --- a/drawing/FileSystem.lua +++ b/drawing/FileSystem.lua @@ -72,21 +72,39 @@ local bars = _G_Widget_.CompoundBar( 0.8 ) -local labels = _G_Widget_.TextColumn{ - x = _G_INIT_DATA_.RIGHT_X, - y = _BAR_Y_, - spacing = _SPACING_, - text_color = _G_Patterns_.INACTIVE_TEXT_FG, - font_spec = Common.normal_font_spec, - x_align = 'left', - y_align = 'center', - 'root', +-- local labels = _G_Widget_.TextColumn{ +-- x = _G_INIT_DATA_.RIGHT_X, +-- y = _BAR_Y_, +-- spacing = _SPACING_, +-- text_color = _G_Patterns_.INACTIVE_TEXT_FG, +-- font_spec = Common.normal_font_spec, +-- x_align = 'left', +-- y_align = 'center', +-- 'root', +-- 'boot', +-- 'home', +-- 'data', +-- 'dcache', +-- 'tmpfs', +-- } +local labels = _G_Widget_.TextColumn( + _G_INIT_DATA_.RIGHT_X, + _BAR_Y_, + _SPACING_, + nil, + Common.normal_font_spec, + _G_Patterns_.INACTIVE_TEXT_FG, + 'left', + 'center', + nil, + nil, + {'root', 'boot', 'home', 'data', 'dcache', - 'tmpfs', -} + 'tmpfs'} +) _SPACING_ = nil _BAR_PAD_ = nil diff --git a/drawing/Memory.lua b/drawing/Memory.lua index 7494e72..1f5eb12 100644 --- a/drawing/Memory.lua +++ b/drawing/Memory.lua @@ -115,31 +115,59 @@ local swap = Common.initTextRowCrit( 80 ) +-- local cache = { +-- labels = _G_Widget_.TextColumn{ +-- x = _TEXT_LEFT_X_, +-- y = _LINE_1_Y_ + _TEXT_SPACING_, +-- spacing = _TEXT_SPACING_, +-- text_color = _G_Patterns_.INACTIVE_TEXT_FG, +-- font_spec = Common.normal_font_spec, +-- x_align = 'left', +-- y_align = 'center', +-- 'Page Cache', +-- 'Buffers', +-- 'Kernel Slab' +-- }, +-- percents = _G_Widget_.TextColumn{ +-- x = _RIGHT_X_, +-- y = _LINE_1_Y_ + _TEXT_SPACING_, +-- x_align = 'right', +-- y_align = 'center', +-- append_end = ' %', +-- text_color = _G_Patterns_.SECONDARY_FG, +-- font_spec = Common.normal_font_spec, +-- '', +-- '', +-- '' +-- }, +-- } local cache = { - labels = _G_Widget_.TextColumn{ - x = _TEXT_LEFT_X_, - y = _LINE_1_Y_ + _TEXT_SPACING_, - spacing = _TEXT_SPACING_, - text_color = _G_Patterns_.INACTIVE_TEXT_FG, - font_spec = Common.normal_font_spec, - x_align = 'left', - y_align = 'center', - 'Page Cache', - 'Buffers', - 'Kernel Slab' - }, - percents = _G_Widget_.TextColumn{ - x = _RIGHT_X_, - y = _LINE_1_Y_ + _TEXT_SPACING_, - x_align = 'right', - y_align = 'center', - append_end = ' %', - text_color = _G_Patterns_.SECONDARY_FG, - font_spec = Common.normal_font_spec, - '', - '', - '' - }, + labels = _G_Widget_.TextColumn( + _TEXT_LEFT_X_, + _LINE_1_Y_ + _TEXT_SPACING_, + _TEXT_SPACING_, + nil, + Common.normal_font_spec, + _G_Patterns_.INACTIVE_TEXT_FG, + 'left', + 'center', + nil, + nil, + {'Page Cache', 'Buffers', 'Kernel Slab'} + ), + percents = _G_Widget_.initTextColumnN( + _RIGHT_X_, + _LINE_1_Y_ + _TEXT_SPACING_, + _TEXT_SPACING_, + nil, + Common.normal_font_spec, + _G_Patterns_.SECONDARY_FG, + 'right', + 'center', + nil, + ' %', + 3 + ), } local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2 diff --git a/schema/Patterns.lua b/schema/Patterns.lua index b63764b..0c881b1 100644 --- a/schema/Patterns.lua +++ b/schema/Patterns.lua @@ -61,7 +61,7 @@ M.PLOT_FILL_BORDER_PRIMARY = Color.gradient_rgb{ } M.PLOT_FILL_BG_PRIMARY = Color.gradient_rgba{ - [0.2] = {PLOT_BLUE3, 0.0}, + [0.2] = {PLOT_BLUE3, 0.5}, [1.0] = {PLOT_BLUE4, 1.0} }