Fix display of alerts when no alert
This commit is contained in:
parent
9c3a3ff3c4
commit
1126693b38
@ -274,6 +274,7 @@ class WeatherAlertsModule:
|
|||||||
def draw_module(self, config, width, height):
|
def draw_module(self, config, width, height):
|
||||||
image = Image.new('RGBA', (width, height), "#000")
|
image = Image.new('RGBA', (width, height), "#000")
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
|
align = 0
|
||||||
|
|
||||||
if WeatherAPI().has_alerts():
|
if WeatherAPI().has_alerts():
|
||||||
alerts = WeatherAPI().get_alerts()
|
alerts = WeatherAPI().get_alerts()
|
||||||
@ -281,9 +282,9 @@ class WeatherAlertsModule:
|
|||||||
fnt_R = ImageFont.truetype(config.fnt_R_path, 16)
|
fnt_R = ImageFont.truetype(config.fnt_R_path, 16)
|
||||||
fnt_B = ImageFont.truetype(config.fnt_RB_path, 16)
|
fnt_B = ImageFont.truetype(config.fnt_RB_path, 16)
|
||||||
|
|
||||||
align = 7
|
align = 10
|
||||||
for alert in alerts:
|
for alert in alerts:
|
||||||
if alert["severity"] == "watch":
|
if alert["severity"] == "watch" or alert["title"].startswith("Moderate"):
|
||||||
icon = "wi-small-craft-advisory.png"
|
icon = "wi-small-craft-advisory.png"
|
||||||
elif alert["severity"] == "warning":
|
elif alert["severity"] == "warning":
|
||||||
icon = "wi-gale-warning.png"
|
icon = "wi-gale-warning.png"
|
||||||
|
Loading…
Reference in New Issue
Block a user