even more clean up for Weather.lua
This commit is contained in:
parent
4602b4150d
commit
fb5680b871
|
@ -106,7 +106,7 @@ local create_side_rows = function(side_rows_x, side_rows_y, side_rows_tbl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--LEFT
|
-- LEFT
|
||||||
local left = {
|
local left = {
|
||||||
header = Widget.Header{
|
header = Widget.Header{
|
||||||
x = _G_INIT_DATA_.LEFT_X,
|
x = _G_INIT_DATA_.LEFT_X,
|
||||||
|
@ -119,7 +119,7 @@ local left = {
|
||||||
|
|
||||||
create_side_rows(_G_INIT_DATA_.LEFT_X, left.header.bottom_y, left.hours)
|
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 = Widget.Header{
|
||||||
|
@ -222,8 +222,7 @@ center.info_column_2 = Widget.TextColumn{
|
||||||
num_rows = 7
|
num_rows = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
--RIGHT
|
-- RIGHT
|
||||||
|
|
||||||
local right = {
|
local right = {
|
||||||
header = Widget.Header{
|
header = Widget.Header{
|
||||||
x = _G_INIT_DATA_.RIGHT_X,
|
x = _G_INIT_DATA_.RIGHT_X,
|
||||||
|
@ -315,13 +314,13 @@ local update_interface = function(cr)
|
||||||
data = data.response.responses
|
data = data.response.responses
|
||||||
|
|
||||||
if data[1].success == false then
|
if data[1].success == false then
|
||||||
for i = 1, NUM_ROWS do populate_section(left.hours[i], cr) end
|
for i = 1, NUM_ROWS do populate_section(left.hours[i], cr) end
|
||||||
|
|
||||||
populate_center(center, cr, nil, nil, nil, nil, 'Invalid Location')
|
populate_center(center, cr, nil, nil, nil, nil, 'Invalid Location')
|
||||||
|
|
||||||
for i = 1, NUM_ROWS do populate_section(right.days[i], cr) end
|
for i = 1, NUM_ROWS do populate_section(right.days[i], cr) end
|
||||||
else
|
else
|
||||||
--LEFT
|
-- LEFT
|
||||||
local hourly = data[2].response[1].periods
|
local hourly = data[2].response[1].periods
|
||||||
|
|
||||||
for i = 1, NUM_ROWS do
|
for i = 1, NUM_ROWS do
|
||||||
|
@ -341,7 +340,7 @@ local update_interface = function(cr)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--CENTER
|
-- CENTER
|
||||||
local current_data = data[1].response
|
local current_data = data[1].response
|
||||||
local ob = current_data.ob
|
local ob = current_data.ob
|
||||||
|
|
||||||
|
@ -385,7 +384,7 @@ local update_interface = function(cr)
|
||||||
ob.light and ob.light..' %'
|
ob.light and ob.light..' %'
|
||||||
)
|
)
|
||||||
|
|
||||||
--RIGHT
|
-- RIGHT
|
||||||
local daily = data[3].response[1].periods
|
local daily = data[3].response[1].periods
|
||||||
|
|
||||||
for i = 1, NUM_ROWS do
|
for i = 1, NUM_ROWS do
|
||||||
|
@ -454,13 +453,13 @@ local draw = function(cr, interface, trigger)
|
||||||
update_cycle = update_cycle - 1
|
update_cycle = update_cycle - 1
|
||||||
|
|
||||||
if interface == 1 then
|
if interface == 1 then
|
||||||
--LEFT
|
-- LEFT
|
||||||
Text.draw(left.header.text, cr)
|
Text.draw(left.header.text, cr)
|
||||||
Line.draw(left.header.underline, cr)
|
Line.draw(left.header.underline, cr)
|
||||||
|
|
||||||
draw_sections(left.hours, cr)
|
draw_sections(left.hours, cr)
|
||||||
|
|
||||||
--CENTER
|
-- CENTER
|
||||||
Text.draw(center.header.text, cr)
|
Text.draw(center.header.text, cr)
|
||||||
Line.draw(center.header.underline, cr)
|
Line.draw(center.header.underline, cr)
|
||||||
|
|
||||||
|
@ -475,7 +474,7 @@ local draw = function(cr, interface, trigger)
|
||||||
TextColumn.draw(center.label_column_2, cr)
|
TextColumn.draw(center.label_column_2, cr)
|
||||||
TextColumn.draw(center.info_column_2, cr)
|
TextColumn.draw(center.info_column_2, cr)
|
||||||
|
|
||||||
--RIGHT
|
-- RIGHT
|
||||||
Text.draw(right.header.text, cr)
|
Text.draw(right.header.text, cr)
|
||||||
Line.draw(right.header.underline, cr)
|
Line.draw(right.header.underline, cr)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue