Fixed stability

This commit is contained in:
Maximilian Giller 2019-05-15 09:14:22 +02:00
parent d768712181
commit 1a62d9d929
3 changed files with 9 additions and 5 deletions

View file

@ -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']))

View file

@ -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

View file

@ -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: