settings screen

This commit is contained in:
rgarcia-herrera 2020-08-30 14:18:01 -05:00
parent c7c4760c8c
commit 5c0f0d22c9
2 changed files with 99 additions and 9 deletions

View File

@ -17,6 +17,16 @@
background_color: rgba("#c0464b") background_color: rgba("#c0464b")
<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")
<RootScreen>: <RootScreen>:
MapScreen: MapScreen:
CompassScreen: CompassScreen:
@ -25,7 +35,6 @@
<MapScreen>: <MapScreen>:
FloatLayout: FloatLayout:
MapView: MapView:
id: mapview id: mapview
zoom: 16 zoom: 16
@ -57,14 +66,14 @@
pos_hint: {"x":.8, "top":0.95} pos_hint: {"x":.8, "top":0.95}
size_hint: 0.2, 0.2 size_hint: 0.2, 0.2
source: 'assets/dark_to_compass_icon.png' source: 'assets/dark_to_compass_icon.png'
on_press: root.manager.current = 'compass'; app.set_destination() on_press: root.manager.current = 'compass'; app.set_destination()
IconButton: IconButton:
source: 'assets/to_self.png' source: 'assets/to_self.png'
pos_hint: {"x":0.4, "bottom":0.1} pos_hint: {"x":0.4, "bottom":0.1}
size_hint: 0.2, 0.2 size_hint: 0.2, 0.2
on_press: app.center_map_on_gps() on_press: app.center_map_on_gps()
IconButton: IconButton:
pos_hint: {"x":0.8, "bottom":0.1} pos_hint: {"x":0.8, "bottom":0.1}
size_hint: 0.2, 0.2 size_hint: 0.2, 0.2
source: 'assets/to_settings.png' source: 'assets/to_settings.png'
on_press: root.manager.current = 'settings'; on_press: root.manager.current = 'settings';
@ -82,9 +91,9 @@
rgba: rgba("#336645") rgba: rgba("#336645")
Rectangle: Rectangle:
size: self.size size: self.size
Image: Image:
source: 'assets/needle.png' source: 'assets/needle.png'
pos_hint: {"center_x": 0.5, "center_y": 0.7} pos_hint: {"center_x": 0.5, "center_y": 0.7}
canvas.before: canvas.before:
PushMatrix PushMatrix
Rotate: Rotate:
@ -96,7 +105,7 @@
Image: Image:
id: to_dest id: to_dest
source: 'assets/needle_to_dest.png' source: 'assets/needle_to_dest.png'
pos_hint: {"center_x": 0.5, "center_y": 0.7} pos_hint: {"center_x": 0.5, "center_y": 0.7}
canvas.before: canvas.before:
PushMatrix PushMatrix
Rotate: Rotate:
@ -116,7 +125,7 @@
on_press: root.manager.current = 'map'; on_press: root.manager.current = 'map';
BackgroundLabel: BackgroundLabel:
text: app.dest_distance text: app.dest_distance
background_color: rgba("#c0464b") background_color: rgba("#c0464b")
color: rgba("#f3e8d2") color: rgba("#f3e8d2")
size_hint: 1, 0.2 size_hint: 1, 0.2
pos_hint: {"x": 0, "top": 0.4} pos_hint: {"x": 0, "top": 0.4}
@ -124,7 +133,79 @@
BackgroundLabel: BackgroundLabel:
text: app.dashboard_flock text: app.dashboard_flock
background_color: rgba("#679958") background_color: rgba("#679958")
color: rgba("#f3e8d2") color: rgba("#f3e8d2")
size_hint: 1, 0.2 size_hint: 1, 0.2
pos_hint: {"x": 0, "top": 0.2} pos_hint: {"x": 0, "top": 0.2}
font_size: '40sp' font_size: '40sp'
<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

View File

@ -27,6 +27,10 @@ class CompassScreen(Screen):
pass pass
class SettingsScreen(Screen):
pass
class FlockompassApp(App): class FlockompassApp(App):
gps_data = DictProperty() gps_data = DictProperty()
@ -195,6 +199,11 @@ class FlockompassApp(App):
screen_manager.add_widget(self.cs) screen_manager.add_widget(self.cs)
self.ss = SettingsScreen(name='settings')
screen_manager.add_widget(self.ss)
# smoothing vars for compass # smoothing vars for compass
self.last_angle = 0 self.last_angle = 0