make widget and patterns global vars so we can control their destruction easier through main.lua

This commit is contained in:
petrucci4prez 2017-07-20 00:49:24 -04:00
parent 003dbaa3b9
commit 3ca319bd7e
11 changed files with 135 additions and 172 deletions

View File

@ -1,4 +1,3 @@
local Widget = require 'Widget'
local Text = require 'Text' local Text = require 'Text'
local Line = require 'Line' local Line = require 'Line'
local TextColumn = require 'TextColumn' local TextColumn = require 'TextColumn'
@ -14,14 +13,14 @@ local _BAR_PAD_ = 100
local FS_NUM = #_FS_PATHS_ local FS_NUM = #_FS_PATHS_
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _MODULE_Y_, y = _MODULE_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
header = 'FILE SYSTEMS' header = 'FILE SYSTEMS'
} }
local labels = Widget.TextColumn{ local labels = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = header.bottom_y, y = header.bottom_y,
spacing = _SPACING_, spacing = _SPACING_,
@ -39,7 +38,7 @@ for i, v in pairs(_FS_PATHS_) do
conky_used_perc[i] = '${fs_used_perc '..v..'}' conky_used_perc[i] = '${fs_used_perc '..v..'}'
end end
local bars = Widget.CompoundBar{ local bars = _G_Widget_.CompoundBar{
x = _G_INIT_DATA_.RIGHT_X + _BAR_PAD_, x = _G_INIT_DATA_.RIGHT_X + _BAR_PAD_,
y = header.bottom_y, y = header.bottom_y,
length = _G_INIT_DATA_.SECTION_WIDTH - _BAR_PAD_, length = _G_INIT_DATA_.SECTION_WIDTH - _BAR_PAD_,
@ -48,8 +47,6 @@ local bars = Widget.CompoundBar{
critical_limit = '>0.8' critical_limit = '>0.8'
} }
Widget = nil
_SPACING_ = nil _SPACING_ = nil
_BAR_PAD_ = nil _BAR_PAD_ = nil
_FS_PATHS_ = nil _FS_PATHS_ = nil

View File

@ -1,11 +1,9 @@
local Widget = require 'Widget'
local CriticalText = require 'CriticalText' local CriticalText = require 'CriticalText'
local Text = require 'Text' local Text = require 'Text'
local TextColumn = require 'TextColumn' local TextColumn = require 'TextColumn'
local Line = require 'Line' local Line = require 'Line'
local LabelPlot = require 'LabelPlot' local LabelPlot = require 'LabelPlot'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local __tonumber = tonumber local __tonumber = tonumber
local __string_find = string.find local __string_find = string.find
@ -17,7 +15,7 @@ local _TEXT_SPACING_ = 20
local _PLOT_SEC_BREAK_ = 20 local _PLOT_SEC_BREAK_ = 20
local _PLOT_HEIGHT_ = 56 local _PLOT_HEIGHT_ = 56
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _MODULE_Y_, y = _MODULE_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -27,23 +25,23 @@ local header = Widget.Header{
local _RIGHT_X_ = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH local _RIGHT_X_ = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH
local status = { local status = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = header.bottom_y, y = header.bottom_y,
text = 'Status' text = 'Status'
}, },
value = Widget.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = header.bottom_y, y = header.bottom_y,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<status>' text = '<status>'
} }
} }
local _SEP_Y_1_ = header.bottom_y + _SEPARATOR_SPACING_ local _SEP_Y_1_ = header.bottom_y + _SEPARATOR_SPACING_
local separator1 = 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_}
} }
@ -51,16 +49,16 @@ local separator1 = Widget.Line{
local _INTERNAL_TEMP_Y_ = _SEP_Y_1_ + _SEPARATOR_SPACING_ local _INTERNAL_TEMP_Y_ = _SEP_Y_1_ + _SEPARATOR_SPACING_
local internal_temp = { local internal_temp = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _INTERNAL_TEMP_Y_, y = _INTERNAL_TEMP_Y_,
text = 'Internal Temperature' text = 'Internal Temperature'
}, },
value = Widget.CriticalText{ value = _G_Widget_.CriticalText{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _INTERNAL_TEMP_Y_, y = _INTERNAL_TEMP_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<gpu_temp>' text = '<gpu_temp>'
} }
} }
@ -68,23 +66,23 @@ local internal_temp = {
local _PCI_UTIL_Y_ = _INTERNAL_TEMP_Y_ + _TEXT_SPACING_ local _PCI_UTIL_Y_ = _INTERNAL_TEMP_Y_ + _TEXT_SPACING_
local pci_util = { local pci_util = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _PCI_UTIL_Y_, y = _PCI_UTIL_Y_,
text = 'PCI Utilization' text = 'PCI Utilization'
}, },
value = Widget.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _PCI_UTIL_Y_, y = _PCI_UTIL_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<pci_util>' text = '<pci_util>'
} }
} }
local _SEP_Y_2_ = _PCI_UTIL_Y_ + _SEPARATOR_SPACING_ local _SEP_Y_2_ = _PCI_UTIL_Y_ + _SEPARATOR_SPACING_
local separator2 = 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_}
} }
@ -92,26 +90,26 @@ local separator2 = Widget.Line{
local _CLOCK_SPEED_Y_ = _SEP_Y_2_ + _SEPARATOR_SPACING_ local _CLOCK_SPEED_Y_ = _SEP_Y_2_ + _SEPARATOR_SPACING_
local clock_speed = { local clock_speed = {
labels = Widget.TextColumn{ labels = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _CLOCK_SPEED_Y_, y = _CLOCK_SPEED_Y_,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
'GPU Clock Speed', 'GPU Clock Speed',
'Memory Clock Speed' 'Memory Clock Speed'
}, },
values = Widget.TextColumn{ values = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH, x = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = _CLOCK_SPEED_Y_, y = _CLOCK_SPEED_Y_,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
num_rows = 2 num_rows = 2
} }
} }
local _SEP_Y_3_ = _CLOCK_SPEED_Y_ + _TEXT_SPACING_ * 2 local _SEP_Y_3_ = _CLOCK_SPEED_Y_ + _TEXT_SPACING_ * 2
local separator3 = 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_}
} }
@ -119,19 +117,19 @@ local separator3 = Widget.Line{
local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_ local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_
local gpu_util = { local gpu_util = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _GPU_UTIL_Y_, y = _GPU_UTIL_Y_,
text = 'GPU Utilization' text = 'GPU Utilization'
}, },
value = Widget.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _GPU_UTIL_Y_, y = _GPU_UTIL_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<gpu_util>' text = '<gpu_util>'
}, },
plot = Widget.LabelPlot{ plot = _G_Widget_.LabelPlot{
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,
@ -142,19 +140,19 @@ local gpu_util = {
local _MEM_UTIL_Y_ = _GPU_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2 local _MEM_UTIL_Y_ = _GPU_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
local mem_util = { local mem_util = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _MEM_UTIL_Y_, y = _MEM_UTIL_Y_,
text = 'Memory Utilization' text = 'Memory Utilization'
}, },
value = Widget.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _MEM_UTIL_Y_, y = _MEM_UTIL_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<mem_util>' text = '<mem_util>'
}, },
plot = Widget.LabelPlot{ plot = _G_Widget_.LabelPlot{
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,
@ -165,19 +163,19 @@ local mem_util = {
local _VID_UTIL_Y_ = _MEM_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2 local _VID_UTIL_Y_ = _MEM_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
local vid_util = { local vid_util = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _VID_UTIL_Y_, y = _VID_UTIL_Y_,
text = 'Video Utilization' text = 'Video Utilization'
}, },
value = Widget.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _VID_UTIL_Y_, y = _VID_UTIL_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<vid_util>' text = '<vid_util>'
}, },
plot = Widget.LabelPlot{ plot = _G_Widget_.LabelPlot{
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,
@ -272,8 +270,6 @@ local update = function(cr)
end end
end end
Widget = nil
Patterns = nil
_MODULE_Y_ = nil _MODULE_Y_ = nil
_SEPARATOR_SPACING_ = nil _SEPARATOR_SPACING_ = nil
_TEXT_SPACING_ = nil _TEXT_SPACING_ = nil

View File

@ -1,4 +1,3 @@
local Widget = require 'Widget'
local Arc = require 'Arc' local Arc = require 'Arc'
local Dial = require 'Dial' local Dial = require 'Dial'
local CriticalText = require 'CriticalText' local CriticalText = require 'CriticalText'
@ -8,7 +7,6 @@ local Line = require 'Line'
local LabelPlot = require 'LabelPlot' local LabelPlot = require 'LabelPlot'
local Table = require 'Table' local Table = require 'Table'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local __string_match = string.match local __string_match = string.match
local __cairo_path_destroy = cairo_path_destroy local __cairo_path_destroy = cairo_path_destroy
@ -42,7 +40,7 @@ for r = 1, NUM_ROWS do
TABLE_CONKY[3][r] = '${top_mem mem '..r..'}' TABLE_CONKY[3][r] = '${top_mem mem '..r..'}'
end end
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _MODULE_Y_, y = _MODULE_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -55,22 +53,22 @@ local DIAL_THETA_1 = math.rad(360)
local DIAL_X = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS + _DIAL_THICKNESS_ / 2 local DIAL_X = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
local DIAL_Y = header.bottom_y + DIAL_RADIUS + _DIAL_THICKNESS_ / 2 local DIAL_Y = header.bottom_y + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
local dial = Widget.Dial{ local dial = _G_Widget_.Dial{
x = DIAL_X, x = DIAL_X,
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'
} }
local cache_arc = Widget.Arc{ local cache_arc = _G_Widget_.Arc{
x = DIAL_X, x = DIAL_X,
y = DIAL_Y, y = DIAL_Y,
radius = DIAL_RADIUS, radius = DIAL_RADIUS,
thickness = _DIAL_THICKNESS_, thickness = _DIAL_THICKNESS_,
arc_pattern = Patterns.PURPLE_ROUNDED arc_pattern = _G_Patterns_.PURPLE_ROUNDED
} }
local total_used = Widget.CriticalText{ local total_used = _G_Widget_.CriticalText{
x = DIAL_X, x = DIAL_X,
y = DIAL_Y, y = DIAL_Y,
x_align = 'center', x_align = 'center',
@ -78,7 +76,7 @@ local total_used = Widget.CriticalText{
append_end = '%' append_end = '%'
} }
local inner_ring = Widget.Arc{ local inner_ring = _G_Widget_.Arc{
x = DIAL_X, x = DIAL_X,
y = DIAL_Y, y = DIAL_Y,
radius = DIAL_RADIUS - _DIAL_THICKNESS_ / 2 - 2, radius = DIAL_RADIUS - _DIAL_THICKNESS_ / 2 - 2,
@ -91,13 +89,13 @@ local _TEXT_LEFT_X_ = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS * 2 + _TEXT_LEFT_X_OFF
local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
local swap= { local swap= {
label = Widget.Text{ label = _G_Widget_.Text{
x = _TEXT_LEFT_X_, x = _TEXT_LEFT_X_,
y = _LINE_1_Y_, y = _LINE_1_Y_,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
text = 'Swap Usage' text = 'Swap Usage'
}, },
percent = Widget.CriticalText{ percent = _G_Widget_.CriticalText{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _LINE_1_Y_, y = _LINE_1_Y_,
x_align = 'right', x_align = 'right',
@ -106,7 +104,7 @@ local swap= {
} }
local cache = { local cache = {
labels = Widget.TextColumn{ labels = _G_Widget_.TextColumn{
x = _TEXT_LEFT_X_, x = _TEXT_LEFT_X_,
y = _LINE_1_Y_ + _TEXT_SPACING_, y = _LINE_1_Y_ + _TEXT_SPACING_,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
@ -114,12 +112,12 @@ local cache = {
'Buffers', 'Buffers',
'Kernel Slab' 'Kernel Slab'
}, },
percents = Widget.TextColumn{ percents = _G_Widget_.TextColumn{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _LINE_1_Y_ + _TEXT_SPACING_, y = _LINE_1_Y_ + _TEXT_SPACING_,
x_align = 'right', x_align = 'right',
append_end = ' %', append_end = ' %',
text_color = Patterns.PURPLE, text_color = _G_Patterns_.PURPLE,
'<cached_kb>', '<cached_kb>',
'<buffers_kb>', '<buffers_kb>',
'<kernel_slab>' '<kernel_slab>'
@ -128,14 +126,14 @@ local cache = {
local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2 local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2
local plot = Widget.LabelPlot{ 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_
} }
local tbl = Widget.Table{ local tbl = _G_Widget_.Table{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
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,
@ -184,8 +182,6 @@ local update = function(cr)
end end
end end
Widget = nil
Patterns = nil
_MODULE_Y_ = nil _MODULE_Y_ = nil
_DIAL_THICKNESS_ = nil _DIAL_THICKNESS_ = nil
_DIAL_SPACING_ = nil _DIAL_SPACING_ = nil

View File

@ -1,9 +1,7 @@
local Widget = require 'Widget'
local Text = require 'Text' local Text = require 'Text'
local Line = require 'Line' local Line = require 'Line'
local ScalePlot = require 'ScalePlot' local ScalePlot = require 'ScalePlot'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local __string_gmatch = string.gmatch local __string_gmatch = string.gmatch
@ -20,7 +18,7 @@ local network_label_function = function(bytes)
return Util.round_to_string(converted, precision)..' '..new_unit..'/s' return Util.round_to_string(converted, precision)..' '..new_unit..'/s'
end end
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.CENTER_RIGHT_X, x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = _G_INIT_DATA_.TOP_Y, y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -30,18 +28,18 @@ local header = Widget.Header{
local _RIGHT_X_ = _G_INIT_DATA_.CENTER_RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH local _RIGHT_X_ = _G_INIT_DATA_.CENTER_RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
local dnload = { local dnload = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.CENTER_RIGHT_X, x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = header.bottom_y, y = header.bottom_y,
text = 'Download', text = 'Download',
}, },
speed = Widget.Text{ speed = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = header.bottom_y, y = header.bottom_y,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE text_color = _G_Patterns_.BLUE
}, },
plot = Widget.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.CENTER_RIGHT_X, x = _G_INIT_DATA_.CENTER_RIGHT_X,
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,
@ -53,18 +51,18 @@ local dnload = {
local _UPLOAD_Y_ = header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2 local _UPLOAD_Y_ = header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
local upload = { local upload = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.CENTER_RIGHT_X, x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = _UPLOAD_Y_, y = _UPLOAD_Y_,
text = 'Upload', text = 'Upload',
}, },
speed = Widget.Text{ speed = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _UPLOAD_Y_, y = _UPLOAD_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE text_color = _G_Patterns_.BLUE
}, },
plot = Widget.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.CENTER_RIGHT_X, x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = _UPLOAD_Y_ + _PLOT_SEC_BREAK_, y = _UPLOAD_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -127,8 +125,6 @@ local update = function(cr, update_frequency)
ScalePlot.update(upload.plot, cr, uspeed) ScalePlot.update(upload.plot, cr, uspeed)
end end
Widget = nil
Patterns = nil
_PLOT_SEC_BREAK_ = nil _PLOT_SEC_BREAK_ = nil
_PLOT_HEIGHT_ = nil _PLOT_HEIGHT_ = nil
_RIGHT_X_ = nil _RIGHT_X_ = nil

View File

@ -1,9 +1,7 @@
local Widget = require 'Widget'
local Text = require 'Text' local Text = require 'Text'
local Line = require 'Line' local Line = require 'Line'
local TextColumn = require 'TextColumn' local TextColumn = require 'TextColumn'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local PACMAN_TABLE = { local PACMAN_TABLE = {
'pacman -Qq', 'pacman -Qq',
@ -15,14 +13,14 @@ local PACMAN_TABLE = {
local _TEXT_SPACING_ = 20 local _TEXT_SPACING_ = 20
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _G_INIT_DATA_.TOP_Y, y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
header = 'PACMAN' header = 'PACMAN'
} }
local labels = Widget.TextColumn{ local labels = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
@ -32,17 +30,15 @@ local labels = Widget.TextColumn{
'Orphaned', 'Orphaned',
'Local' 'Local'
} }
local info = Widget.TextColumn{ local info = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH, x = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
num_rows = 5 num_rows = 5
} }
Widget = nil
Patterns = nil
_TEXT_SPACING_ = nil _TEXT_SPACING_ = nil
local update = function(cr) local update = function(cr)

View File

@ -1,10 +1,8 @@
local Widget = require 'Widget'
local Text = require 'Text' local Text = require 'Text'
local TextColumn = require 'TextColumn' local TextColumn = require 'TextColumn'
local Line = require 'Line' local Line = require 'Line'
local ScalePlot = require 'ScalePlot' local ScalePlot = require 'ScalePlot'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local _MODULE_Y_ = 328 local _MODULE_Y_ = 328
local _SEPARATOR_SPACING_ = 20 local _SEPARATOR_SPACING_ = 20
@ -22,7 +20,7 @@ local calculate_power = function(cr, prev_cnt, cnt, update_frequency)
end end
end end
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _MODULE_Y_, y = _MODULE_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -32,19 +30,19 @@ local header = Widget.Header{
local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
local pp01 = { local pp01 = {
labels = Widget.TextColumn{ labels = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
'Core', 'Core',
'iGPU' 'iGPU'
}, },
values = Widget.TextColumn{ values = _G_Widget_.TextColumn{
x = _RIGHT_X_, x = _RIGHT_X_,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
append_end = ' W', append_end = ' W',
num_rows = 2 num_rows = 2
} }
@ -52,7 +50,7 @@ local pp01 = {
local _SEP_Y_ = header.bottom_y + _TEXT_SPACING_ + _SEPARATOR_SPACING_ local _SEP_Y_ = header.bottom_y + _TEXT_SPACING_ + _SEPARATOR_SPACING_
local separator = Widget.Line{ local separator = _G_Widget_.Line{
p1 = {x = _G_INIT_DATA_.RIGHT_X, y = _SEP_Y_}, p1 = {x = _G_INIT_DATA_.RIGHT_X, y = _SEP_Y_},
p2 = {x = _RIGHT_X_, y = _SEP_Y_} p2 = {x = _RIGHT_X_, y = _SEP_Y_}
} }
@ -60,20 +58,20 @@ local separator = Widget.Line{
local _PKG0_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_ local _PKG0_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
local pkg0 = { local pkg0 = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _PKG0_Y_, y = _PKG0_Y_,
text = 'PKG 0' text = 'PKG 0'
}, },
value = Widget.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _PKG0_Y_, y = _PKG0_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<pkg0>', text = '<pkg0>',
append_end = ' W' append_end = ' W'
}, },
plot = Widget.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _PKG0_Y_ + _PLOT_SEC_BREAK_, y = _PKG0_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -85,20 +83,20 @@ local pkg0 = {
local _DRAM_Y_ = _PKG0_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_ local _DRAM_Y_ = _PKG0_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_
local dram = { local dram = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _DRAM_Y_, y = _DRAM_Y_,
text = 'DRAM' text = 'DRAM'
}, },
value = Widget.Text{ value = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _DRAM_Y_, y = _DRAM_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<dram>', text = '<dram>',
append_end = ' W' append_end = ' W'
}, },
plot = Widget.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _DRAM_Y_ + _PLOT_SEC_BREAK_, y = _DRAM_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -110,18 +108,18 @@ local dram = {
local _BATTERY_DRAW_Y_ = _DRAM_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_ local _BATTERY_DRAW_Y_ = _DRAM_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_
local battery_draw = { local battery_draw = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _BATTERY_DRAW_Y_, y = _BATTERY_DRAW_Y_,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
text = 'Battery Draw' text = 'Battery Draw'
}, },
value = Widget.CriticalText{ value = _G_Widget_.CriticalText{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _BATTERY_DRAW_Y_, y = _BATTERY_DRAW_Y_,
x_align = 'right', x_align = 'right',
}, },
plot = Widget.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _BATTERY_DRAW_Y_ + _PLOT_SEC_BREAK_, y = _BATTERY_DRAW_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -179,8 +177,6 @@ local update = function(cr, update_frequency, is_using_ac)
end end
end end
Widget = nil
Patterns = nil
_MODULE_Y_ = nil _MODULE_Y_ = nil
_SEPARATOR_SPACING_ = nil _SEPARATOR_SPACING_ = nil
_TEXT_SPACING_ = nil _TEXT_SPACING_ = nil

View File

@ -1,4 +1,3 @@
local Widget = require 'Widget'
local Arc = require 'Arc' local Arc = require 'Arc'
local CompoundDial = require 'CompoundDial' local CompoundDial = require 'CompoundDial'
local CriticalText = require 'CriticalText' local CriticalText = require 'CriticalText'
@ -7,7 +6,6 @@ local Line = require 'Line'
local LabelPlot = require 'LabelPlot' local LabelPlot = require 'LabelPlot'
local Table = require 'Table' local Table = require 'Table'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local CORETEMP_PATH = '/sys/devices/platform/coretemp.0/hwmon/hwmon%i/%s' local CORETEMP_PATH = '/sys/devices/platform/coretemp.0/hwmon/hwmon%i/%s'
@ -49,7 +47,7 @@ local _create_core_ = function(cores, id, x, y)
end end
cores[id +1] = { cores[id +1] = {
dials = Widget.CompoundDial{ dials = _G_Widget_.CompoundDial{
x = x, x = x,
y = y, y = y,
inner_radius = _DIAL_INNER_RADIUS_, inner_radius = _DIAL_INNER_RADIUS_,
@ -58,14 +56,14 @@ local _create_core_ = function(cores, id, x, y)
num_dials = NUM_THREADS_PER_CORE, num_dials = NUM_THREADS_PER_CORE,
critical_limit = '>0.8' critical_limit = '>0.8'
}, },
inner_ring = Widget.Arc{ inner_ring = _G_Widget_.Arc{
x = x, x = x,
y = y, y = y,
radius = _DIAL_INNER_RADIUS_ - 2, radius = _DIAL_INNER_RADIUS_ - 2,
theta0 = 0, theta0 = 0,
theta1 = 360 theta1 = 360
}, },
coretemp_text = Widget.CriticalText{ coretemp_text = _G_Widget_.CriticalText{
x = x, x = x,
y = y, y = y,
x_align = 'center', x_align = 'center',
@ -78,7 +76,7 @@ local _create_core_ = function(cores, id, x, y)
} }
end end
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _MODULE_Y_, y = _MODULE_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -100,23 +98,23 @@ 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 = { local process = {
labels = Widget.Text{ labels = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _PROCESS_Y_, y = _PROCESS_Y_,
text = 'R | S | D | T | Z' text = 'R | S | D | T | Z'
}, },
values = Widget.Text{ values = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _PROCESS_Y_, y = _PROCESS_Y_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
text = '<R.S.D.T.Z>' text = '<R.S.D.T.Z>'
} }
} }
local _SEP_Y_ = _PROCESS_Y_ + _SEPARATOR_SPACING_ local _SEP_Y_ = _PROCESS_Y_ + _SEPARATOR_SPACING_
local separator = 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_}
} }
@ -124,12 +122,12 @@ local separator = Widget.Line{
local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_ local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
local total_load = { local total_load = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _LOAD_Y_, y = _LOAD_Y_,
text = 'Total Load' text = 'Total Load'
}, },
value = Widget.CriticalText{ value = _G_Widget_.CriticalText{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _LOAD_Y_, y = _LOAD_Y_,
x_align = 'right', x_align = 'right',
@ -140,14 +138,14 @@ local total_load = {
local _PLOT_Y_ = _LOAD_Y_ + _PLOT_SECTION_BREAK_ local _PLOT_Y_ = _LOAD_Y_ + _PLOT_SECTION_BREAK_
local plot = Widget.LabelPlot{ 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_
} }
local tbl = Widget.Table{ local tbl = _G_Widget_.Table{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
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,
@ -198,8 +196,6 @@ local update = function(cr)
end end
end end
Widget = nil
Patterns = nil
_MODULE_Y_ = nil _MODULE_Y_ = nil
_DIAL_INNER_RADIUS_ = nil _DIAL_INNER_RADIUS_ = nil
_DIAL_OUTER_RADIUS_ = nil _DIAL_OUTER_RADIUS_ = nil

View File

@ -1,9 +1,7 @@
local Widget = require 'Widget'
local Text = require 'Text' local Text = require 'Text'
local Line = require 'Line' local Line = require 'Line'
local ScalePlot = require 'ScalePlot' local ScalePlot = require 'ScalePlot'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local __tonumber = tonumber local __tonumber = tonumber
local __string_match = string.match local __string_match = string.match
@ -49,7 +47,7 @@ local io_label_function = function(bytes)
return Util.round_to_string(converted, precision)..' '..new_unit..'/s' return Util.round_to_string(converted, precision)..' '..new_unit..'/s'
end end
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.CENTER_LEFT_X, x = _G_INIT_DATA_.CENTER_LEFT_X,
y = _G_INIT_DATA_.TOP_Y, y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -59,19 +57,19 @@ local header = Widget.Header{
local _RIGHT_X_ = _G_INIT_DATA_.CENTER_LEFT_X + _G_INIT_DATA_.SECTION_WIDTH local _RIGHT_X_ = _G_INIT_DATA_.CENTER_LEFT_X + _G_INIT_DATA_.SECTION_WIDTH
local reads = { local reads = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.CENTER_LEFT_X, x = _G_INIT_DATA_.CENTER_LEFT_X,
y = header.bottom_y, y = header.bottom_y,
text = 'Reads', text = 'Reads',
}, },
rate = Widget.Text{ rate = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = header.bottom_y, y = header.bottom_y,
x_align = 'right', x_align = 'right',
append_end=' B/s', append_end=' B/s',
text_color = Patterns.BLUE text_color = _G_Patterns_.BLUE
}, },
plot = Widget.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.CENTER_LEFT_X, x = _G_INIT_DATA_.CENTER_LEFT_X,
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,
@ -83,19 +81,19 @@ local reads = {
local _WRITE_Y_ = header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2 local _WRITE_Y_ = header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
local writes = { local writes = {
label = Widget.Text{ label = _G_Widget_.Text{
x = _G_INIT_DATA_.CENTER_LEFT_X, x = _G_INIT_DATA_.CENTER_LEFT_X,
y = _WRITE_Y_, y = _WRITE_Y_,
text = 'Writes', text = 'Writes',
}, },
rate = Widget.Text{ rate = _G_Widget_.Text{
x = _RIGHT_X_, x = _RIGHT_X_,
y = _WRITE_Y_, y = _WRITE_Y_,
x_align = 'right', x_align = 'right',
append_end =' B/s', append_end =' B/s',
text_color = Patterns.BLUE text_color = _G_Patterns_.BLUE
}, },
plot = Widget.ScalePlot{ plot = _G_Widget_.ScalePlot{
x = _G_INIT_DATA_.CENTER_LEFT_X, x = _G_INIT_DATA_.CENTER_LEFT_X,
y = _WRITE_Y_ + _PLOT_SEC_BREAK_, y = _WRITE_Y_ + _PLOT_SEC_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -104,8 +102,6 @@ local writes = {
} }
} }
Widget = nil
Patterns = nil
_PLOT_SEC_BREAK_ = nil _PLOT_SEC_BREAK_ = nil
_PLOT_HEIGHT_ = nil _PLOT_HEIGHT_ = nil
_RIGHT_X_ = nil _RIGHT_X_ = nil

View File

@ -1,9 +1,7 @@
local Widget = require 'Widget'
local Text = require 'Text' local Text = require 'Text'
local Line = require 'Line' local Line = require 'Line'
local TextColumn = require 'TextColumn' local TextColumn = require 'TextColumn'
local Util = require 'Util' local Util = require 'Util'
local Patterns = require 'Patterns'
local __string_match = string.match local __string_match = string.match
@ -14,14 +12,14 @@ local extract_date = function(cmd)
return mm_dd..'-'..yyyy return mm_dd..'-'..yyyy
end end
local header = Widget.Header{ local header = _G_Widget_.Header{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _G_INIT_DATA_.TOP_Y, y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
header = 'SYSTEM' header = 'SYSTEM'
} }
local labels = Widget.TextColumn{ local labels = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
@ -30,20 +28,18 @@ local labels = Widget.TextColumn{
'Last Upgrade', 'Last Upgrade',
'Last Sync' 'Last Sync'
} }
local info = Widget.TextColumn{ local info = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH, x = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = header.bottom_y, y = header.bottom_y,
spacing = _TEXT_SPACING_, spacing = _TEXT_SPACING_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
Util.conky('$kernel'), Util.conky('$kernel'),
'<row2>', '<row2>',
'<row3>', '<row3>',
'<row4>' '<row4>'
} }
Widget = nil
Patterns = nil
_TEXT_SPACING_ = nil _TEXT_SPACING_ = nil
local draw = function(cr, current_interface, log_is_changed) local draw = function(cr, current_interface, log_is_changed)

View File

@ -1,11 +1,9 @@
local Widget = require 'Widget'
local Text = require 'Text' local Text = require 'Text'
local Line = require 'Line' local Line = require 'Line'
local TextColumn = require 'TextColumn' local TextColumn = require 'TextColumn'
local ScaledImage = require 'ScaledImage' local ScaledImage = require 'ScaledImage'
local Util = require 'Util' local Util = require 'Util'
local Json = require 'Json' local Json = require 'Json'
local Patterns = require 'Patterns'
local __string_match = string.match local __string_match = string.match
local __string_sub = string.sub local __string_sub = string.sub
@ -36,42 +34,42 @@ local create_side_rows = function(side_rows_x, side_rows_y, side_rows_tbl)
local current_row = side_rows_tbl[i] local current_row = side_rows_tbl[i]
local current_row_y = side_rows_y + (i - 1) * _SECTION_HEIGHT_ local current_row_y = side_rows_y + (i - 1) * _SECTION_HEIGHT_
current_row.desc = Widget.Text{ current_row.desc = _G_Widget_.Text{
x = side_rows_x, x = side_rows_x,
y = current_row_y, y = current_row_y,
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
} }
current_row.period = Widget.Text{ current_row.period = _G_Widget_.Text{
x = side_rows_x + _G_INIT_DATA_.SECTION_WIDTH, x = side_rows_x + _G_INIT_DATA_.SECTION_WIDTH,
y = current_row_y, y = current_row_y,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE text_color = _G_Patterns_.BLUE
} }
current_row.icon = Widget.ScaledImage{ current_row.icon = _G_Widget_.ScaledImage{
x = side_rows_x, x = side_rows_x,
y = current_row_y + _HEADER_PAD_, y = current_row_y + _HEADER_PAD_,
width = _ICON_SIDE_LENGTH_, width = _ICON_SIDE_LENGTH_,
height = _ICON_SIDE_LENGTH_ height = _ICON_SIDE_LENGTH_
} }
current_row.temp1 = Widget.Text{ current_row.temp1 = _G_Widget_.Text{
x = side_rows_x + _ICON_SIDE_LENGTH_ + _TEMP_SECTION_WIDTH_ / 2, x = side_rows_x + _ICON_SIDE_LENGTH_ + _TEMP_SECTION_WIDTH_ / 2,
y = current_row_y + _HEADER_PAD_ + 25, y = current_row_y + _HEADER_PAD_ + 25,
x_align = 'center', x_align = 'center',
font_size = 28, font_size = 28,
text_color = Patterns.BLUE text_color = _G_Patterns_.BLUE
} }
current_row.temp2 = Widget.Text{ current_row.temp2 = _G_Widget_.Text{
x = side_rows_x + _ICON_SIDE_LENGTH_ + _TEMP_SECTION_WIDTH_ / 2, x = side_rows_x + _ICON_SIDE_LENGTH_ + _TEMP_SECTION_WIDTH_ / 2,
y = current_row_y + _HEADER_PAD_ + 55, y = current_row_y + _HEADER_PAD_ + 55,
x_align = 'center', x_align = 'center',
font_size = 11 font_size = 11
} }
current_row.label_column = Widget.TextColumn{ current_row.label_column = _G_Widget_.TextColumn{
x = side_rows_x + _ICON_SIDE_LENGTH_ + _TEMP_SECTION_WIDTH_, x = side_rows_x + _ICON_SIDE_LENGTH_ + _TEMP_SECTION_WIDTH_,
y = current_row_y + _HEADER_PAD_ + 15, y = current_row_y + _HEADER_PAD_ + 15,
spacing = _SPACING_, spacing = _SPACING_,
@ -80,17 +78,17 @@ local create_side_rows = function(side_rows_x, side_rows_y, side_rows_tbl)
'W' 'W'
} }
current_row.info_column = Widget.TextColumn{ current_row.info_column = _G_Widget_.TextColumn{
x = side_rows_x + _G_INIT_DATA_.SECTION_WIDTH, x = side_rows_x + _G_INIT_DATA_.SECTION_WIDTH,
y = current_row_y + _HEADER_PAD_ + 15, y = current_row_y + _HEADER_PAD_ + 15,
spacing = _SPACING_, spacing = _SPACING_,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
num_rows = 3 num_rows = 3
} }
if i < NUM_ROWS then if i < NUM_ROWS then
current_row.separator = Widget.Line{ current_row.separator = _G_Widget_.Line{
p1 = { p1 = {
x = side_rows_x, x = side_rows_x,
y = current_row_y + _SECTION_HEIGHT_ - 18 y = current_row_y + _SECTION_HEIGHT_ - 18
@ -99,7 +97,7 @@ local create_side_rows = function(side_rows_x, side_rows_y, side_rows_tbl)
x = side_rows_x + _G_INIT_DATA_.SECTION_WIDTH, x = side_rows_x + _G_INIT_DATA_.SECTION_WIDTH,
y = current_row_y + _SECTION_HEIGHT_ - 18 y = current_row_y + _SECTION_HEIGHT_ - 18
}, },
line_pattern = Patterns.MID_GREY line_pattern = _G_Patterns_.MID_GREY
} }
end end
end end
@ -107,7 +105,7 @@ end
-- LEFT -- LEFT
local left = { local left = {
header = Widget.Header{ header = _G_Widget_.Header{
x = _G_INIT_DATA_.LEFT_X, x = _G_INIT_DATA_.LEFT_X,
y = _G_INIT_DATA_.TOP_Y, y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -121,24 +119,24 @@ create_side_rows(_G_INIT_DATA_.LEFT_X, left.header.bottom_y, left.hours)
-- CENTER -- CENTER
local center = {} local center = {}
center.header = Widget.Header{ center.header = _G_Widget_.Header{
x = _G_INIT_DATA_.CENTER_LEFT_X, x = _G_INIT_DATA_.CENTER_LEFT_X,
y = _G_INIT_DATA_.TOP_Y, y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.CENTER_WIDTH, width = _G_INIT_DATA_.CENTER_WIDTH,
header = 'CURRENT CONDITIONS' header = 'CURRENT CONDITIONS'
} }
center.current_desc = Widget.Text{ center.current_desc = _G_Widget_.Text{
x = _G_INIT_DATA_.CENTER_LEFT_X, x = _G_INIT_DATA_.CENTER_LEFT_X,
y = center.header.bottom_y + 8, y = center.header.bottom_y + 8,
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
font_size = 24 font_size = 24
} }
local _CENTER_X_1_ = _G_INIT_DATA_.CENTER_LEFT_X + _G_INIT_DATA_.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_WIDTH_ = 120
center.icon = Widget.ScaledImage{ center.icon = _G_Widget_.ScaledImage{
x = _CENTER_X_1_ - _CENTER_ICON_WIDTH_ / 2, x = _CENTER_X_1_ - _CENTER_ICON_WIDTH_ / 2,
y = center.header.bottom_y + 105 - _CENTER_ICON_WIDTH_ / 2, y = center.header.bottom_y + 105 - _CENTER_ICON_WIDTH_ / 2,
width = _CENTER_ICON_WIDTH_, width = _CENTER_ICON_WIDTH_,
@ -148,22 +146,22 @@ center.icon = Widget.ScaledImage{
local _CENTER_X_2_ = _G_INIT_DATA_.CENTER_LEFT_X + _G_INIT_DATA_.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 local _INFO_Y_ = center.header.bottom_y + 70
center.current_temp = Widget.Text{ center.current_temp = _G_Widget_.Text{
x = _CENTER_X_2_, x = _CENTER_X_2_,
y = _INFO_Y_, y = _INFO_Y_,
x_align = 'center', x_align = 'center',
font_size = 48, font_size = 48,
text_color = Patterns.BLUE text_color = _G_Patterns_.BLUE
} }
center.obs_time = Widget.Text{ center.obs_time = _G_Widget_.Text{
x = _CENTER_X_2_, x = _CENTER_X_2_,
y = _INFO_Y_ + 42, y = _INFO_Y_ + 42,
x_align = 'center', x_align = 'center',
font_size = 12, font_size = 12,
} }
center.place = Widget.Text{ center.place = _G_Widget_.Text{
x = _CENTER_X_2_, x = _CENTER_X_2_,
y = _INFO_Y_ + 66, y = _INFO_Y_ + 66,
x_align = 'center', x_align = 'center',
@ -173,7 +171,7 @@ center.place = Widget.Text{
local _COLUMN_PADDING_ = 15 local _COLUMN_PADDING_ = 15
local _CENTER_SPACING_ = _SPACING_ + 7 local _CENTER_SPACING_ = _SPACING_ + 7
center.label_column_1 = Widget.TextColumn{ center.label_column_1 = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.CENTER_RIGHT_X, x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = center.header.bottom_y, y = center.header.bottom_y,
spacing = _CENTER_SPACING_, spacing = _CENTER_SPACING_,
@ -187,17 +185,17 @@ center.label_column_1 = Widget.TextColumn{
'Precipitation' 'Precipitation'
} }
center.info_column_1 = Widget.TextColumn{ center.info_column_1 = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.CENTER_RIGHT_X + (_G_INIT_DATA_.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, y = center.header.bottom_y,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
spacing = _CENTER_SPACING_, spacing = _CENTER_SPACING_,
font_size = 14, font_size = 14,
num_rows = 7 num_rows = 7
} }
center.label_column_2 = Widget.TextColumn{ center.label_column_2 = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.CENTER_RIGHT_X + (_G_INIT_DATA_.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, y = center.header.bottom_y,
spacing = _CENTER_SPACING_, spacing = _CENTER_SPACING_,
@ -211,11 +209,11 @@ center.label_column_2 = Widget.TextColumn{
'Light Rate' 'Light Rate'
} }
center.info_column_2 = Widget.TextColumn{ center.info_column_2 = _G_Widget_.TextColumn{
x = _G_INIT_DATA_.CENTER_RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH, x = _G_INIT_DATA_.CENTER_RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = center.header.bottom_y, y = center.header.bottom_y,
x_align = 'right', x_align = 'right',
text_color = Patterns.BLUE, text_color = _G_Patterns_.BLUE,
spacing = _CENTER_SPACING_, spacing = _CENTER_SPACING_,
font_size = 14, font_size = 14,
num_rows = 7 num_rows = 7
@ -223,7 +221,7 @@ center.info_column_2 = Widget.TextColumn{
-- RIGHT -- RIGHT
local right = { local right = {
header = Widget.Header{ header = _G_Widget_.Header{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
y = _G_INIT_DATA_.TOP_Y, y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH, width = _G_INIT_DATA_.SECTION_WIDTH,
@ -234,9 +232,6 @@ local right = {
create_side_rows(_G_INIT_DATA_.RIGHT_X, right.header.bottom_y, right.days) create_side_rows(_G_INIT_DATA_.RIGHT_X, right.header.bottom_y, right.days)
Widget = nil
Patterns = nil
_SPACING_ = nil _SPACING_ = nil
_HEADER_PAD_ = nil _HEADER_PAD_ = nil
_ICON_SIDE_LENGTH_ = nil _ICON_SIDE_LENGTH_ = nil

View File

@ -100,6 +100,9 @@ conky_set_update_interval(_G_INIT_DATA_.UPDATE_INTERVAL)
require 'imlib2' require 'imlib2'
require 'cairo' require 'cairo'
_G_Widget_ = require 'Widget'
_G_Patterns_ = require 'Patterns'
local Util = require 'Util' local Util = require 'Util'
local Panel = require 'Panel' local Panel = require 'Panel'
local System = require 'System' local System = require 'System'
@ -113,12 +116,10 @@ local Graphics = require 'Graphics'
local Memory = require 'Memory' local Memory = require 'Memory'
local Weather = require 'Weather' local Weather = require 'Weather'
local updates = -2 local _unrequire = function(m) package.loaded[m] = nil end
local _unrequire = function(m) _G_Widget_ = nil
package.loaded[m] = nil _G_Patterns_ = nil
_G[m] = nil
end
_unrequire('Super') _unrequire('Super')
_unrequire('Color') _unrequire('Color')
@ -130,6 +131,8 @@ _unrequire = nil
_G_INIT_DATA_ = nil _G_INIT_DATA_ = nil
local updates = -2
local __cairo_xlib_surface_create = cairo_xlib_surface_create local __cairo_xlib_surface_create = cairo_xlib_surface_create
local __cairo_create = cairo_create local __cairo_create = cairo_create
local __cairo_surface_destroy = cairo_surface_destroy local __cairo_surface_destroy = cairo_surface_destroy