-
Notifications
You must be signed in to change notification settings - Fork 0
/
weather.kv
149 lines (139 loc) · 4.27 KB
/
weather.kv
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#: import main main
#: import ListAdapter kivy.adapters.listadapter.ListAdapter
WeatherRoot:
<WeatherRoot>:
carousel: carousel
locations: locations
current_weather: current_weather
forecast: forecast
BoxLayout:
orientation: "vertical"
ActionBar:
ActionView:
use_separator: True
ActionPrevious:
title: "Anita's Weather"
with_previous: False
ActionOverflow:
ActionButton:
text: "Add Location"
on_press: app.root.show_add_location_form()
ActionButton:
text: "Settings"
on_press: app.open_settings()
ActionButton:
text: "Locations"
on_press: app.root.carousel.load_slide(app.root.locations)
ActionButton:
text: "Current"
on_press: app.root.carousel.load_slide(app.root.current_weather)
ActionButton:
text: "Forecast"
on_press: app.root.carousel.load_slide(app.root.forecast)
Carousel:
id: carousel
Locations:
id: locations
CurrentWeather:
id: current_weather
Forecast:
id: forecast
<AddLocationForm>:
search_input: search_box
search_results: search_results_list
BoxLayout:
orientation: "vertical"
BoxLayout:
height: "40dp"
size_hint_y: None
TextInput:
id: search_box
size_hint_x: 50
focus: True
multiline: False
on_text_validate: root.search_location()
Button:
text: "Search"
size_hint_x: 25
on_press: root.search_location()
Button:
text: "Current Location"
size_hint_x: 25
ListView:
id: search_results_list
adapter:
ListAdapter(data=[], cls=main.LocationButton, args_converter=main.locations_args_converter)
Button:
text: "Cancel"
size_hint_y: None
height: "40dp"
on_press: root.dismiss()
<CurrentWeather>:
orientation: "vertical"
BoxLayout:
Label:
text: "{} ({})".format(root.location[0], root.location[1])
font_size: "30dp"
Label:
text: "{}".format(root.temp)
font_size: "30dp"
BoxLayout:
orientation: "horizontal"
Label:
text: root.conditions
AsyncImage:
source: root.conditions_image
BoxLayout:
orientation: "horizontal"
Label:
text: "Low: {}".format(root.temp_min)
Label:
text: "High: {}".format(root.temp_max)
<Locations@BoxLayout>:
orientation: "vertical"
locations_list: locations_list
ListView:
id: locations_list
adapter:
ListAdapter(data=[], cls=main.LocationButton,
args_converter=main.locations_args_converter)
<LocationButton>:
text: "{} ({})".format(self.location[0], self.location[1])
height: "40dp"
size_hint_y: None
on_press: app.root.show_current_weather(self.location)
<ForecastLabel@BoxLayout>:
date: ""
conditions_image: ""
conditions: ""
temp_min: None
temp_max: None
canvas.before:
Color:
rgb: [0.2, 0.2, 0.2]
Line:
points: [self.pos[0], self.pos[1], self.width, self.pos[1]]
Label:
text: root.date
BoxLayout:
orientation: "vertical"
AsyncImage:
source: root.conditions_image
Label:
text: root.conditions
BoxLayout:
orientation: "vertical"
Label:
text: "Low: {}".format(root.temp_min)
Label:
text: "High: {}".format(root.temp_max)
<Forecast>:
forecast_container: forecast_container
orientation: "vertical"
Label:
size_hint_y: 0.1
font_size: "30dp"
text: "{} ({})".format(root.location[0], root.location[1])
BoxLayout:
orientation: "vertical"
id: forecast_container