Skip to content

Commit

Permalink
Added own location button to map screen
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Jan 5, 2024
1 parent b12860f commit 5413db1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions sbapp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4094,6 +4094,26 @@ def map_show_peer_location(self, context_dest):
self.map_action()
self.map_show(location)

def map_own_location_action(self, context_dest):
self.sideband.update_telemetry()
location = self.sideband.peer_location(self.sideband.lxmf_destination.hash)
if not location:
self.location_error_dialog = MDDialog(
title="No Location",
text="Your location is currently unknown. Make sure the relevant telemetry sensors and permissions have been enabled.",
buttons=[
MDRectangleFlatButton(
text="OK",
font_size=dp(18),
on_release=self.close_location_error_dialog
)
],
)
self.location_error_dialog.open()
else:
self.map_action()
self.map_show(location)

def map_display_telemetry(self, sender=None):
self.object_details_action(sender)

Expand Down
3 changes: 2 additions & 1 deletion sbapp/ui/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@
orientation: "vertical"
MDTopAppBar:
title: "Situation Map"
title: "Map"
anchor_title: "left"
elevation: 0
left_action_items:
Expand All @@ -1025,6 +1025,7 @@
['upload-lock', lambda x: root.app.telemetry_send_update(self)], # Send telemetry update
['layers', lambda x: root.app.map_layers_action(self)],
['wrench-cog', lambda x: root.app.map_settings_action(self)],
['crosshairs-gps', lambda x: root.app.map_own_location_action(self)],
['close', lambda x: root.app.close_any_action(self)],
]
Expand Down

0 comments on commit 5413db1

Please sign in to comment.