fixed current weather spacing issues

This commit is contained in:
Justin 2022-06-12 18:35:44 +08:00 committed by GitHub
parent f1015c5b79
commit c58c3dbaf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1898,9 +1898,13 @@ class StockTicker():
main = current_weather['main_weather']
if main == 'Clouds':
main = current_weather['description']
if main == 'Rain':
main = current_weather['description']
weather_ids = {'Clear': '01', 'few clouds': '02', 'scattered clouds': '03', 'broken clouds':'04', 'overcast clouds':'04', 'Drizzle':'09',
'Rain':'10', 'Thunderstorm':'11', 'Snow':'13', 'Mist': '50', 'Smoke': '50', 'Haze': '50', 'Dust': '50', 'Fog': '50',
'Sand': '50', 'Ash': '50', 'Squall': '50', 'Tornado': '50'}
'Sand': '50', 'Ash': '50', 'Squall': '50', 'Tornado': '50', 'light rain': '10', 'moderate rain': '10', 'heavy intensity rain': '10',
'very heavy rain': '10', 'extreme rain': '10', 'freezing rain': '13', 'light intensity shower rain': '09', 'shower rain': '09',
'heavy intensity shower rain': '09', 'ragged shower rain': '09'}
weather_dir = './logos/weather_icons'
weather_img = Image.open(weather_dir + '/weather_type_icons/' + weather_ids[main] + '.png')
@ -1960,12 +1964,12 @@ class StockTicker():
x_offset += max( main_img.size[0], temp_img.size[0] + deg_img.size[0])
img.paste(min_img, (x_offset - 1, 12))
img.paste(max_img, (x_offset - 1, 21))
img.paste(min_img, (x_offset - 0, 12))
img.paste(max_img, (x_offset - 0, 21))
x_offset += max(min_img.size[0], max_img.size[0]) + 2
img.paste(hum_img, ( x_offset, 8))
img.paste(uv_img, ( x_offset, 22))
img.paste(hum_img, ( x_offset - 1, 8))
img.paste(uv_img, ( x_offset - 1, 22))
img.paste(htext_img, (x_offset + hum_img.size[0], 10))
img.paste(utext_img, (x_offset + uv_img.size[0], 23))