REF move compound dial to common
This commit is contained in:
parent
abe27ad148
commit
b5f3272c30
|
@ -2,8 +2,6 @@ local M = {}
|
||||||
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Arc = require 'Arc'
|
local Arc = require 'Arc'
|
||||||
local Dial = require 'Dial'
|
|
||||||
local CompoundDial = require 'CompoundDial'
|
|
||||||
local Text = require 'Text'
|
local Text = require 'Text'
|
||||||
local CriticalText = require 'CriticalText'
|
local CriticalText = require 'CriticalText'
|
||||||
local TextColumn = require 'TextColumn'
|
local TextColumn = require 'TextColumn'
|
||||||
|
@ -40,6 +38,9 @@ local PLOT_GRID_Y_N = 4
|
||||||
|
|
||||||
local ARC_WIDTH = 2
|
local ARC_WIDTH = 2
|
||||||
|
|
||||||
|
local DIAL_THETA0 = 90
|
||||||
|
local DIAL_THETA1 = 360
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- helper functions
|
-- helper functions
|
||||||
|
|
||||||
|
@ -283,7 +284,7 @@ end
|
||||||
|
|
||||||
M.dial = function(x, y, radius, thickness, threshold)
|
M.dial = function(x, y, radius, thickness, threshold)
|
||||||
return _G_Widget_.Dial(
|
return _G_Widget_.Dial(
|
||||||
_G_Widget_.make_semicircle(x, y, radius, 90, 360),
|
_G_Widget_.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1),
|
||||||
_G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG),
|
_G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG),
|
||||||
_G_Widget_.threshold_style(
|
_G_Widget_.threshold_style(
|
||||||
_G_Patterns_.INDICATOR_FG_PRIMARY,
|
_G_Patterns_.INDICATOR_FG_PRIMARY,
|
||||||
|
@ -293,6 +294,24 @@ M.dial = function(x, y, radius, thickness, threshold)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- compound dial
|
||||||
|
|
||||||
|
M.compound_dial = function(x, y, outer_radius, inner_radius, thickness,
|
||||||
|
threshold, num_dials)
|
||||||
|
return _G_Widget_.CompoundDial(
|
||||||
|
_G_Widget_.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1),
|
||||||
|
_G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG),
|
||||||
|
_G_Widget_.threshold_style(
|
||||||
|
_G_Patterns_.INDICATOR_FG_PRIMARY,
|
||||||
|
_G_Patterns_.INDICATOR_FG_CRITICAL,
|
||||||
|
threshold
|
||||||
|
),
|
||||||
|
inner_radius,
|
||||||
|
num_dials
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- separator (eg a horizontal line)
|
-- separator (eg a horizontal line)
|
||||||
|
|
||||||
|
|
|
@ -56,19 +56,14 @@ local _create_core_ = function(cores, id, x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
cores[id +1] = {
|
cores[id +1] = {
|
||||||
dials = _G_Widget_.CompoundDial(
|
dials = Common.compound_dial(
|
||||||
_G_Widget_.make_semicircle(x, y, _DIAL_OUTER_RADIUS_, 90, 360),
|
x,
|
||||||
_G_Widget_.arc_style(
|
y,
|
||||||
_DIAL_THICKNESS_,
|
_DIAL_OUTER_RADIUS_,
|
||||||
_G_Patterns_.INDICATOR_BG
|
_DIAL_INNER_RADIUS_,
|
||||||
),
|
_DIAL_THICKNESS_,
|
||||||
_G_Widget_.threshold_style(
|
0.8,
|
||||||
_G_Patterns_.INDICATOR_FG_PRIMARY,
|
NUM_THREADS_PER_CORE
|
||||||
_G_Patterns_.INDICATOR_FG_CRITICAL,
|
|
||||||
0.8
|
|
||||||
),
|
|
||||||
_DIAL_INNER_RADIUS_,
|
|
||||||
NUM_THREADS_PER_CORE
|
|
||||||
),
|
),
|
||||||
text_ring = Common.initTextRing(
|
text_ring = Common.initTextRing(
|
||||||
x,
|
x,
|
||||||
|
|
Loading…
Reference in New Issue