-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
38 lines (30 loc) · 1.26 KB
/
main.py
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
from kivy.app import App
import widgets.weather_root
from widgets.location_button import LocationButton
class WeatherApp(App):
def build_config(self, config):
config.setdefaults('General', {'temp_type': "Metric"})
def build_settings(self, settings):
settings.add_json_panel("Weather Settings", self.config,
data="""
[
{
"type": "options",
"title": "Temperature System",
"section": "General",
"key": "temp_type",
"options": ["Metric", "Imperial"]
}
]
""")
def on_config_change(self, config, section, key, value):
if config is self.config and key == "temp_type":
try:
self.root.children[0].update_weather()
except AttributeError:
pass
def args_converter(index, data_item):
city, country = data_item
return {'location': (city, country)}
if __name__ == '__main__':
WeatherApp().run()