changed formatting for new weather api

This commit is contained in:
Justin 2023-05-23 16:19:29 +08:00 committed by GitHub
parent d38296ec2a
commit 358594467f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4470,14 +4470,14 @@ class StockTicker():
weekday = weekdays[datetime.today().weekday()]
date_img = self.textImage((month + ' ' + date + ',' + weekday).upper(), small_font)
rain_img = Image.open(weather_dir + '/rain-chance.png')
rtext_img = self.textImage(str(int(current_weather['rain_chance']*100)) + '%', small_font)
rtext_img = self.textImage(str(current_weather['rain_chance']) + '%', small_font)
cloud_img = Image.open(weather_dir + '/clouds.png')
ctext_img = self.textImage(str(current_weather['clouds']) + '%', small_font)
wind_img = Image.open(weather_dir + '/wind.png')
w_speed = current_weather['wind_speed']*3.6
w_speed = current_weather['wind_speed']
w_unit = 'K/H'
if all_settings["wind_speed"] == "miles/hour":
w_speed = current_weather['wind_speed']*2.236936
w_speed = current_weather['wind_speed']/1.609
w_unit = 'M/H'
wtext_img = self.textImage("{0:.0f}".format(w_speed) + w_unit, small_font)
wdir_img = self.textImage(self.degreesToCompass(current_weather['wind_direction']).upper(), small_font)
@ -4906,7 +4906,7 @@ class StockTicker():
if daily_weathers['current_weather']:
rain_img = Image.open(weather_dir + '/rain-chance.png')
rtext_img = self.textImage(str(int(daily_weather[0]['rain_chance']*100)) + '%', small_font)
rtext_img = self.textImage(str(daily_weather[0]['rain_chance']) + '%', small_font)
hum_img = Image.open(weather_dir + '/humidity.png')
htext_img = self.textImage(str(daily_weather[0]['humidity']) + '%', small_font)
wind_img = Image.open(weather_dir + '/wind.png')
@ -4917,10 +4917,10 @@ class StockTicker():
ctext_img = self.textImage(str(daily_weather[0]['clouds']) + '%', small_font)
wind_img = Image.open(weather_dir + '/wind.png')
w_speed = daily_weather[0]['wind_speed']*3.6
w_speed = daily_weather[0]['wind_speed']
w_unit = 'K/H'
if daily_weathers['wind_speed'] == "miles/hour":
w_speed = daily_weather[0]['wind_speed']*2.236936
w_speed = daily_weather[0]['wind_speed']/1.609
w_unit = 'M/H'
wtext_img = self.textImage("{0:.0f}".format(w_speed) + w_unit, small_font)