On evening, if rain is expected next day, display it
This commit is contained in:
parent
af4730a964
commit
cb2aea4113
@ -182,7 +182,11 @@ class WeatherSunMoonModule:
|
|||||||
class WeatherRainModule:
|
class WeatherRainModule:
|
||||||
|
|
||||||
def draw_module(self, config, width, height):
|
def draw_module(self, config, width, height):
|
||||||
thisdayweather = WeatherAPI().get_daily()["data"][0]
|
if datetime.now().hour >= 21:
|
||||||
|
thisdayweather = WeatherAPI().get_daily()["data"][1]
|
||||||
|
else:
|
||||||
|
thisdayweather = WeatherAPI().get_daily()["data"][0]
|
||||||
|
|
||||||
|
|
||||||
gauge = pygal.SolidGauge(half_pie=True, inner_radius=0.70, width=width, height=height*1.55, style=config.pygal_custom_style, show_legend=False, margin_top=-height*0.58, margin_left=1, margin_right=1)
|
gauge = pygal.SolidGauge(half_pie=True, inner_radius=0.70, width=width, height=height*1.55, style=config.pygal_custom_style, show_legend=False, margin_top=-height*0.58, margin_left=1, margin_right=1)
|
||||||
percent_formatter = lambda x: '{:.10g}%'.format(x)
|
percent_formatter = lambda x: '{:.10g}%'.format(x)
|
||||||
@ -212,7 +216,11 @@ class WeatherTemperatureModule:
|
|||||||
self.limit_futur = 30
|
self.limit_futur = 30
|
||||||
|
|
||||||
def draw_module(self, config, width, height):
|
def draw_module(self, config, width, height):
|
||||||
thisdayweather = WeatherAPI().get_daily()["data"][0]
|
thisdayweather = WeatherAPI().get_daily()["data"]
|
||||||
|
if datetime.now().hour >= 19 and thisdayweather[1]["precipProbability"] > thisdayweather[0]["precipProbability"]:
|
||||||
|
thisdayweather = thisdayweather[1]
|
||||||
|
else:
|
||||||
|
thisdayweather = thisdayweather[0]
|
||||||
|
|
||||||
line_chart = pygal.Line(interpolate='cubic', width=width, height=height, inverse_y_axis=False, x_label_rotation=45, secondary_range=(0,100) if thisdayweather["precipProbability"] > 0 else (0,10), **config.charts_opts)
|
line_chart = pygal.Line(interpolate='cubic', width=width, height=height, inverse_y_axis=False, x_label_rotation=45, secondary_range=(0,100) if thisdayweather["precipProbability"] > 0 else (0,10), **config.charts_opts)
|
||||||
line_chart.value_formatter = lambda x: "%d" % x
|
line_chart.value_formatter = lambda x: "%d" % x
|
||||||
|
Loading…
Reference in New Issue
Block a user