2020-07-16 16:25:49 +00:00
|
|
|
#:import random random.random
|
|
|
|
|
#:import RiseInTransition kivy.uix.screenmanager.RiseInTransition
|
2020-08-30 21:35:08 +00:00
|
|
|
#:import SlideTransition kivy.uix.screenmanager.SlideTransition
|
2020-08-11 04:50:25 +00:00
|
|
|
#:import facade plyer.compass
|
2020-08-28 23:56:32 +00:00
|
|
|
#:import rgba kivy.utils.get_color_from_hex
|
|
|
|
|
|
|
|
|
|
<BackgroundColor@Widget>:
|
|
|
|
|
background_color: 1, 1, 1, 1
|
|
|
|
|
canvas.before:
|
|
|
|
|
Color:
|
|
|
|
|
rgba: root.background_color
|
|
|
|
|
Rectangle:
|
|
|
|
|
size: self.size
|
|
|
|
|
pos: self.pos
|
|
|
|
|
|
|
|
|
|
<BackgroundLabel@Label+BackgroundColor>:
|
|
|
|
|
background_color: 0, 0, 0, 0
|
|
|
|
|
background_color: rgba("#c0464b")
|
2020-08-11 04:50:25 +00:00
|
|
|
|
2020-07-16 17:14:47 +00:00
|
|
|
|
2020-08-30 19:18:01 +00:00
|
|
|
<BgSlider@Slider+BackgroundColor>:
|
|
|
|
|
background_color: 0, 0, 0, 0
|
|
|
|
|
background_color: rgba("#c0464b")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<BgSwitch@Switch+BackgroundColor>:
|
|
|
|
|
background_color: 0, 0, 0, 0
|
|
|
|
|
background_color: rgba("#c0464b")
|
|
|
|
|
|
|
|
|
|
|
2020-08-05 02:52:20 +00:00
|
|
|
<RootScreen>:
|
2020-08-11 04:50:25 +00:00
|
|
|
MapScreen:
|
2020-08-05 02:52:20 +00:00
|
|
|
CompassScreen:
|
|
|
|
|
|
2020-07-16 17:14:47 +00:00
|
|
|
|
2020-07-16 16:25:49 +00:00
|
|
|
<MapScreen>:
|
2020-08-28 04:40:20 +00:00
|
|
|
FloatLayout:
|
2020-07-16 16:25:49 +00:00
|
|
|
MapView:
|
|
|
|
|
id: mapview
|
2020-08-11 01:47:11 +00:00
|
|
|
zoom: 16
|
2020-08-05 02:52:20 +00:00
|
|
|
|
2020-08-28 04:40:20 +00:00
|
|
|
on_map_relocated:
|
|
|
|
|
centermark.lat = mapview.lat
|
|
|
|
|
centermark.lon = mapview.lon
|
|
|
|
|
selfmark.lat = app.gps_data.get('lat', 0)
|
|
|
|
|
selfmark.lon = app.gps_data.get('lon', 0)
|
|
|
|
|
MapMarker:
|
2020-08-28 17:34:16 +00:00
|
|
|
source: 'assets/marker_self.png'
|
2020-08-28 04:40:20 +00:00
|
|
|
id: selfmark
|
|
|
|
|
anchor_x: 0.5
|
|
|
|
|
anchor_y: 0
|
2020-07-16 16:25:49 +00:00
|
|
|
MapMarker:
|
2020-08-28 17:34:16 +00:00
|
|
|
source: 'assets/marker_dest.png'
|
2020-07-17 00:17:49 +00:00
|
|
|
id: centermark
|
2020-08-28 04:40:20 +00:00
|
|
|
anchor_x: 0.5
|
|
|
|
|
anchor_y: 0
|
|
|
|
|
TextInput:
|
|
|
|
|
pos_hint: {"x":0.05, "top":0.97}
|
2020-08-28 05:17:56 +00:00
|
|
|
size_hint: 0.9, None
|
|
|
|
|
height: "32sp"
|
|
|
|
|
font_size: '20sp'
|
|
|
|
|
hint_text: 'buscar destino'
|
2020-08-28 04:40:20 +00:00
|
|
|
multiline: False
|
2020-08-28 17:22:30 +00:00
|
|
|
IconButton:
|
|
|
|
|
pos_hint: {"x":.8, "top":0.95}
|
|
|
|
|
size_hint: 0.2, 0.2
|
2020-09-03 17:26:35 +00:00
|
|
|
source: 'assets/to_compass.png'
|
2020-08-30 21:35:08 +00:00
|
|
|
on_press: root.manager.transition = RiseInTransition(); root.manager.current = 'compass'; app.set_destination()
|
2020-08-28 17:22:30 +00:00
|
|
|
IconButton:
|
2020-08-28 17:34:16 +00:00
|
|
|
source: 'assets/to_self.png'
|
2020-08-28 17:22:30 +00:00
|
|
|
pos_hint: {"x":0.4, "bottom":0.1}
|
|
|
|
|
size_hint: 0.2, 0.2
|
2020-08-28 04:40:20 +00:00
|
|
|
on_press: app.center_map_on_gps()
|
2020-08-28 17:22:30 +00:00
|
|
|
IconButton:
|
2020-08-30 19:18:01 +00:00
|
|
|
pos_hint: {"x":0.8, "bottom":0.1}
|
2020-08-28 17:22:30 +00:00
|
|
|
size_hint: 0.2, 0.2
|
2020-08-28 17:34:16 +00:00
|
|
|
source: 'assets/to_settings.png'
|
2020-08-30 21:35:08 +00:00
|
|
|
on_press: root.manager.transition = SlideTransition(direction='right'); root.manager.current = 'settings'
|
2020-07-16 16:25:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
<CompassScreen>:
|
2020-08-11 04:50:25 +00:00
|
|
|
facade: facade
|
2020-07-16 22:42:33 +00:00
|
|
|
orientation: 'vertical'
|
|
|
|
|
padding: '20dp'
|
|
|
|
|
spacing: '10dp'
|
2020-08-28 23:56:32 +00:00
|
|
|
FloatLayout:
|
|
|
|
|
canvas:
|
|
|
|
|
Color:
|
2020-09-03 18:38:41 +00:00
|
|
|
rgba: rgba(app.theme['bgcolor'])
|
2020-08-28 23:56:32 +00:00
|
|
|
Rectangle:
|
|
|
|
|
size: self.size
|
2020-08-30 19:18:01 +00:00
|
|
|
Image:
|
2020-09-03 18:38:41 +00:00
|
|
|
id: needle
|
|
|
|
|
source: app.theme['needle']
|
2020-08-30 19:18:01 +00:00
|
|
|
pos_hint: {"center_x": 0.5, "center_y": 0.7}
|
2020-08-28 23:56:32 +00:00
|
|
|
canvas.before:
|
|
|
|
|
PushMatrix
|
|
|
|
|
Rotate:
|
|
|
|
|
angle: app.needle_angle
|
|
|
|
|
axis: 0, 0, 1
|
|
|
|
|
origin: self.center
|
|
|
|
|
canvas.after:
|
|
|
|
|
PopMatrix
|
|
|
|
|
Image:
|
|
|
|
|
id: to_dest
|
|
|
|
|
source: 'assets/needle_to_dest.png'
|
2020-08-30 19:18:01 +00:00
|
|
|
pos_hint: {"center_x": 0.5, "center_y": 0.7}
|
2020-08-28 23:56:32 +00:00
|
|
|
canvas.before:
|
|
|
|
|
PushMatrix
|
|
|
|
|
Rotate:
|
|
|
|
|
angle: app.fbearing
|
|
|
|
|
axis: 0, 0, 1
|
|
|
|
|
origin: self.center
|
|
|
|
|
canvas.after:
|
|
|
|
|
PopMatrix
|
|
|
|
|
Image:
|
|
|
|
|
source: 'assets/pivot.png'
|
|
|
|
|
pos_hint: {"center_x": 0.5, "center_y": 0.7}
|
|
|
|
|
size_hint: 1, 1
|
|
|
|
|
IconButton:
|
2020-09-03 18:38:41 +00:00
|
|
|
source: app.theme['to_map']
|
2020-08-28 23:56:32 +00:00
|
|
|
pos_hint: {"center_x": 0.1, "center_y": 0.95}
|
|
|
|
|
size_hint: 0.2, 0.2
|
|
|
|
|
on_press: root.manager.current = 'map';
|
|
|
|
|
BackgroundLabel:
|
|
|
|
|
text: app.dest_distance
|
2020-08-30 19:18:01 +00:00
|
|
|
background_color: rgba("#c0464b")
|
2020-08-28 23:56:32 +00:00
|
|
|
color: rgba("#f3e8d2")
|
|
|
|
|
size_hint: 1, 0.2
|
|
|
|
|
pos_hint: {"x": 0, "top": 0.4}
|
|
|
|
|
font_size: '40sp'
|
|
|
|
|
BackgroundLabel:
|
|
|
|
|
text: app.dashboard_flock
|
|
|
|
|
background_color: rgba("#679958")
|
2020-08-30 19:18:01 +00:00
|
|
|
color: rgba("#f3e8d2")
|
2020-08-28 23:56:32 +00:00
|
|
|
size_hint: 1, 0.2
|
2020-08-30 19:18:01 +00:00
|
|
|
pos_hint: {"x": 0, "top": 0.2}
|
2020-08-28 23:56:32 +00:00
|
|
|
font_size: '40sp'
|
2020-08-30 19:18:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<SettingsScreen>:
|
|
|
|
|
GridLayout:
|
|
|
|
|
cols: 2
|
|
|
|
|
BackgroundLabel:
|
|
|
|
|
text: "Dark theme"
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
font_size: '14sp'
|
|
|
|
|
BgSwitch:
|
|
|
|
|
id: dark_theme
|
|
|
|
|
active: True
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
2020-09-03 18:38:41 +00:00
|
|
|
on_active: app.set_dark_theme(self.active)
|
2020-08-30 19:18:01 +00:00
|
|
|
BackgroundLabel:
|
|
|
|
|
text: "Compas smoothing"
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
font_size: '14sp'
|
|
|
|
|
BgSlider:
|
|
|
|
|
id: slider_smoothing
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
2020-08-30 20:22:19 +00:00
|
|
|
min: 0.05
|
|
|
|
|
max: 0.99
|
|
|
|
|
step: 0.05
|
2020-08-30 19:18:01 +00:00
|
|
|
orientation: 'horizontal'
|
2020-08-30 21:21:28 +00:00
|
|
|
value: app.session_data['settings_smoothing']
|
2020-08-30 20:22:19 +00:00
|
|
|
on_value: app.set_smoothing()
|
2020-08-30 20:41:04 +00:00
|
|
|
|
|
|
|
|
BackgroundLabel:
|
|
|
|
|
text: "Compas update frequency"
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
font_size: '14sp'
|
|
|
|
|
BgSlider:
|
|
|
|
|
id: slider_compass_update
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
min: 0.1
|
|
|
|
|
max: 0.9
|
|
|
|
|
step: 0.05
|
|
|
|
|
orientation: 'horizontal'
|
2020-08-30 21:21:28 +00:00
|
|
|
value: app.session_data['settings_compass_update']
|
2020-08-30 20:41:04 +00:00
|
|
|
on_value: app.set_compass_update()
|
|
|
|
|
|
2020-08-30 19:18:01 +00:00
|
|
|
BackgroundLabel:
|
|
|
|
|
text: "Update frequency"
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
font_size: '14sp'
|
|
|
|
|
BgSlider:
|
|
|
|
|
id: slider_update_freq
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
min: 0
|
|
|
|
|
max: 1
|
|
|
|
|
step: 0.1
|
|
|
|
|
orientation: 'horizontal'
|
|
|
|
|
value: 0.5
|
|
|
|
|
BackgroundLabel:
|
|
|
|
|
text: "Local altruism"
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
font_size: '14sp'
|
|
|
|
|
BgSlider:
|
|
|
|
|
id: slider_local_altruism
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
min: 0
|
|
|
|
|
max: 1
|
|
|
|
|
step: 0.1
|
|
|
|
|
orientation: 'horizontal'
|
|
|
|
|
value: 0.1
|
|
|
|
|
BackgroundLabel:
|
|
|
|
|
text: "Destination altruism"
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
font_size: '14sp'
|
|
|
|
|
BgSlider:
|
|
|
|
|
id: slider_dest_altruism
|
|
|
|
|
background_color: rgba("#f3e8d2")
|
|
|
|
|
color: rgba("#346645")
|
|
|
|
|
min: 0
|
|
|
|
|
max: 1
|
|
|
|
|
step: 0.2
|
|
|
|
|
orientation: 'horizontal'
|
|
|
|
|
value: 0.2
|