flockompass/flockompass.kv

212 lines
6.0 KiB
Plaintext
Raw Normal View History

#:import random random.random
#:import RiseInTransition kivy.uix.screenmanager.RiseInTransition
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
<MapScreen>:
2020-08-28 04:40:20 +00:00
FloatLayout:
MapView:
id: mapview
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-17 00:17: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-08-28 17:34:16 +00:00
source: 'assets/dark_to_compass_icon.png'
2020-08-30 19:18:01 +00:00
on_press: 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-28 17:22:30 +00:00
on_press: root.manager.current = 'settings';
<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:
rgba: rgba("#336645")
Rectangle:
size: self.size
2020-08-30 19:18:01 +00:00
Image:
2020-08-28 23:56:32 +00:00
source: 'assets/needle.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.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:
source: 'assets/to_map.png'
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")
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")
min: 0
max: 1
step: 0.1
orientation: 'horizontal'
value: 0.88
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