mirror of
https://github.com/powerline/powerline.git
synced 2025-07-24 06:15:41 +02:00
Fix icon_names for unknown weather code
This commit is contained in:
parent
2a3911dbe6
commit
b8b7cfbbea
@ -251,7 +251,8 @@ weather_conditions_icons = {
|
|||||||
'sunny': u'☼',
|
'sunny': u'☼',
|
||||||
'night': u'☾',
|
'night': u'☾',
|
||||||
'windy': u'☴',
|
'windy': u'☴',
|
||||||
'not_available': u'⚠',
|
'not_available': u'<EFBFBD>',
|
||||||
|
'unknown': u'⚠',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -294,13 +295,12 @@ def weather(unit='c', location_query=None, icons=None):
|
|||||||
condition_code = int(condition['code'])
|
condition_code = int(condition['code'])
|
||||||
except (KeyError, TypeError, ValueError):
|
except (KeyError, TypeError, ValueError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
icon_names = weather_conditions_codes[condition_code]
|
icon_names = weather_conditions_codes[condition_code]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if condition_code == 3200:
|
icon_names = (('not_available' if condition_code == 3200 else 'unknown'),)
|
||||||
icon_names = ('not_available',)
|
|
||||||
else:
|
|
||||||
icon_names = ('unknown')
|
|
||||||
for icon_name in icon_names:
|
for icon_name in icon_names:
|
||||||
if icons:
|
if icons:
|
||||||
if icon_name in icons:
|
if icon_name in icons:
|
||||||
@ -308,6 +308,7 @@ def weather(unit='c', location_query=None, icons=None):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
icon = weather_conditions_icons[icon_names[-1]]
|
icon = weather_conditions_icons[icon_names[-1]]
|
||||||
|
|
||||||
groups = ['weather_condition_' + icon_name for icon_name in icon_names] + ['weather_conditions', 'weather']
|
groups = ['weather_condition_' + icon_name for icon_name in icon_names] + ['weather_conditions', 'weather']
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user