clean up more of Weather.lua
This commit is contained in:
parent
e2f6a5bc9d
commit
7de6e97cce
|
@ -249,7 +249,8 @@ _INFO_Y_ = nil
|
||||||
_COLUMN_PADDING_ = nil
|
_COLUMN_PADDING_ = nil
|
||||||
_CENTER_SPACING_ = nil
|
_CENTER_SPACING_ = nil
|
||||||
|
|
||||||
local populate_section = function(current_section, cr, desc, period, icon_path, temp1, temp2, humidity, pop, wind)
|
local populate_row = function(current_section, cr, desc, period, icon_path,
|
||||||
|
temp1, temp2, humidity, pop, wind)
|
||||||
if desc then
|
if desc then
|
||||||
Text.set(current_section.desc, cr, Text.trim_to_length(desc, 20))
|
Text.set(current_section.desc, cr, Text.trim_to_length(desc, 20))
|
||||||
else
|
else
|
||||||
|
@ -313,11 +314,11 @@ 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_row(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_row(right.days[i], cr) end
|
||||||
else
|
else
|
||||||
-- LEFT
|
-- LEFT
|
||||||
local hourly = data[2].response[1].periods
|
local hourly = data[2].response[1].periods
|
||||||
|
@ -325,7 +326,7 @@ local update_interface = function(cr)
|
||||||
for i = 1, NUM_ROWS do
|
for i = 1, NUM_ROWS do
|
||||||
local hour_data = hourly[i]
|
local hour_data = hourly[i]
|
||||||
|
|
||||||
populate_section(
|
populate_row(
|
||||||
left.hours[i],
|
left.hours[i],
|
||||||
cr,
|
cr,
|
||||||
hour_data.weatherPrimary,
|
hour_data.weatherPrimary,
|
||||||
|
@ -389,7 +390,7 @@ local update_interface = function(cr)
|
||||||
for i = 1, NUM_ROWS do
|
for i = 1, NUM_ROWS do
|
||||||
local day_data = daily[i]
|
local day_data = daily[i]
|
||||||
|
|
||||||
populate_section(
|
populate_row(
|
||||||
right.days[i],
|
right.days[i],
|
||||||
cr,
|
cr,
|
||||||
day_data.weatherPrimary,
|
day_data.weatherPrimary,
|
||||||
|
@ -405,11 +406,12 @@ local update_interface = function(cr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i = 1, NUM_ROWS do populate_section(left.hours[i], cr) end
|
for i = 1, NUM_ROWS do
|
||||||
|
populate_row(left.hours[i], cr)
|
||||||
|
populate_row(right.days[i], cr)
|
||||||
|
end
|
||||||
|
|
||||||
populate_center(center, cr)
|
populate_center(center, cr)
|
||||||
|
|
||||||
for i = 1, NUM_ROWS do populate_section(right.days[i], cr) end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue