Fixed stability
This commit is contained in:
parent
d768712181
commit
1a62d9d929
3 changed files with 9 additions and 5 deletions
|
@ -66,7 +66,8 @@ class OwmForecasts (WeatherInterface):
|
||||||
forecast_object.short_description = translate(str(weather.get_status()))
|
forecast_object.short_description = translate(str(weather.get_status()))
|
||||||
forecast_object.detailed_description = str(weather.get_detailed_status())
|
forecast_object.detailed_description = str(weather.get_detailed_status())
|
||||||
forecast_object.air_pressure = str(weather.get_pressure()['press'])
|
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":
|
if forecast_object.units == "metric":
|
||||||
forecast_object.air_temperature = str(int(weather.get_temperature(unit='celsius')['temp']))
|
forecast_object.air_temperature = str(int(weather.get_temperature(unit='celsius')['temp']))
|
||||||
|
|
|
@ -11,6 +11,7 @@ class WeatherForecast (object):
|
||||||
self.sunset = None
|
self.sunset = None
|
||||||
self.moon_phase = None
|
self.moon_phase = None
|
||||||
self.wind_speed = None
|
self.wind_speed = None
|
||||||
|
self.wind_deg = None
|
||||||
self.clouds = None
|
self.clouds = None
|
||||||
|
|
||||||
self.icon = None
|
self.icon = None
|
||||||
|
|
|
@ -30,10 +30,12 @@ class WeatherHeaderDesign (DesignEntity):
|
||||||
|
|
||||||
temperature = cur_weather.air_temperature + " " + self.__get_unit__(("°C", "°F"))
|
temperature = cur_weather.air_temperature + " " + self.__get_unit__(("°C", "°F"))
|
||||||
if units== "aviation": #pick up aviation
|
if units== "aviation": #pick up aviation
|
||||||
if len(forecast.wind_deg)==1: #if deg is 2, add two zeros for format
|
if cur_weather.wind_deg == None:
|
||||||
forecast.wind_deg = "00" + forecast.wind_deg
|
cur_weather.wind_deg = ""
|
||||||
elif len(forecast.wind_deg)==2:
|
elif len(cur_weather.wind_deg)==1: #if deg is 2, add two zeros for format
|
||||||
forecast.wind_deg = "0" + forecast.wind_deg
|
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:
|
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
|
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:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue