Refactor icons directory
This commit is contained in:
parent
adbd46f715
commit
4b80ff19dc
229 changed files with 11 additions and 11 deletions
|
|
@ -174,7 +174,7 @@ class AlertsModule:
|
|||
align = self.draw_alert({
|
||||
"title": "Impossible de générer les alertes de " + alert.__name__,
|
||||
"description": type(e).__name__ + ": " + (e.message if hasattr(e, 'message') else str(e)),
|
||||
"icon": "wi-earthquake.png",
|
||||
"icon": "weather/wi-earthquake.png",
|
||||
}, width, image, draw, fnt_R, fnt_B, align, font_size)
|
||||
else:
|
||||
align = self.draw_alert(alert, width, image, draw, fnt_R, fnt_B, align, font_size)
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ class RATPNextStopModule:
|
|||
alerts.append({
|
||||
"title": "Impossible de récupérer les horaires du " + mode + line + " pour " + tmp[1],
|
||||
"description": type(e).__name__ + ": " + (e.message if hasattr(e, 'message') else str(e)),
|
||||
"icon": "wi-earthquake.png",
|
||||
"icon": "weather/wi-earthquake.png",
|
||||
})
|
||||
|
||||
align -= int(line_height * 0.33)
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class WeatherJumboCurrentModule:
|
|||
# current
|
||||
curweather = WeatherAPI().get_currently()
|
||||
|
||||
icon = Image.open(os.path.join(config.icons_dir, WeatherAPI.get_icon(curweather["condition"]["code"], night=not curweather["is_day"], current=True))).resize((height, height))
|
||||
icon = Image.open(os.path.join(config.icons_dir, "weather", WeatherAPI.get_icon(curweather["condition"]["code"], night=not curweather["is_day"], current=True))).resize((height, height))
|
||||
image.paste(icon, (int(width*self.middle_align - height), 0), icon)
|
||||
|
||||
draw.text(
|
||||
|
|
@ -160,7 +160,7 @@ class WeatherMoonPhaseModule:
|
|||
def draw_module(self, config, width, height):
|
||||
image = Image.new('RGBA', (width, height), '#fff0')
|
||||
|
||||
icon = Image.open(os.path.join(config.icons_dir, WeatherAPI().get_moon_icon())).resize((height, height))
|
||||
icon = Image.open(os.path.join(config.icons_dir, "weather", WeatherAPI().get_moon_icon())).resize((height, height))
|
||||
image.paste(icon, (0,0), icon)
|
||||
|
||||
return image
|
||||
|
|
@ -185,7 +185,7 @@ class WeatherSunModule:
|
|||
for icon, info in infos.items():
|
||||
if info == "":
|
||||
continue
|
||||
icon = Image.open(os.path.join(config.icons_dir, "wi-" + icon + ".png")).resize((height, height))
|
||||
icon = Image.open(os.path.join(config.icons_dir, "weather", "wi-" + icon + ".png")).resize((height, height))
|
||||
image.paste(icon, (int(align),0), icon)
|
||||
align += height + 2
|
||||
draw.text(
|
||||
|
|
@ -242,7 +242,7 @@ class WeatherRainModule:
|
|||
image = Image.open(io.BytesIO(gauge.render_to_png()))
|
||||
|
||||
if icon_path:
|
||||
icon = Image.open(os.path.join(config.icons_dir, icon_path)).resize((int(height/1.25), int(height/1.25)))
|
||||
icon = Image.open(os.path.join(config.icons_dir, "weather", icon_path)).resize((int(height/1.25), int(height/1.25)))
|
||||
image.paste(icon, (int(width/2-height/2.5), int(height-height/1.25)), icon)
|
||||
|
||||
return image
|
||||
|
|
@ -326,7 +326,7 @@ class WeeklyWeatherModule:
|
|||
|
||||
i = 1
|
||||
for day in weekweather[self.first_day:self.first_day+self.limit_futur]:
|
||||
icon = Image.open(os.path.join(config.icons_dir, WeatherAPI.get_icon(day["condition"]["code"]))).resize((day_size, day_size))
|
||||
icon = Image.open(os.path.join(config.icons_dir, "weather", WeatherAPI.get_icon(day["condition"]["code"]))).resize((day_size, day_size))
|
||||
image.paste(icon, (0, i * day_size), icon)
|
||||
|
||||
draw.text(
|
||||
|
|
@ -371,9 +371,9 @@ class WeatherAlerts:
|
|||
|
||||
for alert in WeatherAPI().get_alerts():
|
||||
if alert["severity"] == "Moderate":
|
||||
icon = "wi-small-craft-advisory.png"
|
||||
icon = "weather/wi-small-craft-advisory.png"
|
||||
elif alert["severity"] != "Moderate":
|
||||
icon = "wi-gale-warning.png"
|
||||
icon = "weather/wi-gale-warning.png"
|
||||
else:
|
||||
icon = None
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ class WeatherAPI:
|
|||
def get_forecast(self, *args, **kwargs):
|
||||
for i in [0, 1, 2, 3]:
|
||||
enddt = datetime.now() + timedelta(days=i)
|
||||
v = self.get_weather(*args, **kwargs, dt=enddt.strftime("%Y-%m-%d"))["forecast"]["forecastday"][0]
|
||||
v = self.get_weather(*args, **kwargs, dt=enddt.strftime("%Y-%m-%d"), alerts="yes")["forecast"]["forecastday"][0]
|
||||
v["day"]["date"] = enddt
|
||||
yield v
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue