flockompass/flockompass.kv
2020-08-04 17:41:17 -05:00

142 lines
3.9 KiB
Plaintext

#:import random random.random
#:import RiseInTransition kivy.uix.screenmanager.RiseInTransition
#:import facade plyer.compass
<MapScreen>:
BoxLayout:
orientation: 'vertical'
ActionBar:
pos_hint: {'top':1}
ActionView:
use_separator: True
ActionPrevious:
title: 'Social Cycling'
with_previous: False
ActionButton:
important: True
text: 'we ride together'
on_press: root.manager.current = 'compass'
MapView:
id: mapview
zoom: 15
on_map_relocated: centermark.lat = mapview.lat; centermark.lon = mapview.lon
MapMarker:
source: 'marker.png'
id: centermark
anchor_x: 0.2
anchor_y: 0.3
<CompassScreen>:
facade: facade
orientation: 'vertical'
padding: '20dp'
spacing: '10dp'
BoxLayout:
orientation: 'vertical'
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'
BoxLayout:
orientation: 'horizontal'
size_hint_y: 0.07
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
Label:
text: root.gps_location
ToggleButton:
text: 'Start' if self.state == 'normal' else 'Stop'
on_state:
root.start(1000, 0) if self.state == 'down' else \
root.stop()
FloatLayout:
canvas:
Color:
rgb: .08, .08, .08
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
# BoxLayout:
# orientation: 'vertical'
# canvas:
# Color:
# rgb: .98, .98, .98
# Rectangle:
# size: self.size
# Image:
# source: 'rose.png'
# Image:
# source: 'needle.png'
# 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'
# Label:
# text: app.gps_location
# Label:
# text: app.gps_status