diff --git a/lib/constants.py b/lib/constants.py index 649cd08..11e28af 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -147,6 +147,28 @@ WEATHER_SYMBOL_WI_NIGHT = { "VeryCloudy": "", } +WEATHER_SYMBOL_PLAIN = { + "Unknown": "?", + "Cloudy": "mm", + "Fog": "=", + "HeavyRain": "///", + "HeavyShowers": "//", + "HeavySnow": "**", + "HeavySnowShowers": "*/*", + "LightRain": "/", + "LightShowers": ".", + "LightSleet": "x", + "LightSleetShowers": "x/", + "LightSnow": "*", + "LightSnowShowers": "*/", + "PartlyCloudy": "m", + "Sunny": "o", + "ThunderyHeavyRain": "/!/", + "ThunderyShowers": "!/", + "ThunderySnowShowers": "*!*", + "VeryCloudy": "mmm", +} + WEATHER_SYMBOL_WIDTH_VTE_WI = { } diff --git a/lib/view/line.py b/lib/view/line.py index 361d396..221c96c 100644 --- a/lib/view/line.py +++ b/lib/view/line.py @@ -25,7 +25,7 @@ from astral.sun import sun import pytz -from constants import WWO_CODE, WEATHER_SYMBOL, WIND_DIRECTION, WEATHER_SYMBOL_WIDTH_VTE +from constants import WWO_CODE, WEATHER_SYMBOL, WIND_DIRECTION, WEATHER_SYMBOL_WIDTH_VTE, WEATHER_SYMBOL_PLAIN from weather_data import get_weather_data from . import v2 from . import v3 @@ -106,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) @@ -249,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,