flockompass/flockompass.kv
2020-08-28 12:22:30 -05:00

112 lines
3.2 KiB
Plaintext

#:import random random.random
#:import RiseInTransition kivy.uix.screenmanager.RiseInTransition
#:import facade plyer.compass
<RootScreen>:
MapScreen:
CompassScreen:
<MapScreen>:
FloatLayout:
MapView:
id: mapview
zoom: 16
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:
source: 'marker_self.png'
id: selfmark
anchor_x: 0.5
anchor_y: 0
MapMarker:
source: 'marker.png'
id: centermark
anchor_x: 0.5
anchor_y: 0
TextInput:
pos_hint: {"x":0.05, "top":0.97}
size_hint: 0.9, None
height: "32sp"
font_size: '20sp'
hint_text: 'buscar destino'
multiline: False
IconButton:
pos_hint: {"x":.8, "top":0.95}
size_hint: 0.2, 0.2
source: 'dark_to_compass_icon.png'
on_press: root.manager.current = 'compass'; app.set_destination()
IconButton:
source: 'to_self.png'
pos_hint: {"x":0.4, "bottom":0.1}
size_hint: 0.2, 0.2
on_press: app.center_map_on_gps()
IconButton:
pos_hint: {"x":0.8, "bottom":0.1}
size_hint: 0.2, 0.2
source: 'to_settings.png'
on_press: root.manager.current = 'settings';
<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';
FloatLayout:
canvas:
Color:
rgb: .9, .9, .9
Rectangle:
size: self.size
Label:
text: app.dest_distance
color: 0, 0, 0.3, 1
size_hint: 0.5, 0.1
pos: 0, 0.1
font_size: '40sp'
Image:
source: 'needle.png'
canvas.before:
PushMatrix
Rotate:
angle: app.needle_angle
axis: 0, 0, 1
origin: self.center
canvas.after:
PopMatrix
Image:
id: to_dest
source: 'needle_to_dest.png'
canvas.before:
PushMatrix
Rotate:
angle: app.fbearing
axis: 0, 0, 1
origin: self.center
canvas.after:
PopMatrix
Image:
source: 'pivot.png'