Added Aviation feature (Windir,knots)
This commit is contained in:
parent
3bd7b55010
commit
61fd7af37a
4 changed files with 32 additions and 14 deletions
|
@ -66,14 +66,19 @@ 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 forecast_object.units == "metric":
|
||||
forecast_object.air_temperature = str(int(weather.get_temperature(unit='celsius')['temp']))
|
||||
forecast_object.wind_speed = str(int(weather.get_wind()['speed']))
|
||||
forecast_object.wind_speed = str(int(weather.get_wind()['speed'])) #kmh
|
||||
|
||||
if forecast_object.units == "aviation":
|
||||
forecast_object.air_temperature = str(int(weather.get_temperature(unit='celsius')['temp']))
|
||||
forecast_object.wind_speed = str(int(weather.get_wind()['speed'] * 1.94384)) #knots
|
||||
|
||||
if forecast_object.units == "imperial":
|
||||
forecast_object.air_temperature = str(int(weather.get_temperature('fahrenheit')['temp']))
|
||||
forecast_object.wind_speed = str(int(weather.get_wind()['speed'] * 0.621))
|
||||
forecast_object.wind_speed = str(int(weather.get_wind()['speed'] * 0.621)) #mph
|
||||
|
||||
forecast_object.sunrise = datetime.fromtimestamp(int(weather.get_sunrise_time(timeformat='unix')))
|
||||
forecast_object.sunset = datetime.fromtimestamp(int(weather.get_sunset_time(timeformat='unix')))
|
||||
|
|
|
@ -30,6 +30,12 @@ class WeatherColumnDesign (DesignEntity):
|
|||
def __draw_infos__ (self, forecast):
|
||||
temperature = forecast.air_temperature + " " + self.__get_unit__(("°C", "°F"))
|
||||
humidity = forecast.air_humidity + "%"
|
||||
if self.forecast.units== "aviation":
|
||||
if int(forecast.wind_speed)<10:
|
||||
windspeed = forecast.wind_deg + "@" + "0" + forecast.wind_speed + self.__get_unit__(("", "")) #added degrees, if wind<10 add a 0 to make two digit
|
||||
else:
|
||||
windspeed = forecast.wind_deg + "@" + forecast.wind_speed + self.__get_unit__(("", "")) #added degrees
|
||||
else:
|
||||
windspeed = forecast.wind_speed + " " + self.__get_unit__(("km/h", "mph"))
|
||||
|
||||
numbers_list = [ [ forecast.short_description ],
|
||||
|
@ -40,6 +46,7 @@ class WeatherColumnDesign (DesignEntity):
|
|||
ypos = info_x_ypos * self.size[0]
|
||||
pos = (0, ypos)
|
||||
size = (self.size[0], self.size[1] + info_yresize * self.size[1] - pos[1])
|
||||
print(size)
|
||||
line_spacing = (size[1] - len(numbers_list) * fontsize_static) / (len(numbers_list) + 1)
|
||||
|
||||
table = TableDesign(size, numbers_list, fontsize=fontsize_static, line_spacing=line_spacing, column_horizontal_alignments=[ "center" ], max_col_size=[ size[0] ], truncate_text=False, truncate_rows=False)
|
||||
|
|
|
@ -29,6 +29,12 @@ class WeatherHeaderDesign (DesignEntity):
|
|||
return
|
||||
|
||||
temperature = cur_weather.air_temperature + " " + self.__get_unit__(("°C", "°F"))
|
||||
if units== "aviation": #pick up aviation
|
||||
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:
|
||||
windspeed = cur_weather.wind_deg + "@" + cur_weather.wind_speed + self.__get_unit__(("", "")) #added degrees
|
||||
else:
|
||||
windspeed = cur_weather.wind_speed + " " + self.__get_unit__(("km/h", "mph"))
|
||||
|
||||
self.__draw_text__(temperature, self.__abs_pos__((0.87, 0)), (50,35))
|
||||
|
|
|
@ -18,7 +18,7 @@ week_starts_on = "Monday"
|
|||
display_colours = "bwr"
|
||||
language = "en"
|
||||
datetime_encoding = "UTF-8" # UTF-8
|
||||
units = "metric"
|
||||
units = "metric" #aviation (celcius,degrees/knots), metric (celcius,kmh), imperial(f,mph)
|
||||
hours = "24"
|
||||
update_interval = 60
|
||||
|
||||
|
|
Loading…
Reference in a new issue