diff --git a/Calendar/OwmForecasts.py b/Calendar/OwmForecasts.py index dbc03ed..a6cbcac 100644 --- a/Calendar/OwmForecasts.py +++ b/Calendar/OwmForecasts.py @@ -66,7 +66,8 @@ class OwmForecasts (WeatherInterface): forecast_object.short_description = translate(str(weather.get_status())) forecast_object.detailed_description = str(weather.get_detailed_status()) forecast_object.air_pressure = str(weather.get_pressure()['press']) - forecast_object.wind_deg = str(int(weather.get_wind()['deg'])) + if 'deg' in weather.get_wind().keys(): + forecast_object.wind_deg = str(int(weather.get_wind()['deg'])) if forecast_object.units == "metric": forecast_object.air_temperature = str(int(weather.get_temperature(unit='celsius')['temp'])) diff --git a/Calendar/WeatherForecast.py b/Calendar/WeatherForecast.py index c1f4b34..8c717ec 100644 --- a/Calendar/WeatherForecast.py +++ b/Calendar/WeatherForecast.py @@ -11,6 +11,7 @@ class WeatherForecast (object): self.sunset = None self.moon_phase = None self.wind_speed = None + self.wind_deg = None self.clouds = None self.icon = None diff --git a/Calendar/WeatherHeaderDesign.py b/Calendar/WeatherHeaderDesign.py index f798843..2e7562b 100644 --- a/Calendar/WeatherHeaderDesign.py +++ b/Calendar/WeatherHeaderDesign.py @@ -30,10 +30,12 @@ class WeatherHeaderDesign (DesignEntity): temperature = cur_weather.air_temperature + " " + self.__get_unit__(("°C", "°F")) if units== "aviation": #pick up aviation - if len(forecast.wind_deg)==1: #if deg is 2, add two zeros for format - forecast.wind_deg = "00" + forecast.wind_deg - elif len(forecast.wind_deg)==2: - forecast.wind_deg = "0" + forecast.wind_deg + if cur_weather.wind_deg == None: + cur_weather.wind_deg = "" + elif len(cur_weather.wind_deg)==1: #if deg is 2, add two zeros for format + cur_weather.wind_deg = "00" + cur_weather.wind_deg + elif len(cur_weather.wind_deg)==2: + cur_weather.wind_deg = "0" + cur_weather.wind_deg if int(cur_weather.wind_speed)<10: windspeed = cur_weather.wind_deg + "@" + "0" + cur_weather.wind_speed + self.__get_unit__(("", "")) #added degrees, if wind<10 add a 0 to make two digit else: