From 5c0f0d22c90ac6837044c2ec7eb2402c7da47d2e Mon Sep 17 00:00:00 2001 From: rgarcia-herrera Date: Sun, 30 Aug 2020 14:18:01 -0500 Subject: [PATCH] settings screen --- flockompass.kv | 99 +++++++++++++++++++++++++++++++++++++++++++++----- main.py | 9 +++++ 2 files changed, 99 insertions(+), 9 deletions(-) diff --git a/flockompass.kv b/flockompass.kv index 99ea981..7671757 100644 --- a/flockompass.kv +++ b/flockompass.kv @@ -17,6 +17,16 @@ background_color: rgba("#c0464b") +: + background_color: 0, 0, 0, 0 + background_color: rgba("#c0464b") + + +: + background_color: 0, 0, 0, 0 + background_color: rgba("#c0464b") + + : MapScreen: CompassScreen: @@ -25,7 +35,6 @@ : FloatLayout: MapView: - id: mapview zoom: 16 @@ -57,14 +66,14 @@ pos_hint: {"x":.8, "top":0.95} size_hint: 0.2, 0.2 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: source: 'assets/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} + pos_hint: {"x":0.8, "bottom":0.1} size_hint: 0.2, 0.2 source: 'assets/to_settings.png' on_press: root.manager.current = 'settings'; @@ -82,9 +91,9 @@ rgba: rgba("#336645") Rectangle: size: self.size - Image: + Image: 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: PushMatrix Rotate: @@ -96,7 +105,7 @@ Image: id: to_dest 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: PushMatrix Rotate: @@ -116,7 +125,7 @@ on_press: root.manager.current = 'map'; BackgroundLabel: text: app.dest_distance - background_color: rgba("#c0464b") + background_color: rgba("#c0464b") color: rgba("#f3e8d2") size_hint: 1, 0.2 pos_hint: {"x": 0, "top": 0.4} @@ -124,7 +133,79 @@ BackgroundLabel: text: app.dashboard_flock background_color: rgba("#679958") - color: rgba("#f3e8d2") + color: rgba("#f3e8d2") size_hint: 1, 0.2 - pos_hint: {"x": 0, "top": 0.2} + pos_hint: {"x": 0, "top": 0.2} font_size: '40sp' + + + +: + 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 diff --git a/main.py b/main.py index c1009d1..ad3230b 100644 --- a/main.py +++ b/main.py @@ -27,6 +27,10 @@ class CompassScreen(Screen): pass +class SettingsScreen(Screen): + pass + + class FlockompassApp(App): gps_data = DictProperty() @@ -195,6 +199,11 @@ class FlockompassApp(App): screen_manager.add_widget(self.cs) + + self.ss = SettingsScreen(name='settings') + screen_manager.add_widget(self.ss) + + # smoothing vars for compass self.last_angle = 0