2020-07-16 16:25:49 +00:00
|
|
|
#:import random random.random
|
|
|
|
|
#:import RiseInTransition kivy.uix.screenmanager.RiseInTransition
|
2020-07-16 22:42:33 +00:00
|
|
|
#:import facade plyer.compass
|
2020-07-16 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
2020-07-16 16:25:49 +00:00
|
|
|
<MapScreen>:
|
|
|
|
|
BoxLayout:
|
2020-07-16 17:14:47 +00:00
|
|
|
orientation: 'vertical'
|
|
|
|
|
ActionBar:
|
|
|
|
|
pos_hint: {'top':1}
|
|
|
|
|
ActionView:
|
|
|
|
|
use_separator: True
|
|
|
|
|
ActionPrevious:
|
|
|
|
|
title: 'Social Cycling'
|
|
|
|
|
with_previous: False
|
|
|
|
|
ActionButton:
|
2020-07-17 00:17:49 +00:00
|
|
|
important: True
|
2020-07-16 17:14:47 +00:00
|
|
|
text: 'we ride together'
|
2020-07-17 00:17:49 +00:00
|
|
|
on_press: root.manager.current = 'compass'
|
2020-07-16 16:25:49 +00:00
|
|
|
|
|
|
|
|
MapView:
|
|
|
|
|
id: mapview
|
|
|
|
|
zoom: 15
|
2020-08-04 22:20:08 +00:00
|
|
|
|
2020-07-16 16:25:49 +00:00
|
|
|
on_map_relocated: centermark.lat = mapview.lat; centermark.lon = mapview.lon
|
2020-07-17 00:17:49 +00:00
|
|
|
|
2020-07-16 16:25:49 +00:00
|
|
|
MapMarker:
|
2020-07-17 00:17:49 +00:00
|
|
|
source: 'marker.png'
|
|
|
|
|
id: centermark
|
2020-07-16 16:25:49 +00:00
|
|
|
anchor_x: 0.2
|
|
|
|
|
anchor_y: 0.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<CompassScreen>:
|
2020-07-16 22:42:33 +00:00
|
|
|
facade: facade
|
|
|
|
|
orientation: 'vertical'
|
|
|
|
|
padding: '20dp'
|
|
|
|
|
spacing: '10dp'
|
2020-07-16 16:25:49 +00:00
|
|
|
BoxLayout:
|
2020-07-16 22:42:33 +00:00
|
|
|
orientation: 'vertical'
|
2020-08-04 22:41:17 +00:00
|
|
|
ActionBar:
|
|
|
|
|
pos_hint: {'top':1}
|
|
|
|
|
ActionView:
|
|
|
|
|
use_separator: True
|
|
|
|
|
ActionPrevious:
|
|
|
|
|
title: 'Social Cycling'
|
|
|
|
|
with_previous: False
|
|
|
|
|
ActionButton:
|
|
|
|
|
important: True
|
|
|
|
|
text: 'set destination'
|
|
|
|
|
on_press: root.manager.current = 'map'
|
|
|
|
|
|
2020-07-16 22:42:33 +00:00
|
|
|
BoxLayout:
|
|
|
|
|
orientation: 'horizontal'
|
2020-08-04 22:41:17 +00:00
|
|
|
size_hint_y: 0.07
|
2020-07-16 22:42:33 +00:00
|
|
|
Button:
|
|
|
|
|
id: enable_button
|
|
|
|
|
text: 'Enable Sensor'
|
|
|
|
|
disabled: False
|
|
|
|
|
on_release:
|
|
|
|
|
root.enable()
|
|
|
|
|
disable_button.disabled = not disable_button.disabled
|
|
|
|
|
enable_button.disabled = not enable_button.disabled
|
|
|
|
|
Button:
|
|
|
|
|
id: disable_button
|
|
|
|
|
text: 'Disable Sensor'
|
|
|
|
|
disabled: True
|
|
|
|
|
on_release:
|
|
|
|
|
root.disable()
|
|
|
|
|
disable_button.disabled = not disable_button.disabled
|
|
|
|
|
enable_button.disabled = not enable_button.disabled
|
2020-07-17 00:17:49 +00:00
|
|
|
|
2020-08-04 22:41:17 +00:00
|
|
|
Label:
|
|
|
|
|
text: root.gps_location
|
2020-07-17 00:17:49 +00:00
|
|
|
|
|
|
|
|
ToggleButton:
|
|
|
|
|
text: 'Start' if self.state == 'normal' else 'Stop'
|
|
|
|
|
on_state:
|
2020-07-17 02:12:36 +00:00
|
|
|
root.start(1000, 0) if self.state == 'down' else \
|
|
|
|
|
root.stop()
|
2020-07-17 00:17:49 +00:00
|
|
|
|
2020-07-17 02:12:36 +00:00
|
|
|
|
|
|
|
|
|
2020-07-17 00:17:49 +00:00
|
|
|
FloatLayout:
|
|
|
|
|
|
|
|
|
|
canvas:
|
|
|
|
|
Color:
|
2020-08-04 22:41:17 +00:00
|
|
|
rgb: .08, .08, .08
|
2020-07-17 00:17:49 +00:00
|
|
|
Rectangle:
|
|
|
|
|
size: self.size
|
|
|
|
|
|
|
|
|
|
Image:
|
|
|
|
|
source: 'rose.png'
|
|
|
|
|
|
|
|
|
|
Image:
|
|
|
|
|
source: 'needle.png'
|
|
|
|
|
|
|
|
|
|
canvas.before:
|
|
|
|
|
PushMatrix
|
|
|
|
|
Rotate:
|
|
|
|
|
angle: root.needle_angle
|
|
|
|
|
axis: 0, 0, 1
|
|
|
|
|
origin: self.center
|
|
|
|
|
|
|
|
|
|
canvas.after:
|
|
|
|
|
PopMatrix
|
|
|
|
|
|
2020-07-16 22:42:33 +00:00
|
|
|
# BoxLayout:
|
2020-07-17 00:17:49 +00:00
|
|
|
# orientation: 'vertical'
|
2020-07-16 22:42:33 +00:00
|
|
|
# canvas:
|
|
|
|
|
# Color:
|
|
|
|
|
# rgb: .98, .98, .98
|
|
|
|
|
# Rectangle:
|
|
|
|
|
# size: self.size
|
2020-07-16 18:43:28 +00:00
|
|
|
|
2020-07-16 22:42:33 +00:00
|
|
|
# Image:
|
|
|
|
|
# source: 'rose.png'
|
2020-07-16 18:43:28 +00:00
|
|
|
|
2020-07-16 22:42:33 +00:00
|
|
|
# Image:
|
2020-07-17 00:17:49 +00:00
|
|
|
# source: 'needle.png'
|
|
|
|
|
|
|
|
|
|
|
2020-07-16 22:42:33 +00:00
|
|
|
# ActionBar:
|
|
|
|
|
# pos_hint: {'top':1}
|
|
|
|
|
# ActionView:
|
|
|
|
|
# use_separator: True
|
|
|
|
|
# ActionPrevious:
|
|
|
|
|
# title: 'Social Cycling'
|
|
|
|
|
# with_previous: False
|
|
|
|
|
# ActionButton:
|
2020-07-17 00:17:49 +00:00
|
|
|
# important: True
|
2020-07-16 22:42:33 +00:00
|
|
|
# text: 'set destination'
|
2020-07-17 00:17:49 +00:00
|
|
|
# on_press: root.manager.current = 'map'
|
2020-07-16 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
2020-07-16 18:43:28 +00:00
|
|
|
|
2020-07-16 22:42:33 +00:00
|
|
|
# Label:
|
|
|
|
|
# text: app.gps_location
|
2020-07-16 18:43:28 +00:00
|
|
|
|
2020-07-16 22:42:33 +00:00
|
|
|
# Label:
|
|
|
|
|
# text: app.gps_status
|