move all atomic static drawing ops to static drawing functions

This commit is contained in:
petrucci4prez 2018-08-05 11:35:00 -04:00
parent 715e856d20
commit ba4ea08453
8 changed files with 52 additions and 57 deletions

View File

@ -62,15 +62,15 @@ local update = function(cr)
end
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
TextColumn.draw(labels, cr)
end
local draw_dynamic = function(cr, trigger)
if trigger == 0 then update(cr) end
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
TextColumn.draw(labels, cr)
CompoundBar.draw(bars, cr)
end

View File

@ -269,39 +269,36 @@ _MEM_UTIL_Y_ = nil
_VID_UTIL_Y_ = nil
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Text.draw(status.label, cr)
Line.draw(separator1, cr)
Text.draw(internal_temp.label, cr)
Line.draw(separator2, cr)
TextColumn.draw(clock_speed.labels, cr)
Line.draw(separator3, cr)
Text.draw(gpu_util.label, cr)
Text.draw(mem_util.label, cr)
Text.draw(vid_util.label, cr)
end
local draw_dynamic = function(cr)
update(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Text.draw(status.label, cr)
Text.draw(status.value, cr)
Line.draw(separator1, cr)
Text.draw(internal_temp.label, cr)
Text.draw(internal_temp.value, cr)
Line.draw(separator2, cr)
TextColumn.draw(clock_speed.labels, cr)
TextColumn.draw(clock_speed.values, cr)
Line.draw(separator3, cr)
Text.draw(gpu_util.label, cr)
Text.draw(gpu_util.value, cr)
LabelPlot.draw(gpu_util.plot, cr)
Text.draw(mem_util.label, cr)
Text.draw(mem_util.value, cr)
LabelPlot.draw(mem_util.plot, cr)
Text.draw(vid_util.label, cr)
Text.draw(vid_util.value, cr)
LabelPlot.draw(vid_util.plot, cr)
end

View File

@ -199,22 +199,23 @@ _RIGHT_X_ = nil
_PLOT_Y_ = nil
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Arc.draw(inner_ring, cr)
Text.draw(swap.label, cr)
TextColumn.draw(cache.labels, cr)
end
local draw_dynamic = function(cr)
update(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Dial.draw(dial, cr)
Arc.draw(cache_arc, cr)
Arc.draw(inner_ring, cr)
CriticalText.draw(total_used, cr)
Text.draw(swap.label, cr)
CriticalText.draw(swap.percent, cr)
TextColumn.draw(cache.labels, cr)
TextColumn.draw(cache.percents, cr)
LabelPlot.draw(plot, cr)

View File

@ -133,20 +133,19 @@ _RIGHT_X_ = nil
_UPLOAD_Y_ = nil
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Text.draw(dnload.label, cr)
Text.draw(upload.label, cr)
end
local draw_dynamic = function(cr, update_frequency)
update(cr, update_frequency)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Text.draw(dnload.label, cr)
Text.draw(dnload.speed, cr)
ScalePlot.draw(dnload.plot, cr)
Text.draw(upload.label, cr)
Text.draw(upload.speed, cr)
ScalePlot.draw(upload.plot, cr)
end

View File

@ -50,15 +50,14 @@ local update = function(cr)
end
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
TextColumn.draw(labels, cr)
end
local draw_dynamic = function(cr, log_is_changed)
if log_is_changed then update(cr) end
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
TextColumn.draw(labels, cr)
TextColumn.draw(info, cr)
end

View File

@ -252,33 +252,34 @@ _PROCESS_Y_ = nil
_PLOT_Y_ = nil
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
for c = 1, NUM_PHYSICAL_CORES do
local this_core = cores[c]
Arc.draw(this_core.inner_ring, cr)
end
Text.draw(process.label, cr)
Text.draw(ave_freq.label, cr)
Line.draw(separator, cr)
Text.draw(total_load.label, cr)
end
local draw_dynamic = function(cr)
update(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
for c = 1, NUM_PHYSICAL_CORES do
local core = cores[c]
CompoundDial.draw(core.dials, cr)
Arc.draw(core.inner_ring, cr)
CriticalText.draw(core.coretemp_text, cr)
local this_core = cores[c]
CompoundDial.draw(this_core.dials, cr)
CriticalText.draw(this_core.coretemp_text, cr)
end
Text.draw(process.label, cr)
Text.draw(process.value, cr)
Text.draw(ave_freq.label, cr)
Text.draw(ave_freq.value, cr)
Line.draw(separator, cr)
Text.draw(total_load.label, cr)
CriticalText.draw(total_load.value, cr)
LabelPlot.draw(plot, cr)
Table.draw(tbl, cr)

View File

@ -120,20 +120,19 @@ local update = function(cr, update_frequency)
end
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Text.draw(reads.label, cr)
Text.draw(writes.label, cr)
end
local draw_dynamic = function(cr, update_frequency)
update(cr, update_frequency)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
Text.draw(reads.label, cr)
Text.draw(reads.rate, cr)
ScalePlot.draw(reads.plot, cr)
Text.draw(writes.label, cr)
Text.draw(writes.rate, cr)
ScalePlot.draw(writes.plot, cr)
end

View File

@ -45,7 +45,9 @@ local info = _G_Widget_.TextColumn{
_TEXT_SPACING_ = nil
local draw_static = function(cr)
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
TextColumn.draw(labels, cr)
end
local draw_dynamic = function(cr, log_is_changed)
@ -58,9 +60,6 @@ local draw_dynamic = function(cr, log_is_changed)
"'/ synchronizing package lists/p' /var/log/pacman.log | tail -1"))
end
Text.draw(header.text, cr)
Line.draw(header.underline, cr)
TextColumn.draw(labels, cr)
TextColumn.draw(info, cr)
end