Rename rain to precipitation
This commit is contained in:
parent
b038d801b2
commit
0f5b2d914e
21
clock.py
21
clock.py
|
@ -287,8 +287,8 @@ class MyClockWidget(FloatLayout):
|
|||
[70.0/255.0, 0.0, 255.0/255.0], # 10.0 <= x purple (terrible)
|
||||
]
|
||||
|
||||
rain = []
|
||||
rain_thresholds = [0.1, 0.22, 0.47, 1.0, 2.2, 4.7, 10, 22, 47, 100]
|
||||
precipitation = []
|
||||
precipitation_thresholds = [0.1, 0.22, 0.47, 1.0, 2.2, 4.7, 10, 22, 47, 100]
|
||||
pollen = []
|
||||
pollen_thresholds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
aqi = []
|
||||
|
@ -315,10 +315,9 @@ class MyClockWidget(FloatLayout):
|
|||
return
|
||||
|
||||
url = "https://sinoptik.luon.net/forecast?address=" + urllib.parse.quote(self.settings.address, safe="") + "&metrics=precipitation&metrics=UVI&metrics=AQI&metrics=pollen&metrics=PAQI"
|
||||
print("URL: " + url)
|
||||
response = requests.get(url)
|
||||
|
||||
self.rain = []
|
||||
self.precipitation = []
|
||||
self.pollen = []
|
||||
self.aqi = []
|
||||
self.paqi = []
|
||||
|
@ -328,7 +327,7 @@ class MyClockWidget(FloatLayout):
|
|||
t = datetime.datetime.now().timestamp()
|
||||
j = json.loads(response.text)
|
||||
|
||||
self.rain = self.get_air_quality_metric(j, t, "precipitation", 300)
|
||||
self.precipitation = self.get_air_quality_metric(j, t, "precipitation", 300)
|
||||
self.pollen = self.get_air_quality_metric(j, t, "pollen", 3600)
|
||||
self.aqi = self.get_air_quality_metric(j, t, "AQI", 3600)
|
||||
self.paqi = self.get_air_quality_metric(j, t, "PAQI", 3600)
|
||||
|
@ -602,7 +601,7 @@ class MyClockWidget(FloatLayout):
|
|||
self.draw_list_curr_frame.append(["Color", reference.canvas, color[0], color[1], color[2]])
|
||||
self.draw_list_curr_frame.append(["Ellipse", reference.canvas, [2 * r, 2 * r], p])
|
||||
|
||||
def draw_rain_aqi_expectation(self, x, x_thresholds, location):
|
||||
def draw_precipitation_aqi_expectation(self, x, x_thresholds, location):
|
||||
if len(x) == 0:
|
||||
return
|
||||
|
||||
|
@ -629,11 +628,11 @@ class MyClockWidget(FloatLayout):
|
|||
self.draw_colored_circle(face_plate, coord_x, coord_y, r, color)
|
||||
|
||||
|
||||
def draw_rain_expectation(self):
|
||||
self.draw_rain_aqi_expectation(self.rain, self.rain_thresholds, 0.45)
|
||||
def draw_precipitation_expectation(self):
|
||||
self.draw_precipitation_aqi_expectation(self.precipitation, self.precipitation_thresholds, 0.45)
|
||||
|
||||
def draw_aqi_expectation(self):
|
||||
self.draw_rain_aqi_expectation(self.paqi, self.paqi_thresholds, 0.32)
|
||||
self.draw_precipitation_aqi_expectation(self.paqi, self.paqi_thresholds, 0.32)
|
||||
|
||||
def draw_face(self):
|
||||
self.draw_numbers()
|
||||
|
@ -651,11 +650,11 @@ class MyClockWidget(FloatLayout):
|
|||
else:
|
||||
t = datetime.datetime.now()
|
||||
|
||||
if (self.view == "clock") and (self.rain != []) and (self.paqi != []):
|
||||
if (self.view == "clock") and (self.precipitation != []) and (self.paqi != []):
|
||||
for i in range(0, 12):
|
||||
self.face_numbers[i].text = ""
|
||||
|
||||
self.draw_rain_expectation()
|
||||
self.draw_precipitation_expectation()
|
||||
self.draw_aqi_expectation()
|
||||
else:
|
||||
with face_plate.canvas:
|
||||
|
|
Loading…
Reference in New Issue