From edd1e1e3dd9ee3a5932f56bc53fbbb54a2c45191 Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 1 Mar 2021 01:58:37 +0100 Subject: [PATCH] Add new function: render_condition_plain --- lib/view/line.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/view/line.py b/lib/view/line.py index b48571d..221c96c 100644 --- a/lib/view/line.py +++ b/lib/view/line.py @@ -77,14 +77,11 @@ 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']]] + weather_condition = WEATHER_SYMBOL[WWO_CODE[data['weatherCode']]] spaces = " "*(WEATHER_SYMBOL_WIDTH_VTE.get(weather_condition) - 1) return weather_condition + spaces @@ -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,