-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurrent_extra.py
More file actions
80 lines (78 loc) · 2.5 KB
/
Copy pathcurrent_extra.py
File metadata and controls
80 lines (78 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import datetime
import flet
from flet import *
def current_info(_current):
_extra_info = []
_extra = [
[
int(_current.json()["current"]["visibility"] // 1000),
"Km",
"Visibility",
"../assests/visibility.png",
],
[
round(_current.json()["current"]["pressure"] * 0.03, 2),
"inHg",
"Pressure",
"../assests/pressure.png",
],
[
datetime.datetime.fromtimestamp(
_current.json()["current"]["sunrise"]
).strftime("%I:%M %p"),
"",
"Sunrise",
"../assests/sunrise.png"
],
[
datetime.datetime.fromtimestamp(
_current.json()["current"]["sunset"]
).strftime("%I:%M %p"),
"",
"Sunset",
"../assests/sunset.png"
],
]
for data in _extra:
_extra_info.append(
Container(
bgcolor="white10",
border_radius=12,
alignment=alignment.center,
content=Column(
alignment="center",
horizontal_alignment="center",
spacing=25,
controls=[
Container(
alignment=alignment.center,
content=Image(
src=data[3],
color="white",
),
width=32,
height=32,
),
Container(
content=Column(
alignment="center",
horizontal_alignment="center",
spacing=0,
controls=[
Text(
str(data[0]) + " " + data[1],
size=14,
),
Text(
data[2],
size=11,
color="white54",
),
],
),
),
],
),
),
)
return _extra_info