Differentiate current weather icons from weekly prevision

This commit is contained in:
nemunaire 2022-08-12 12:48:54 +02:00
parent 9e15da095b
commit cac484840e
2 changed files with 30 additions and 9 deletions

View File

@ -114,7 +114,7 @@ class WeatherJumboCurrentModule:
# current
curweather = WeatherAPI().get_currently()
icon = Image.open("icons/" + WeatherAPI.get_icon(curweather["icon"])).resize((height, height))
icon = Image.open("icons/" + WeatherAPI.get_icon(curweather["icon"], current=True)).resize((height, height))
image.paste(icon, (int(width*self.middle_align - height), 0), icon)
draw.text(

View File

@ -40,21 +40,36 @@ class DarkSkyAPI:
return res
def get_icon(icon):
def get_icon(icon, current=False):
if icon == "clear-day":
return "wi-day-sunny.png"
elif icon == "clear-night":
return "wi-night-clear.png"
elif icon == "rain":
return "wi-day-rain.png"
if not current:
return "wi-day-rain.png"
else:
return "wi-rain.png"
elif icon == "snow":
return "wi-day-snow.png"
if not current:
return "wi-day-snow.png"
else:
return "wi-snow.png"
elif icon == "sleet":
return "wi-day-sleet.png"
if not current:
return "wi-day-sleet.png"
else:
return "wi-sleet.png"
elif icon == "wind":
return "wi-day-windy.png"
if not current:
return "wi-day-windy.png"
else:
return "wi-strong-wind.png"
elif icon == "fog":
return "wi-day-fog.png"
if not current:
return "wi-day-fog.png"
else:
return "wi-fog.png"
elif icon == "cloudy":
return "wi-cloudy.png"
elif icon == "partly-cloudy-day":
@ -62,9 +77,15 @@ class DarkSkyAPI:
elif icon == "partly-cloudy-night":
return "wi-night-partly-cloudy.png"
elif icon == "hail":
return "wi-day-hail.png"
if not current:
return "wi-day-hail.png"
else:
return "wi-hail.png"
elif icon == "thunderstorm":
return "wi-thunderstorm.png"
if not current:
return "wi-day-thunderstorm.png"
else:
return "wi-thunderstorm.png"
elif icon == "tornado":
return "wi-tornado.png"
else: