Add new function: render_condition_plain

This commit is contained in:
Joseph 2021-03-01 01:58:37 +01:00
parent 747740997e
commit edd1e1e3dd

View file

@ -77,13 +77,10 @@ def render_feel_like_temperature(data, query):
return temperature
def render_condition(data, query, plain=False):
def render_condition(data, query):
"""Emoji encoded weather condition (c)
"""
if plain:
weather_condition = WEATHER_SYMBOL_PLAIN[WWO_CODE[data['weatherCode']]]
else:
weather_condition = WEATHER_SYMBOL[WWO_CODE[data['weatherCode']]]
spaces = " "*(WEATHER_SYMBOL_WIDTH_VTE.get(weather_condition) - 1)
@ -109,6 +106,15 @@ def render_condition_fullname(data, query):
return weather_condition
def render_condition_plain(data, query):
"""Plain text weather condition (x)
"""
weather_condition = WEATHER_SYMBOL_PLAIN[WWO_CODE[data['weatherCode']]]
spaces = " "*(WEATHER_SYMBOL_WIDTH_VTE.get(weather_condition) - 1)
return weather_condition + spaces
def render_humidity(data, query):
"""
humidity (h)
@ -252,6 +258,7 @@ def render_local_timezone(data, query, local_time_of):
FORMAT_SYMBOL = {
'c': render_condition,
'C': render_condition_fullname,
'x': render_condition_plain,
'h': render_humidity,
't': render_temperature,
'f': render_feel_like_temperature,