@@ -314,7 +314,9 @@ def _update_label(self,update_class=True):
314
314
if isinstance (active_widgets [widget_index ],QLabel ):
315
315
if '<span' in part and '</span>' in part :
316
316
icon = re .sub (r'<span.*?>|</span>' ,'' ,part ).strip ()
317
- icon = self ._icons .get (icon ,self ._icons ["default" ])
317
+ # Only replace with icons dictionary if the content is actually in the dictionary
318
+ if icon in self ._icons :
319
+ icon = self ._icons .get (icon )
318
320
active_widgets [widget_index ].setText (icon )
319
321
if update_class :
320
322
# Retrieve current class and append new class based on weather conditions
@@ -393,6 +395,13 @@ def get_weather_data(self, api_url):
393
395
conditions_data = "snowyIcy"
394
396
icon_string = f"{ conditions_data } { 'Day' if current ['is_day' ]== 1 else 'Night' } " .strip ()
395
397
398
+ if icon_string :
399
+ icon_label = self ._icons ["default" ]
400
+ if icon_label not in self ._icons :
401
+ icon_label = self ._icons ["default" ]
402
+ else :
403
+ icon_label = self ._icons ["default" ]
404
+
396
405
# Load icons into cache for current and future forecasts if not already cached
397
406
# We will try to load the images for 1sec, if it fails we will try again when popup is opened
398
407
img_icon_keys = [f'http:{ day ["condition" ]["icon" ]} ' for day in [forecast ]+ [forecast1 ["day" ],forecast2 ["day" ]]]
@@ -428,7 +437,7 @@ def get_weather_data(self, api_url):
428
437
'{is_day}' :current ['is_day' ],
429
438
430
439
# Icons
431
- '{icon}' :icon_string [ 0 ]. lower () + icon_string [ 1 :] ,
440
+ '{icon}' :icon_label ,
432
441
'{icon_class}' :icon_string [0 ].lower ()+ icon_string [1 :],
433
442
'{day0_icon}' :f'http:{ forecast ["condition" ]["icon" ]} ' ,
434
443