REF move pattern code into drawing modules

This commit is contained in:
Nathan Dwarshuis 2021-07-04 22:24:18 -04:00
parent ed505d0e15
commit d4ac91ac35
8 changed files with 220 additions and 153 deletions

2
core

@ -1 +1 @@
Subproject commit 7b8e82ee6a5c3c18133c1edc0f7247b3d20b4cb3 Subproject commit a5f1912f6bf2a1fa54d9385971400fcb2de80e90

View File

@ -55,7 +55,8 @@ local separator = _G_Widget_.Line{
p2 = { p2 = {
x = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH, x = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = _SEP_Y_, y = _SEP_Y_,
} },
line_pattern = _G_Patterns_.BORDER_FG,
} }
local _BAR_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_ local _BAR_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
@ -67,7 +68,9 @@ local bars = _G_Widget_.CompoundBar{
spacing = _SPACING_, spacing = _SPACING_,
num_bars = FS_NUM, num_bars = FS_NUM,
-- thickness = 12, -- thickness = 12,
critical_limit = '>0.8' critical_limit = '>0.8',
indicator_pattern = Patterns.INDICATOR_FG_PRIMARY,
line_pattern = Patterns.INDICATOR_BG,
} }
local labels = _G_Widget_.TextColumn{ local labels = _G_Widget_.TextColumn{

View File

@ -44,7 +44,8 @@ local _SEP_Y_1_ = header.bottom_y + _SEPARATOR_SPACING_
local separator1 = _G_Widget_.Line{ local separator1 = _G_Widget_.Line{
p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_1_}, p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_1_},
p2 = {x = _RIGHT_X_, y = _SEP_Y_1_} p2 = {x = _RIGHT_X_, y = _SEP_Y_1_},
line_pattern = _G_Patterns_.BORDER_FG,
} }
local _INTERNAL_TEMP_Y_ = _SEP_Y_1_ + _SEPARATOR_SPACING_ local _INTERNAL_TEMP_Y_ = _SEP_Y_1_ + _SEPARATOR_SPACING_
@ -68,7 +69,8 @@ local _SEP_Y_2_ = _INTERNAL_TEMP_Y_ + _SEPARATOR_SPACING_
local separator2 = _G_Widget_.Line{ local separator2 = _G_Widget_.Line{
p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_2_}, p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_2_},
p2 = {x = _RIGHT_X_, y = _SEP_Y_2_} p2 = {x = _RIGHT_X_, y = _SEP_Y_2_},
line_pattern = _G_Patterns_.BORDER_FG,
} }
local _CLOCK_SPEED_Y_ = _SEP_Y_2_ + _SEPARATOR_SPACING_ local _CLOCK_SPEED_Y_ = _SEP_Y_2_ + _SEPARATOR_SPACING_
@ -95,7 +97,8 @@ local _SEP_Y_3_ = _CLOCK_SPEED_Y_ + _TEXT_SPACING_ * 2
local separator3 = _G_Widget_.Line{ local separator3 = _G_Widget_.Line{
p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_3_}, p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_3_},
p2 = {x = _RIGHT_X_, y = _SEP_Y_3_} p2 = {x = _RIGHT_X_, y = _SEP_Y_3_},
line_pattern = _G_Patterns_.BORDER_FG,
} }
local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_ local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_
@ -117,7 +120,11 @@ local gpu_util = {
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _GPU_UTIL_Y_ + _PLOT_SEC_BREAK_, y = _GPU_UTIL_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_ height = _PLOT_HEIGHT_,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }
@ -140,7 +147,11 @@ local mem_util = {
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _MEM_UTIL_Y_ + _PLOT_SEC_BREAK_, y = _MEM_UTIL_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_ height = _PLOT_HEIGHT_,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }
@ -163,7 +174,11 @@ local vid_util = {
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _VID_UTIL_Y_ + _PLOT_SEC_BREAK_, y = _VID_UTIL_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_ height = _PLOT_HEIGHT_,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }

View File

@ -63,7 +63,9 @@ local dial = _G_Widget_.Dial{
y = DIAL_Y, y = DIAL_Y,
radius = DIAL_RADIUS, radius = DIAL_RADIUS,
thickness = _DIAL_THICKNESS_, thickness = _DIAL_THICKNESS_,
critical_limit = '>0.8' critical_limit = '>0.8',
dial_pattern = _G_Patterns_.INDICATOR_FG_PRIMARY,
arc_pattern = _G_Patterns_.INDICATOR_BG
} }
local cache_arc = _G_Widget_.Arc{ local cache_arc = _G_Widget_.Arc{
x = DIAL_X, x = DIAL_X,
@ -136,7 +138,11 @@ local plot = _G_Widget_.LabelPlot{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _PLOT_Y_, y = _PLOT_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_ height = _PLOT_HEIGHT_,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
local tbl = _G_Widget_.Table{ local tbl = _G_Widget_.Table{
@ -144,6 +150,10 @@ local tbl = _G_Widget_.Table{
y = _PLOT_Y_ + _PLOT_HEIGHT_ + _TABLE_SECTION_BREAK_, y = _PLOT_Y_ + _PLOT_HEIGHT_ + _TABLE_SECTION_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _TABLE_HEIGHT_, height = _TABLE_HEIGHT_,
body_color = _G_Patterns_.INACTIVE_TEXT_FG,
header_color = _G_Patterns_.PRIMARY_FG,
line_pattern = _G_Patterns_.BORDER_FG,
separator_pattern = _G_Patterns_.BORDER_FG,
'Name', 'Name',
'PID', 'PID',
'Mem (%)' 'Mem (%)'

View File

@ -42,7 +42,11 @@ local dnload = {
y = header.bottom_y + _PLOT_SEC_BREAK_, y = header.bottom_y + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = network_label_function y_label_func = network_label_function,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }
@ -65,7 +69,11 @@ local upload = {
y = _UPLOAD_Y_ + _PLOT_SEC_BREAK_, y = _UPLOAD_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = network_label_function y_label_func = network_label_function,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }

View File

@ -51,6 +51,10 @@ local pkg0 = {
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = power_label_function, y_label_func = power_label_function,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
}, },
} }
@ -76,6 +80,10 @@ local dram = {
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = power_label_function, y_label_func = power_label_function,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }
@ -99,6 +107,10 @@ local battery_draw = {
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = power_label_function, y_label_func = power_label_function,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }

View File

@ -68,7 +68,9 @@ local _create_core_ = function(cores, id, x, y)
outer_radius = _DIAL_OUTER_RADIUS_, outer_radius = _DIAL_OUTER_RADIUS_,
spacing = _DIAL_SPACING_, spacing = _DIAL_SPACING_,
num_dials = NUM_THREADS_PER_CORE, num_dials = NUM_THREADS_PER_CORE,
critical_limit = '>0.8' critical_limit = '>0.8',
dial_pattern = _G_Patterns_.INDICATOR_FG_PRIMARY,
arc_pattern = _G_Patterns_.INDICATOR_BG
}, },
inner_ring = _G_Widget_.Arc{ inner_ring = _G_Widget_.Arc{
x = x, x = x,
@ -149,7 +151,8 @@ local _SEP_Y_ = _FREQ_Y_ + _SEPARATOR_SPACING_
local separator = _G_Widget_.Line{ local separator = _G_Widget_.Line{
p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_}, p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_},
p2 = {x = _RIGHT_X_, y = _SEP_Y_} p2 = {x = _RIGHT_X_, y = _SEP_Y_},
line_pattern = _G_Patterns_.BORDER_FG,
} }
local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_ local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
@ -175,7 +178,11 @@ local plot = _G_Widget_.LabelPlot{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _PLOT_Y_, y = _PLOT_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_ height = _PLOT_HEIGHT_,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
local tbl = _G_Widget_.Table{ local tbl = _G_Widget_.Table{
@ -184,6 +191,10 @@ local tbl = _G_Widget_.Table{
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _TABLE_HEIGHT_, height = _TABLE_HEIGHT_,
num_rows = NUM_ROWS, num_rows = NUM_ROWS,
body_color = _G_Patterns_.INACTIVE_TEXT_FG,
header_color = _G_Patterns_.ACTIVE_FG,
line_pattern = _G_Patterns_.BORDER_FG,
separator_pattern = _G_Patterns_.BORDER_FG,
'Name', 'Name',
'PID', 'PID',
'CPU (%)' 'CPU (%)'

View File

@ -76,6 +76,10 @@ local reads = {
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = io_label_function, y_label_func = io_label_function,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }
@ -100,6 +104,10 @@ local writes = {
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_, height = _PLOT_HEIGHT_,
y_label_func = io_label_function, y_label_func = io_label_function,
outline_pattern = _G_Patterns_.BORDER_FG,
intrvl_pattern = _G_Patterns_.BORDER_FG,
data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY,
} }
} }