update conventions and flank init vars with __
This commit is contained in:
parent
674523b8c0
commit
85361b55d4
2
core
2
core
|
@ -1 +1 @@
|
|||
Subproject commit 455d15f24a60bad013d07712457318e45885de75
|
||||
Subproject commit d3b3c385a2371e747676d2b53b73da0c24b6d7ad
|
|
@ -2,22 +2,22 @@ local Widget = require 'Widget'
|
|||
local FillRect = require 'FillRect'
|
||||
|
||||
local left = Widget.Panel{
|
||||
x = G_DIMENSIONS_.LEFT_X - G_DIMENSIONS_.PANEL_MARGIN_X,
|
||||
y = G_DIMENSIONS_.TOP_Y - G_DIMENSIONS_.PANEL_MARGIN_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH + G_DIMENSIONS_.PANEL_MARGIN_X * 2,
|
||||
height = G_DIMENSIONS_.SIDE_HEIGHT + G_DIMENSIONS_.PANEL_MARGIN_Y * 2,
|
||||
x = __G_INIT_DATA__.LEFT_X - __G_INIT_DATA__.PANEL_MARGIN_X,
|
||||
y = __G_INIT_DATA__.TOP_Y - __G_INIT_DATA__.PANEL_MARGIN_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_X * 2,
|
||||
height = __G_INIT_DATA__.SIDE_HEIGHT + __G_INIT_DATA__.PANEL_MARGIN_Y * 2,
|
||||
}
|
||||
local center = Widget.Panel{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X - G_DIMENSIONS_.PANEL_MARGIN_X,
|
||||
y = G_DIMENSIONS_.TOP_Y - G_DIMENSIONS_.PANEL_MARGIN_Y,
|
||||
width = G_DIMENSIONS_.CENTER_WIDTH + G_DIMENSIONS_.PANEL_MARGIN_Y * 2 + G_DIMENSIONS_.CENTER_PAD,
|
||||
height = G_DIMENSIONS_.CENTER_HEIGHT + G_DIMENSIONS_.PANEL_MARGIN_Y * 2,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X - __G_INIT_DATA__.PANEL_MARGIN_X,
|
||||
y = __G_INIT_DATA__.TOP_Y - __G_INIT_DATA__.PANEL_MARGIN_Y,
|
||||
width = __G_INIT_DATA__.CENTER_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_Y * 2 + __G_INIT_DATA__.CENTER_PAD,
|
||||
height = __G_INIT_DATA__.CENTER_HEIGHT + __G_INIT_DATA__.PANEL_MARGIN_Y * 2,
|
||||
}
|
||||
local right = Widget.Panel{
|
||||
x = G_DIMENSIONS_.RIGHT_X - G_DIMENSIONS_.PANEL_MARGIN_X,
|
||||
y = G_DIMENSIONS_.TOP_Y - G_DIMENSIONS_.PANEL_MARGIN_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH + G_DIMENSIONS_.PANEL_MARGIN_X * 2,
|
||||
height = G_DIMENSIONS_.SIDE_HEIGHT + G_DIMENSIONS_.PANEL_MARGIN_Y * 2,
|
||||
x = __G_INIT_DATA__.RIGHT_X - __G_INIT_DATA__.PANEL_MARGIN_X,
|
||||
y = __G_INIT_DATA__.TOP_Y - __G_INIT_DATA__.PANEL_MARGIN_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_X * 2,
|
||||
height = __G_INIT_DATA__.SIDE_HEIGHT + __G_INIT_DATA__.PANEL_MARGIN_Y * 2,
|
||||
}
|
||||
|
||||
Widget = nil
|
||||
|
|
46
main.lua
46
main.lua
|
@ -39,14 +39,14 @@ Var names:
|
|||
- Spacial scope:
|
||||
- Everything declared local by default
|
||||
- reassigning to local:
|
||||
- upval to local: preceed with _
|
||||
- global to local: preceed with __
|
||||
- upval to local: prefix with _
|
||||
- global to local: prefix with __
|
||||
- replace . with _ if callng from table
|
||||
- global: preceed with g_
|
||||
- Temporal Scope
|
||||
- init: only relevent to startup (nil'ed before first rendering loop)
|
||||
- persistant: always relevent (potentially)
|
||||
- init vars end with _
|
||||
- flank init vars with __
|
||||
- Mutability
|
||||
- variable: lowercase
|
||||
- constant: ALL_CAPS
|
||||
|
@ -58,7 +58,7 @@ Var names:
|
|||
|
||||
local UPDATE_FREQUENCY = 1 --Hz
|
||||
|
||||
G_DIMENSIONS_ = {
|
||||
__G_INIT_DATA__ = {
|
||||
UPDATE_INTERVAL = 1 / UPDATE_FREQUENCY,
|
||||
|
||||
LEFT_X = 32,
|
||||
|
@ -75,26 +75,26 @@ G_DIMENSIONS_ = {
|
|||
ABS_PATH = os.getenv('CONKY_LUA_HOME')
|
||||
}
|
||||
|
||||
G_DIMENSIONS_.CENTER_LEFT_X = G_DIMENSIONS_.LEFT_X + G_DIMENSIONS_.SECTION_WIDTH + G_DIMENSIONS_.PANEL_MARGIN_X * 2 + G_DIMENSIONS_.PANEL_HORZ_SPACING
|
||||
G_DIMENSIONS_.CENTER_RIGHT_X = G_DIMENSIONS_.CENTER_LEFT_X + G_DIMENSIONS_.SECTION_WIDTH + G_DIMENSIONS_.CENTER_PAD
|
||||
G_DIMENSIONS_.CENTER_WIDTH = G_DIMENSIONS_.SECTION_WIDTH * 2 + G_DIMENSIONS_.CENTER_PAD
|
||||
G_DIMENSIONS_.RIGHT_X = G_DIMENSIONS_.CENTER_LEFT_X + G_DIMENSIONS_.CENTER_WIDTH + G_DIMENSIONS_.PANEL_MARGIN_X * 2 + G_DIMENSIONS_.PANEL_HORZ_SPACING
|
||||
__G_INIT_DATA__.CENTER_LEFT_X = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_X * 2 + __G_INIT_DATA__.PANEL_HORZ_SPACING
|
||||
__G_INIT_DATA__.CENTER_RIGHT_X = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.SECTION_WIDTH + __G_INIT_DATA__.CENTER_PAD
|
||||
__G_INIT_DATA__.CENTER_WIDTH = __G_INIT_DATA__.SECTION_WIDTH * 2 + __G_INIT_DATA__.CENTER_PAD
|
||||
__G_INIT_DATA__.RIGHT_X = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.CENTER_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_X * 2 + __G_INIT_DATA__.PANEL_HORZ_SPACING
|
||||
|
||||
package.path = G_DIMENSIONS_.ABS_PATH..'/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/interface/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/module/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/schema/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/func/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/super/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/widget/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/widget/arc/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/widget/text/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/widget/plot/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/widget/rect/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/widget/poly/?.lua;'..
|
||||
G_DIMENSIONS_.ABS_PATH..'/core/widget/image/?.lua;'
|
||||
package.path = __G_INIT_DATA__.ABS_PATH..'/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/interface/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/module/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/schema/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/func/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/super/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/widget/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/widget/arc/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/widget/text/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/widget/plot/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/widget/rect/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/widget/poly/?.lua;'..
|
||||
__G_INIT_DATA__.ABS_PATH..'/core/widget/image/?.lua;'
|
||||
|
||||
conky_set_update_interval(G_DIMENSIONS_.UPDATE_INTERVAL)
|
||||
conky_set_update_interval(__G_INIT_DATA__.UPDATE_INTERVAL)
|
||||
|
||||
require 'imlib2'
|
||||
require 'cairo'
|
||||
|
@ -125,7 +125,7 @@ _unrequire('Gradient')
|
|||
|
||||
_unrequire = nil
|
||||
|
||||
G_DIMENSIONS_ = nil
|
||||
__G_INIT_DATA__ = nil
|
||||
|
||||
local __cairo_xlib_surface_create = cairo_xlib_surface_create
|
||||
local __cairo_create = cairo_create
|
||||
|
|
|
@ -22,16 +22,16 @@ local SPACING = 20
|
|||
local BAR_PAD = 100
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = MODULE_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = 'FILE SYSTEMS'
|
||||
}
|
||||
|
||||
local HEADER_BOTTOM_Y = header.bottom_y
|
||||
|
||||
local labels = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = HEADER_BOTTOM_Y,
|
||||
spacing = SPACING,
|
||||
'root',
|
||||
|
@ -46,7 +46,7 @@ local labels = Widget.TextColumn{
|
|||
|
||||
--~ for i = 1, FS_NUM do
|
||||
--~ totals[i] = Widget.CriticalText{
|
||||
--~ x = G_DIMENSIONS_.RIGHT_X + TEXT_WIDTH,
|
||||
--~ x = __G_INIT_DATA__.RIGHT_X + TEXT_WIDTH,
|
||||
--~ y = HEADER_BOTTOM_Y + (i - 1) * SPACING,
|
||||
--~ x_align = 'right',
|
||||
--~ text_color = schema.blue,
|
||||
|
@ -66,11 +66,11 @@ for i, v in _PAIRS(FS_PATHS) do
|
|||
end
|
||||
|
||||
local bars = Widget.CompoundBar{
|
||||
--~ x = G_DIMENSIONS_.RIGHT_X + TEXT_WIDTH + BAR_PAD,
|
||||
x = G_DIMENSIONS_.RIGHT_X + BAR_PAD,
|
||||
--~ x = __G_INIT_DATA__.RIGHT_X + TEXT_WIDTH + BAR_PAD,
|
||||
x = __G_INIT_DATA__.RIGHT_X + BAR_PAD,
|
||||
y = HEADER_BOTTOM_Y,
|
||||
--~ length = G_DIMENSIONS_.SECTION_WIDTH - (TEXT_WIDTH + BAR_PAD),
|
||||
length = G_DIMENSIONS_.SECTION_WIDTH - BAR_PAD,
|
||||
--~ length = __G_INIT_DATA__.SECTION_WIDTH - (TEXT_WIDTH + BAR_PAD),
|
||||
length = __G_INIT_DATA__.SECTION_WIDTH - BAR_PAD,
|
||||
spacing = SPACING,
|
||||
num_bars = FS_NUM,
|
||||
critical_limit = '>0.8'
|
||||
|
|
|
@ -17,17 +17,17 @@ local PLOT_SEC_BREAK = 20
|
|||
local PLOT_HEIGHT = 56
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = MODULE_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = 'NVIDIA GRAPHICS'
|
||||
}
|
||||
|
||||
local RIGHT_X = G_DIMENSIONS_.LEFT_X + G_DIMENSIONS_.SECTION_WIDTH
|
||||
local RIGHT_X = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH
|
||||
|
||||
local status = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = header.bottom_y,
|
||||
text = 'Status'
|
||||
},
|
||||
|
@ -43,7 +43,7 @@ local status = {
|
|||
local SEP_Y_1 = header.bottom_y + SEPARATOR_SPACING
|
||||
|
||||
local separator1 = Widget.Line{
|
||||
p1 = {x = G_DIMENSIONS_.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}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ local INTERNAL_TEMP_Y = SEP_Y_1 + SEPARATOR_SPACING
|
|||
|
||||
local internal_temp = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = INTERNAL_TEMP_Y,
|
||||
text = 'Internal Temperature'
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ local PCI_UTIL_Y = INTERNAL_TEMP_Y + TEXT_SPACING
|
|||
|
||||
local pci_util = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = PCI_UTIL_Y,
|
||||
text = 'PCI Utilization'
|
||||
},
|
||||
|
@ -84,7 +84,7 @@ local pci_util = {
|
|||
local SEP_Y_2 = PCI_UTIL_Y + SEPARATOR_SPACING
|
||||
|
||||
local separator2 = Widget.Line{
|
||||
p1 = {x = G_DIMENSIONS_.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}
|
||||
}
|
||||
|
||||
|
@ -92,14 +92,14 @@ local CLOCK_SPEED_Y = SEP_Y_2 + SEPARATOR_SPACING
|
|||
|
||||
local clock_speed = {
|
||||
labels = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = CLOCK_SPEED_Y,
|
||||
spacing = TEXT_SPACING,
|
||||
'GPU Clock Speed',
|
||||
'Memory Clock Speed'
|
||||
},
|
||||
values = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.LEFT_X + G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH,
|
||||
y = CLOCK_SPEED_Y,
|
||||
spacing = TEXT_SPACING,
|
||||
x_align = 'right',
|
||||
|
@ -111,7 +111,7 @@ local clock_speed = {
|
|||
local SEP_Y_3 = CLOCK_SPEED_Y + TEXT_SPACING * 2
|
||||
|
||||
local separator3 = Widget.Line{
|
||||
p1 = {x = G_DIMENSIONS_.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}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ local GPU_UTIL_PLOT_Y = GPU_UTIL_Y + PLOT_SEC_BREAK
|
|||
|
||||
local gpu_util = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = GPU_UTIL_Y,
|
||||
text = 'GPU Utilization'
|
||||
},
|
||||
|
@ -132,9 +132,9 @@ local gpu_util = {
|
|||
text = '<gpu_util>'
|
||||
},
|
||||
plot = Widget.LabelPlot{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = GPU_UTIL_PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ local MEM_UTIL_PLOT_Y = MEM_UTIL_Y + PLOT_SEC_BREAK
|
|||
|
||||
local mem_util = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = MEM_UTIL_Y,
|
||||
text = 'Memory Utilization'
|
||||
},
|
||||
|
@ -156,9 +156,9 @@ local mem_util = {
|
|||
text = '<mem_util>'
|
||||
},
|
||||
plot = Widget.LabelPlot{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = MEM_UTIL_PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ local VID_UTIL_PLOT_Y = VID_UTIL_Y + PLOT_SEC_BREAK
|
|||
|
||||
local vid_util = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = VID_UTIL_Y,
|
||||
text = 'Video Utilization'
|
||||
},
|
||||
|
@ -180,9 +180,9 @@ local vid_util = {
|
|||
text = '<vid_util>'
|
||||
},
|
||||
plot = Widget.LabelPlot{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = VID_UTIL_PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,16 +42,16 @@ local TABLE_SECTION_BREAK = 20
|
|||
local TABLE_HEIGHT = 114
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = MODULE_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = "MEMORY"
|
||||
}
|
||||
|
||||
local HEADER_BOTTOM_Y = header.bottom_y
|
||||
|
||||
--don't nil these
|
||||
local DIAL_X = G_DIMENSIONS_.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS * 0.5
|
||||
local DIAL_X = __G_INIT_DATA__.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS * 0.5
|
||||
local DIAL_Y = HEADER_BOTTOM_Y + DIAL_RADIUS + DIAL_THICKNESS * 0.5
|
||||
|
||||
local dial = Widget.Dial{
|
||||
|
@ -85,8 +85,8 @@ local inner_ring = Widget.Arc{
|
|||
}
|
||||
|
||||
local LINE_1_Y = HEADER_BOTTOM_Y + TEXT_Y_OFFSET
|
||||
local TEXT_LEFT_X = G_DIMENSIONS_.RIGHT_X + DIAL_RADIUS * 2 + TEXT_LEFT_X_OFFSET
|
||||
local RIGHT_X = G_DIMENSIONS_.RIGHT_X + G_DIMENSIONS_.SECTION_WIDTH
|
||||
local TEXT_LEFT_X = __G_INIT_DATA__.RIGHT_X + DIAL_RADIUS * 2 + TEXT_LEFT_X_OFFSET
|
||||
local RIGHT_X = __G_INIT_DATA__.RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH
|
||||
|
||||
local swap= {
|
||||
label = Widget.Text{
|
||||
|
@ -127,18 +127,18 @@ local cache = {
|
|||
local PLOT_Y = PLOT_SECTION_BREAK + HEADER_BOTTOM_Y + DIAL_RADIUS * 2
|
||||
|
||||
local plot = Widget.LabelPlot{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT
|
||||
}
|
||||
|
||||
local TABLE_Y = PLOT_Y + PLOT_HEIGHT + TABLE_SECTION_BREAK
|
||||
|
||||
local tbl = Widget.Table{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = TABLE_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = TABLE_HEIGHT,
|
||||
'Name',
|
||||
'PID',
|
||||
|
|
|
@ -27,18 +27,18 @@ local __network_label_function = function(bytes)
|
|||
end
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X,
|
||||
y = G_DIMENSIONS_.TOP_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X,
|
||||
y = __G_INIT_DATA__.TOP_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = "NETWORK"
|
||||
}
|
||||
|
||||
local RIGHT_X = G_DIMENSIONS_.CENTER_RIGHT_X + G_DIMENSIONS_.SECTION_WIDTH
|
||||
local RIGHT_X = __G_INIT_DATA__.CENTER_RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH
|
||||
local DOWNLOAD_PLOT_Y = header.bottom_y + PLOT_SEC_BREAK
|
||||
|
||||
local dnload = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X,
|
||||
y = header.bottom_y,
|
||||
text = 'Download',
|
||||
},
|
||||
|
@ -49,9 +49,9 @@ local dnload = {
|
|||
text_color = schema.blue
|
||||
},
|
||||
plot = Widget.ScalePlot{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X,
|
||||
y = DOWNLOAD_PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT,
|
||||
y_label_func = __network_label_function
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ local UPLOAD_PLOT_Y = UPLOAD_Y + PLOT_SEC_BREAK
|
|||
|
||||
local upload = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X,
|
||||
y = UPLOAD_Y,
|
||||
text = 'Upload',
|
||||
},
|
||||
|
@ -73,9 +73,9 @@ local upload = {
|
|||
text_color = schema.blue
|
||||
},
|
||||
plot = Widget.ScalePlot{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X,
|
||||
y = UPLOAD_PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT,
|
||||
y_label_func = __network_label_function
|
||||
}
|
||||
|
|
|
@ -10,14 +10,14 @@ local schema = require 'default_patterns'
|
|||
local TEXT_SPACING = 20
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
y = G_DIMENSIONS_.TOP_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = __G_INIT_DATA__.TOP_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = "PACMAN"
|
||||
}
|
||||
|
||||
local labels = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = header.bottom_y,
|
||||
spacing = TEXT_SPACING,
|
||||
'Total',
|
||||
|
@ -27,7 +27,7 @@ local labels = Widget.TextColumn{
|
|||
'Local'
|
||||
}
|
||||
local info = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.RIGHT_X + G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH,
|
||||
y = header.bottom_y,
|
||||
spacing = TEXT_SPACING,
|
||||
x_align = 'right',
|
||||
|
|
|
@ -25,17 +25,17 @@ local __calculate_power = function(cr, prev_cnt, cnt, update_frequency)
|
|||
end
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = MODULE_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = 'POWER'
|
||||
}
|
||||
|
||||
local RIGHT_X = G_DIMENSIONS_.RIGHT_X + G_DIMENSIONS_.SECTION_WIDTH
|
||||
local RIGHT_X = __G_INIT_DATA__.RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH
|
||||
|
||||
local pp01 = {
|
||||
labels = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = header.bottom_y,
|
||||
spacing = TEXT_SPACING,
|
||||
'Core',
|
||||
|
@ -55,7 +55,7 @@ local pp01 = {
|
|||
local SEP_Y = header.bottom_y + TEXT_SPACING + SEPARATOR_SPACING
|
||||
|
||||
local separator = Widget.Line{
|
||||
p1 = {x = G_DIMENSIONS_.RIGHT_X, y = SEP_Y},
|
||||
p1 = {x = __G_INIT_DATA__.RIGHT_X, y = SEP_Y},
|
||||
p2 = {x = RIGHT_X, y = SEP_Y}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ local PKG0_Y = SEP_Y + SEPARATOR_SPACING
|
|||
|
||||
local pkg0 = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = PKG0_Y,
|
||||
text = 'PKG 0'
|
||||
},
|
||||
|
@ -76,9 +76,9 @@ local pkg0 = {
|
|||
append_end = ' W'
|
||||
},
|
||||
plot = Widget.ScalePlot{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = PKG0_Y + PLOT_SEC_BREAK,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT,
|
||||
y_label_func = __power_label_function,
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ local DRAM_Y = PKG0_Y + PLOT_SEC_BREAK * 2 + PLOT_HEIGHT
|
|||
|
||||
local dram = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = DRAM_Y,
|
||||
text = 'DRAM'
|
||||
},
|
||||
|
@ -101,9 +101,9 @@ local dram = {
|
|||
append_end = ' W'
|
||||
},
|
||||
plot = Widget.ScalePlot{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = DRAM_Y + PLOT_SEC_BREAK,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT,
|
||||
y_label_func = __power_label_function,
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ local BATTERY_DRAW_Y = DRAM_Y + PLOT_SEC_BREAK * 2 + PLOT_HEIGHT
|
|||
|
||||
local battery_draw = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = BATTERY_DRAW_Y,
|
||||
spacing = TEXT_SPACING,
|
||||
text = 'Battery Draw'
|
||||
|
@ -124,9 +124,9 @@ local battery_draw = {
|
|||
x_align = 'right',
|
||||
},
|
||||
plot = Widget.ScalePlot{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = BATTERY_DRAW_Y + PLOT_SEC_BREAK,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT,
|
||||
y_label_func = __power_label_function,
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@ local schema = require 'default_patterns'
|
|||
|
||||
local CORETEMP_PATH = '/sys/devices/platform/coretemp.0/hwmon/hwmon%i/%s'
|
||||
|
||||
local MODULE_Y = 636
|
||||
|
||||
local NUM_PHYSICAL_CORES = 4
|
||||
local NUM_PHYSICAL_CORE_THREADS = 2
|
||||
|
||||
|
@ -25,19 +23,18 @@ for r = 1, NUM_ROWS do
|
|||
TABLE_CONKY[3][r] = '${top cpu '..r..'}'
|
||||
end
|
||||
|
||||
--construction params
|
||||
local DIAL_INNER_RADIUS = 30
|
||||
local DIAL_OUTER_RADIUS = 42
|
||||
local DIAL_SPACING = 1
|
||||
local MODULE_Y_ = 636
|
||||
local DIAL_INNER_RADIUS_ = 30
|
||||
local DIAL_OUTER_RADIUS_ = 42
|
||||
local DIAL_SPACING_ = 1
|
||||
local TEXT_Y_OFFSET_ = 15
|
||||
local SEPARATOR_SPACING_ = 20
|
||||
local PLOT_SECTION_BREAK_ = 23
|
||||
local PLOT_HEIGHT_ = 56
|
||||
local TABLE_SECTION_BREAK_ = 20
|
||||
local TABLE_HEIGHT_ = 114
|
||||
|
||||
local TEXT_Y_OFFSET = 15
|
||||
local SEPARATOR_SPACING = 20
|
||||
local PLOT_SECTION_BREAK = 23
|
||||
local PLOT_HEIGHT = 56
|
||||
local TABLE_SECTION_BREAK = 20
|
||||
local TABLE_HEIGHT = 114
|
||||
|
||||
local CREATE_CORE = function(cores, id, x, y)
|
||||
local create_core_ = function(cores, id, x, y)
|
||||
local conky_threads = {}
|
||||
|
||||
for c = 0, NUM_PHYSICAL_CORES * NUM_PHYSICAL_CORE_THREADS - 1 do
|
||||
|
@ -55,16 +52,16 @@ local CREATE_CORE = function(cores, id, x, y)
|
|||
dials = Widget.CompoundDial{
|
||||
x = x,
|
||||
y = y,
|
||||
inner_radius = DIAL_INNER_RADIUS,
|
||||
outer_radius = DIAL_OUTER_RADIUS,
|
||||
spacing = DIAL_SPACING,
|
||||
inner_radius = DIAL_INNER_RADIUS_,
|
||||
outer_radius = DIAL_OUTER_RADIUS_,
|
||||
spacing = DIAL_SPACING_,
|
||||
num_dials = NUM_PHYSICAL_CORE_THREADS,
|
||||
critical_limit = '>0.8'
|
||||
},
|
||||
inner_ring = Widget.Arc{
|
||||
x = x,
|
||||
y = y,
|
||||
radius = DIAL_INNER_RADIUS - 2,
|
||||
radius = DIAL_INNER_RADIUS_ - 2,
|
||||
theta0 = 0,
|
||||
theta1 = 360
|
||||
},
|
||||
|
@ -82,29 +79,29 @@ local CREATE_CORE = function(cores, id, x, y)
|
|||
end
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
y = MODULE_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = MODULE_Y_,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = "PROCESSOR"
|
||||
}
|
||||
|
||||
local HEADER_BOTTOM_Y = header.bottom_y
|
||||
local HEADER_BOTTOM_Y_ = header.bottom_y
|
||||
|
||||
--we assume that this cpu has 4 physical cores with 2 logical each
|
||||
local cores = {}
|
||||
|
||||
for c = 0, NUM_PHYSICAL_CORES - 1 do
|
||||
local dial_x = G_DIMENSIONS_.LEFT_X + DIAL_OUTER_RADIUS + (G_DIMENSIONS_.SECTION_WIDTH - 2 * DIAL_OUTER_RADIUS) * c / 3
|
||||
CREATE_CORE(cores, c, dial_x, HEADER_BOTTOM_Y + DIAL_OUTER_RADIUS)
|
||||
local dial_x = __G_INIT_DATA__.LEFT_X + DIAL_OUTER_RADIUS_ + (__G_INIT_DATA__.SECTION_WIDTH - 2 * DIAL_OUTER_RADIUS_) * c / 3
|
||||
create_core_(cores, c, dial_x, HEADER_BOTTOM_Y_ + DIAL_OUTER_RADIUS_)
|
||||
end
|
||||
|
||||
local RIGHT_X = G_DIMENSIONS_.LEFT_X + G_DIMENSIONS_.SECTION_WIDTH
|
||||
local RIGHT_X = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH
|
||||
|
||||
local PROCESS_Y = HEADER_BOTTOM_Y + DIAL_OUTER_RADIUS * 2 + PLOT_SECTION_BREAK
|
||||
local PROCESS_Y = HEADER_BOTTOM_Y_ + DIAL_OUTER_RADIUS_ * 2 + PLOT_SECTION_BREAK_
|
||||
|
||||
local process = {
|
||||
labels = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = PROCESS_Y,
|
||||
text = 'R | S | D | T | Z'
|
||||
},
|
||||
|
@ -117,18 +114,18 @@ local process = {
|
|||
}
|
||||
}
|
||||
|
||||
local SEP_Y = PROCESS_Y + SEPARATOR_SPACING
|
||||
local SEP_Y = PROCESS_Y + SEPARATOR_SPACING_
|
||||
|
||||
local separator = Widget.Line{
|
||||
p1 = {x = G_DIMENSIONS_.LEFT_X, y = SEP_Y},
|
||||
p1 = {x = __G_INIT_DATA__.LEFT_X, y = SEP_Y},
|
||||
p2 = {x = RIGHT_X, y = SEP_Y}
|
||||
}
|
||||
|
||||
local LOAD_Y = SEP_Y + SEPARATOR_SPACING
|
||||
local LOAD_Y = SEP_Y + SEPARATOR_SPACING_
|
||||
|
||||
local total_load = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = LOAD_Y,
|
||||
text = 'Total Load'
|
||||
},
|
||||
|
@ -141,22 +138,22 @@ local total_load = {
|
|||
}
|
||||
}
|
||||
|
||||
local PLOT_Y = LOAD_Y + PLOT_SECTION_BREAK
|
||||
local PLOT_Y = LOAD_Y + PLOT_SECTION_BREAK_
|
||||
|
||||
local plot = Widget.LabelPlot{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT_
|
||||
}
|
||||
|
||||
local TABLE_Y = PLOT_Y + PLOT_HEIGHT + TABLE_SECTION_BREAK
|
||||
local TABLE_Y = PLOT_Y + PLOT_HEIGHT_ + TABLE_SECTION_BREAK_
|
||||
|
||||
local tbl = Widget.Table{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = TABLE_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
height = TABLE_HEIGHT,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = TABLE_HEIGHT_,
|
||||
num_rows = NUM_ROWS,
|
||||
'Name',
|
||||
'PID',
|
||||
|
@ -205,18 +202,18 @@ end
|
|||
|
||||
Widget = nil
|
||||
schema = nil
|
||||
MODULE_Y = nil
|
||||
DIAL_INNER_RADIUS = nil
|
||||
DIAL_OUTER_RADIUS = nil
|
||||
DIAL_SPACING = nil
|
||||
TEXT_Y_OFFSET = nil
|
||||
SEPARATOR_SPACING = nil
|
||||
PLOT_SECTION_BREAK = nil
|
||||
PLOT_HEIGHT = nil
|
||||
TABLE_SECTION_BREAK = nil
|
||||
TABLE_HEIGHT = nil
|
||||
CREATE_CORE = nil
|
||||
HEADER_BOTTOM_Y = nil
|
||||
MODULE_Y_ = nil
|
||||
DIAL_INNER_RADIUS_ = nil
|
||||
DIAL_OUTER_RADIUS_ = nil
|
||||
DIAL_SPACING_ = nil
|
||||
TEXT_Y_OFFSET_ = nil
|
||||
SEPARATOR_SPACING_ = nil
|
||||
PLOT_SECTION_BREAK_ = nil
|
||||
PLOT_HEIGHT_ = nil
|
||||
TABLE_SECTION_BREAK_ = nil
|
||||
TABLE_HEIGHT_ = nil
|
||||
create_core_ = nil
|
||||
HEADER_BOTTOM_Y_ = nil
|
||||
LOAD_Y = nil
|
||||
RIGHT_X = nil
|
||||
SEP_Y = nil
|
||||
|
|
|
@ -45,19 +45,19 @@ local __io_label_function = function(bytes)
|
|||
end
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X,
|
||||
y = G_DIMENSIONS_.TOP_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X,
|
||||
y = __G_INIT_DATA__.TOP_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = "INPUT / OUTPUT"
|
||||
}
|
||||
|
||||
local HEADER_BOTTOM_Y = header.bottom_y
|
||||
local RIGHT_X = G_DIMENSIONS_.CENTER_LEFT_X + G_DIMENSIONS_.SECTION_WIDTH
|
||||
local RIGHT_X = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.SECTION_WIDTH
|
||||
local READS_PLOT_Y = header.bottom_y + PLOT_SEC_BREAK
|
||||
|
||||
local reads = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X,
|
||||
y = HEADER_BOTTOM_Y,
|
||||
text = 'Reads',
|
||||
},
|
||||
|
@ -69,9 +69,9 @@ local reads = {
|
|||
text_color = schema.blue
|
||||
},
|
||||
plot = Widget.ScalePlot{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X,
|
||||
y = READS_PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT,
|
||||
y_label_func = __io_label_function,
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ local WRITES_PLOT_Y = WRITE_Y + PLOT_SEC_BREAK
|
|||
|
||||
local writes = {
|
||||
label = Widget.Text{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X,
|
||||
y = WRITE_Y,
|
||||
text = 'Writes',
|
||||
},
|
||||
|
@ -94,9 +94,9 @@ local writes = {
|
|||
text_color = schema.blue
|
||||
},
|
||||
plot = Widget.ScalePlot{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X,
|
||||
y = WRITES_PLOT_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
height = PLOT_HEIGHT,
|
||||
y_label_func = __io_label_function,
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ local SYNC_CMD = "sed -n '/ synchronizing package lists/p' /var/log/pacman.log |
|
|||
local TEXT_SPACING = 20
|
||||
|
||||
local header = Widget.Header{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
y = G_DIMENSIONS_.TOP_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = __G_INIT_DATA__.TOP_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = "SYSTEM"
|
||||
}
|
||||
|
||||
local labels = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = header.bottom_y,
|
||||
spacing = TEXT_SPACING,
|
||||
'Kernel',
|
||||
|
@ -33,7 +33,7 @@ local labels = Widget.TextColumn{
|
|||
'Last Sync'
|
||||
}
|
||||
local info = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.LEFT_X + G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH,
|
||||
y = header.bottom_y,
|
||||
spacing = TEXT_SPACING,
|
||||
x_align = 'right',
|
||||
|
|
|
@ -20,7 +20,7 @@ local SECTIONS = 8
|
|||
local WEATHER_UPDATE_INTERVAL = 900
|
||||
|
||||
local WEATHER_PATH = '/tmp/weather.json'
|
||||
local ICON_PATH = G_DIMENSIONS_.ABS_PATH .. '/images/weather/'
|
||||
local ICON_PATH = __G_INIT_DATA__.ABS_PATH .. '/images/weather/'
|
||||
local RECENTLY_UPDATED_PATH = '/tmp/weather_recently_updated'
|
||||
local NA = 'N/A'
|
||||
local NA_IMAGE_PATH = ICON_PATH .. 'na.png'
|
||||
|
@ -46,7 +46,7 @@ local __create_side_section = function(x_offset, y_offset, section_table)
|
|||
}
|
||||
|
||||
current_widget.period = Widget.Text{
|
||||
x = x_offset + G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = x_offset + __G_INIT_DATA__.SECTION_WIDTH,
|
||||
y = current_y,
|
||||
x_align = 'right',
|
||||
text_color = schema.blue
|
||||
|
@ -84,7 +84,7 @@ local __create_side_section = function(x_offset, y_offset, section_table)
|
|||
}
|
||||
|
||||
current_widget.info_column = Widget.TextColumn{
|
||||
x = x_offset + G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = x_offset + __G_INIT_DATA__.SECTION_WIDTH,
|
||||
y = current_y + HEADER_PAD + 10,
|
||||
spacing = SPACING,
|
||||
x_align = 'right',
|
||||
|
@ -99,7 +99,7 @@ local __create_side_section = function(x_offset, y_offset, section_table)
|
|||
y = current_y + SECTION_HEIGHT - 18
|
||||
},
|
||||
p2 = {
|
||||
x = x_offset + G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = x_offset + __G_INIT_DATA__.SECTION_WIDTH,
|
||||
y = current_y + SECTION_HEIGHT - 18
|
||||
},
|
||||
line_pattern = schema.mid_grey
|
||||
|
@ -111,34 +111,34 @@ end
|
|||
--LEFT
|
||||
local left = {
|
||||
header = Widget.Header{
|
||||
x = G_DIMENSIONS_.LEFT_X,
|
||||
y = G_DIMENSIONS_.TOP_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.LEFT_X,
|
||||
y = __G_INIT_DATA__.TOP_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = 'HOURLY FORECAST'
|
||||
},
|
||||
hours = {}
|
||||
}
|
||||
|
||||
__create_side_section(G_DIMENSIONS_.LEFT_X, left.header.bottom_y, left.hours)
|
||||
__create_side_section(__G_INIT_DATA__.LEFT_X, left.header.bottom_y, left.hours)
|
||||
|
||||
--CENTER
|
||||
local center = {}
|
||||
|
||||
center.header = Widget.Header{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X,
|
||||
y = G_DIMENSIONS_.TOP_Y,
|
||||
width = G_DIMENSIONS_.CENTER_WIDTH,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X,
|
||||
y = __G_INIT_DATA__.TOP_Y,
|
||||
width = __G_INIT_DATA__.CENTER_WIDTH,
|
||||
header = 'CURRENT CONDITIONS'
|
||||
}
|
||||
|
||||
center.current_desc = Widget.Text{
|
||||
x = G_DIMENSIONS_.CENTER_LEFT_X,
|
||||
x = __G_INIT_DATA__.CENTER_LEFT_X,
|
||||
y = center.header.bottom_y + 8,
|
||||
text_color = schema.blue,
|
||||
font_size = 24
|
||||
}
|
||||
|
||||
local CENTER_X_1 = G_DIMENSIONS_.CENTER_LEFT_X + G_DIMENSIONS_.SECTION_WIDTH * 0.25
|
||||
local CENTER_X_1 = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.SECTION_WIDTH * 0.25
|
||||
local CENTER_ICON_WIDTH = 120
|
||||
local CENTER_ICON_Y = center.header.bottom_y + 105 - CENTER_ICON_WIDTH / 2
|
||||
|
||||
|
@ -149,7 +149,7 @@ center.icon = Widget.ScaledImage{
|
|||
height = CENTER_ICON_WIDTH
|
||||
}
|
||||
|
||||
local CENTER_X_2 = G_DIMENSIONS_.CENTER_LEFT_X + G_DIMENSIONS_.SECTION_WIDTH * 0.70
|
||||
local CENTER_X_2 = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.SECTION_WIDTH * 0.70
|
||||
local INFO_Y = center.header.bottom_y + 70
|
||||
|
||||
center.current_temp = Widget.Text{
|
||||
|
@ -178,7 +178,7 @@ local COLUMN_PADDING = 15
|
|||
local CENTER_SPACING = SPACING + 7
|
||||
|
||||
center.label_column_1 = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X,
|
||||
y = center.header.bottom_y,
|
||||
spacing = CENTER_SPACING,
|
||||
font_size = 14,
|
||||
|
@ -192,7 +192,7 @@ center.label_column_1 = Widget.TextColumn{
|
|||
}
|
||||
|
||||
center.info_column_1 = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X + (G_DIMENSIONS_.SECTION_WIDTH - COLUMN_PADDING) / 2,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X + (__G_INIT_DATA__.SECTION_WIDTH - COLUMN_PADDING) / 2,
|
||||
y = center.header.bottom_y,
|
||||
x_align = 'right',
|
||||
text_color = schema.blue,
|
||||
|
@ -202,7 +202,7 @@ center.info_column_1 = Widget.TextColumn{
|
|||
}
|
||||
|
||||
center.label_column_2 = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X + (G_DIMENSIONS_.SECTION_WIDTH + COLUMN_PADDING) / 2,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X + (__G_INIT_DATA__.SECTION_WIDTH + COLUMN_PADDING) / 2,
|
||||
y = center.header.bottom_y,
|
||||
spacing = CENTER_SPACING,
|
||||
font_size = 14,
|
||||
|
@ -216,7 +216,7 @@ center.label_column_2 = Widget.TextColumn{
|
|||
}
|
||||
|
||||
center.info_column_2 = Widget.TextColumn{
|
||||
x = G_DIMENSIONS_.CENTER_RIGHT_X + G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.CENTER_RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH,
|
||||
y = center.header.bottom_y,
|
||||
x_align = 'right',
|
||||
text_color = schema.blue,
|
||||
|
@ -229,15 +229,15 @@ center.info_column_2 = Widget.TextColumn{
|
|||
|
||||
local right = {
|
||||
header = Widget.Header{
|
||||
x = G_DIMENSIONS_.RIGHT_X,
|
||||
y = G_DIMENSIONS_.TOP_Y,
|
||||
width = G_DIMENSIONS_.SECTION_WIDTH,
|
||||
x = __G_INIT_DATA__.RIGHT_X,
|
||||
y = __G_INIT_DATA__.TOP_Y,
|
||||
width = __G_INIT_DATA__.SECTION_WIDTH,
|
||||
header = '8 DAY FORECAST'
|
||||
},
|
||||
days = {}
|
||||
}
|
||||
|
||||
__create_side_section(G_DIMENSIONS_.RIGHT_X, right.header.bottom_y, right.days)
|
||||
__create_side_section(__G_INIT_DATA__.RIGHT_X, right.header.bottom_y, right.days)
|
||||
|
||||
Widget = nil
|
||||
schema = nil
|
||||
|
|
Loading…
Reference in New Issue