mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-25 14:50:37 +01:00
Trusted-only display mode, object view skeleton
This commit is contained in:
parent
77b6509059
commit
1aa2131d17
@ -53,6 +53,7 @@ if RNS.vendor.platformutils.get_platform() == "android":
|
|||||||
|
|
||||||
from ui.layouts import *
|
from ui.layouts import *
|
||||||
from ui.conversations import Conversations, MsgSync, NewConv
|
from ui.conversations import Conversations, MsgSync, NewConv
|
||||||
|
from ui.objectdetails import ObjectDetails
|
||||||
from ui.announces import Announces
|
from ui.announces import Announces
|
||||||
from ui.messages import Messages, ts_format, messages_screen_kv
|
from ui.messages import Messages, ts_format, messages_screen_kv
|
||||||
from ui.helpers import ContentNavigationDrawer, DrawerList, IconListItem
|
from ui.helpers import ContentNavigationDrawer, DrawerList, IconListItem
|
||||||
@ -71,6 +72,7 @@ else:
|
|||||||
from .ui.layouts import *
|
from .ui.layouts import *
|
||||||
from .ui.conversations import Conversations, MsgSync, NewConv
|
from .ui.conversations import Conversations, MsgSync, NewConv
|
||||||
from .ui.announces import Announces
|
from .ui.announces import Announces
|
||||||
|
from .ui.objectdetails import ObjectDetails
|
||||||
from .ui.messages import Messages, ts_format, messages_screen_kv
|
from .ui.messages import Messages, ts_format, messages_screen_kv
|
||||||
from .ui.helpers import ContentNavigationDrawer, DrawerList, IconListItem
|
from .ui.helpers import ContentNavigationDrawer, DrawerList, IconListItem
|
||||||
|
|
||||||
@ -119,6 +121,7 @@ class SidebandApp(MDApp):
|
|||||||
self.conversations_view = None
|
self.conversations_view = None
|
||||||
self.messages_view = None
|
self.messages_view = None
|
||||||
self.map_screen = None
|
self.map_screen = None
|
||||||
|
self.object_details_screen = None
|
||||||
self.sync_dialog = None
|
self.sync_dialog = None
|
||||||
self.settings_ready = False
|
self.settings_ready = False
|
||||||
self.telemetry_ready = False
|
self.telemetry_ready = False
|
||||||
@ -1398,7 +1401,8 @@ class SidebandApp(MDApp):
|
|||||||
self.settings_screen.ids.settings_display_name.bind(focus=save_disp_name)
|
self.settings_screen.ids.settings_display_name.bind(focus=save_disp_name)
|
||||||
|
|
||||||
if RNS.vendor.platformutils.is_android():
|
if RNS.vendor.platformutils.is_android():
|
||||||
self.widget_hide(self.settings_screen.ids.settings_print_command, True)
|
pass
|
||||||
|
# self.widget_hide(self.settings_screen.ids.settings_print_command, True)
|
||||||
else:
|
else:
|
||||||
self.settings_screen.ids.settings_print_command.text = self.sideband.config["print_command"]
|
self.settings_screen.ids.settings_print_command.text = self.sideband.config["print_command"]
|
||||||
self.settings_screen.ids.settings_print_command.bind(focus=save_print_command)
|
self.settings_screen.ids.settings_print_command.bind(focus=save_print_command)
|
||||||
@ -2922,6 +2926,9 @@ class SidebandApp(MDApp):
|
|||||||
self.telemetry_screen.ids.telemetry_send_to_trusted.active = self.sideband.config["telemetry_send_to_trusted"]
|
self.telemetry_screen.ids.telemetry_send_to_trusted.active = self.sideband.config["telemetry_send_to_trusted"]
|
||||||
self.telemetry_screen.ids.telemetry_send_to_trusted.bind(active=self.telemetry_save)
|
self.telemetry_screen.ids.telemetry_send_to_trusted.bind(active=self.telemetry_save)
|
||||||
|
|
||||||
|
self.telemetry_screen.ids.telemetry_display_trusted_only.active = self.sideband.config["telemetry_display_trusted_only"]
|
||||||
|
self.telemetry_screen.ids.telemetry_display_trusted_only.bind(active=self.telemetry_save)
|
||||||
|
|
||||||
self.telemetry_screen.ids.telemetry_send_appearance.active = self.sideband.config["telemetry_send_appearance"]
|
self.telemetry_screen.ids.telemetry_send_appearance.active = self.sideband.config["telemetry_send_appearance"]
|
||||||
self.telemetry_screen.ids.telemetry_send_appearance.bind(active=self.telemetry_save)
|
self.telemetry_screen.ids.telemetry_send_appearance.bind(active=self.telemetry_save)
|
||||||
|
|
||||||
@ -3001,6 +3008,7 @@ class SidebandApp(MDApp):
|
|||||||
self.sideband.config["telemetry_enabled"] = self.telemetry_screen.ids.telemetry_enabled.active
|
self.sideband.config["telemetry_enabled"] = self.telemetry_screen.ids.telemetry_enabled.active
|
||||||
self.sideband.config["telemetry_send_to_collector"] = self.telemetry_screen.ids.telemetry_send_to_collector.active
|
self.sideband.config["telemetry_send_to_collector"] = self.telemetry_screen.ids.telemetry_send_to_collector.active
|
||||||
self.sideband.config["telemetry_send_to_trusted"] = self.telemetry_screen.ids.telemetry_send_to_trusted.active
|
self.sideband.config["telemetry_send_to_trusted"] = self.telemetry_screen.ids.telemetry_send_to_trusted.active
|
||||||
|
self.sideband.config["telemetry_display_trusted_only"] = self.telemetry_screen.ids.telemetry_display_trusted_only.active
|
||||||
self.sideband.config["telemetry_send_appearance"] = self.telemetry_screen.ids.telemetry_send_appearance.active
|
self.sideband.config["telemetry_send_appearance"] = self.telemetry_screen.ids.telemetry_send_appearance.active
|
||||||
|
|
||||||
self.sideband.config["telemetry_s_location"] = self.telemetry_screen.ids.telemetry_s_location.active
|
self.sideband.config["telemetry_s_location"] = self.telemetry_screen.ids.telemetry_s_location.active
|
||||||
@ -3016,6 +3024,7 @@ class SidebandApp(MDApp):
|
|||||||
self.sideband.config["telemetry_s_proximity"] = self.telemetry_screen.ids.telemetry_s_proximity.active
|
self.sideband.config["telemetry_s_proximity"] = self.telemetry_screen.ids.telemetry_s_proximity.active
|
||||||
|
|
||||||
self.sideband.save_configuration()
|
self.sideband.save_configuration()
|
||||||
|
self.sideband.setstate("app.flags.last_telemetry", time.time())
|
||||||
|
|
||||||
def telemetry_action(self, sender=None, direction="left"):
|
def telemetry_action(self, sender=None, direction="left"):
|
||||||
self.telemetry_init()
|
self.telemetry_init()
|
||||||
@ -3041,7 +3050,11 @@ class SidebandApp(MDApp):
|
|||||||
|
|
||||||
def telemetry_send_update(self, sender=None):
|
def telemetry_send_update(self, sender=None):
|
||||||
# TODO: Implement
|
# TODO: Implement
|
||||||
Clipboard.copy(str(self.sideband.get_packed_telemetry()))
|
pass
|
||||||
|
|
||||||
|
def telemetry_request_action(self, sender=None):
|
||||||
|
# TODO: Implement
|
||||||
|
pass
|
||||||
|
|
||||||
def telemetry_fg_color(self, sender=None):
|
def telemetry_fg_color(self, sender=None):
|
||||||
color_picker = MDColorPicker(size_hint=(0.85, 0.85))
|
color_picker = MDColorPicker(size_hint=(0.85, 0.85))
|
||||||
@ -3138,7 +3151,7 @@ class SidebandApp(MDApp):
|
|||||||
### Map Screen
|
### Map Screen
|
||||||
######################################
|
######################################
|
||||||
|
|
||||||
def map_action(self, sender=None):
|
def map_action(self, sender=None, direction="left"):
|
||||||
if not self.root.ids.screen_manager.has_screen("map_screen"):
|
if not self.root.ids.screen_manager.has_screen("map_screen"):
|
||||||
self.map_screen = Builder.load_string(layout_map_screen)
|
self.map_screen = Builder.load_string(layout_map_screen)
|
||||||
self.map_screen.app = self
|
self.map_screen.app = self
|
||||||
@ -3151,7 +3164,7 @@ class SidebandApp(MDApp):
|
|||||||
self.map_screen.ids.map_layout.map = mapview
|
self.map_screen.ids.map_layout.map = mapview
|
||||||
self.map_screen.ids.map_layout.add_widget(self.map_screen.ids.map_layout.map)
|
self.map_screen.ids.map_layout.add_widget(self.map_screen.ids.map_layout.map)
|
||||||
|
|
||||||
self.root.ids.screen_manager.transition.direction = "left"
|
self.root.ids.screen_manager.transition.direction = direction
|
||||||
self.root.ids.screen_manager.current = "map_screen"
|
self.root.ids.screen_manager.current = "map_screen"
|
||||||
self.root.ids.nav_drawer.set_state("closed")
|
self.root.ids.nav_drawer.set_state("closed")
|
||||||
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
||||||
@ -3192,6 +3205,23 @@ class SidebandApp(MDApp):
|
|||||||
self.map_action()
|
self.map_action()
|
||||||
self.map_show(location)
|
self.map_show(location)
|
||||||
|
|
||||||
|
def map_display_telemetry(self, sender):
|
||||||
|
RNS.log("Display telemetry from "+str(sender), RNS.LOG_WARNING)
|
||||||
|
self.object_details_action()
|
||||||
|
|
||||||
|
def close_sub_map_action(self, sender=None):
|
||||||
|
self.map_action(direction="right")
|
||||||
|
|
||||||
|
def object_details_action(self, sender=None):
|
||||||
|
self.root.ids.screen_manager.transition.direction = "left"
|
||||||
|
self.root.ids.nav_drawer.set_state("closed")
|
||||||
|
|
||||||
|
if self.object_details_screen == None:
|
||||||
|
self.object_details_screen = ObjectDetails(self)
|
||||||
|
|
||||||
|
self.root.ids.screen_manager.current = "object_details_screen"
|
||||||
|
self.sideband.setstate("app.displaying", self.root.ids.screen_manager.current)
|
||||||
|
|
||||||
def map_create_marker(self, source, telemetry, appearance):
|
def map_create_marker(self, source, telemetry, appearance):
|
||||||
try:
|
try:
|
||||||
l = telemetry["location"]
|
l = telemetry["location"]
|
||||||
@ -3204,6 +3234,7 @@ class SidebandApp(MDApp):
|
|||||||
icon=a_icon, icon_color=a_fg,
|
icon=a_icon, icon_color=a_fg,
|
||||||
md_bg_color=a_bg, theme_icon_color="Custom",
|
md_bg_color=a_bg, theme_icon_color="Custom",
|
||||||
icon_size=dp(32),
|
icon_size=dp(32),
|
||||||
|
on_release=self.map_display_telemetry,
|
||||||
)
|
)
|
||||||
marker.icon._default_icon_pad = dp(16)
|
marker.icon._default_icon_pad = dp(16)
|
||||||
marker.add_widget(marker.icon)
|
marker.add_widget(marker.icon)
|
||||||
@ -3240,6 +3271,20 @@ class SidebandApp(MDApp):
|
|||||||
self.sideband.config["telemetry_bg"]
|
self.sideband.config["telemetry_bg"]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
skip_entries = []
|
||||||
|
if self.sideband.config["telemetry_display_trusted_only"]:
|
||||||
|
for telemetry_source in telemetry_entries:
|
||||||
|
try:
|
||||||
|
if not self.sideband.is_trusted(telemetry_source):
|
||||||
|
skip_entries.append(telemetry_source)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
for skip_entry in skip_entries:
|
||||||
|
try:
|
||||||
|
telemetry_entries.pop(skip_entry)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if own_telemetry != None and "location" in own_telemetry and own_telemetry["location"] != None and own_telemetry["location"]["latitude"] != None and own_telemetry["location"]["longtitude"] != None:
|
if own_telemetry != None and "location" in own_telemetry and own_telemetry["location"] != None and own_telemetry["location"]["latitude"] != None and own_telemetry["location"]["longtitude"] != None:
|
||||||
retain_own = True
|
retain_own = True
|
||||||
|
@ -51,6 +51,7 @@ Builder.load_string(
|
|||||||
source: root.source
|
source: root.source
|
||||||
size: list(map(dp, self.texture_size))
|
size: list(map(dp, self.texture_size))
|
||||||
allow_stretch: True
|
allow_stretch: True
|
||||||
|
on_release: root.app.map_display_telemetry()
|
||||||
|
|
||||||
<MapView>:
|
<MapView>:
|
||||||
canvas.before:
|
canvas.before:
|
||||||
|
@ -495,6 +495,8 @@ class SidebandCore():
|
|||||||
self.config["telemetry_s_acceleration"] = False
|
self.config["telemetry_s_acceleration"] = False
|
||||||
if not "telemetry_s_proximity" in self.config:
|
if not "telemetry_s_proximity" in self.config:
|
||||||
self.config["telemetry_s_proximity"] = False
|
self.config["telemetry_s_proximity"] = False
|
||||||
|
if not "telemetry_display_trusted_only" in self.config:
|
||||||
|
self.config["telemetry_display_trusted_only"] = False
|
||||||
|
|
||||||
if not "map_history_limit" in self.config:
|
if not "map_history_limit" in self.config:
|
||||||
self.config["map_history_limit"] = 7*24*60*60
|
self.config["map_history_limit"] = 7*24*60*60
|
||||||
|
@ -866,6 +866,8 @@ MDScreen:
|
|||||||
[['menu', lambda x: root.app.nav_drawer.set_state("open")]]
|
[['menu', lambda x: root.app.nav_drawer.set_state("open")]]
|
||||||
right_action_items:
|
right_action_items:
|
||||||
[
|
[
|
||||||
|
['arrow-down-bold-hexagon-outline', lambda x: root.app.telemetry_request_action(self)],
|
||||||
|
['upload-lock', lambda x: root.app.telemetry_send_update(self)],
|
||||||
['close', lambda x: root.app.close_any_action(self)],
|
['close', lambda x: root.app.close_any_action(self)],
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -924,11 +926,11 @@ MDScreen:
|
|||||||
spacing: dp(24)
|
spacing: dp(24)
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
padding: [dp(0),dp(24),dp(0),dp(0)]
|
padding: [dp(0),dp(24),dp(0),dp(0)]
|
||||||
height: dp(74)
|
height: dp(160)
|
||||||
|
|
||||||
MDRectangleFlatIconButton:
|
MDRectangleFlatIconButton:
|
||||||
id: telemetry_icons_button
|
id: telemetry_icons_button
|
||||||
icon: "update"
|
icon: "upload-lock"
|
||||||
text: "Send Telemetry Update Now"
|
text: "Send Telemetry Update Now"
|
||||||
padding: [dp(0), dp(14), dp(0), dp(14)]
|
padding: [dp(0), dp(14), dp(0), dp(14)]
|
||||||
icon_size: dp(24)
|
icon_size: dp(24)
|
||||||
@ -937,6 +939,17 @@ MDScreen:
|
|||||||
on_release: root.app.telemetry_send_update(self)
|
on_release: root.app.telemetry_send_update(self)
|
||||||
disabled: False
|
disabled: False
|
||||||
|
|
||||||
|
MDRectangleFlatIconButton:
|
||||||
|
id: telemetry_icons_button
|
||||||
|
icon: "arrow-down-bold-hexagon-outline"
|
||||||
|
text: "Request Telemetry From Collector"
|
||||||
|
padding: [dp(0), dp(14), dp(0), dp(14)]
|
||||||
|
icon_size: dp(24)
|
||||||
|
font_size: dp(16)
|
||||||
|
size_hint: [1.0, None]
|
||||||
|
on_release: root.app.telemetry_request_action(self)
|
||||||
|
disabled: False
|
||||||
|
|
||||||
MDRectangleFlatIconButton:
|
MDRectangleFlatIconButton:
|
||||||
id: telemetry_icons_button
|
id: telemetry_icons_button
|
||||||
icon: "content-copy"
|
icon: "content-copy"
|
||||||
@ -993,6 +1006,21 @@ MDScreen:
|
|||||||
pos_hint: {"center_y": 0.3}
|
pos_hint: {"center_y": 0.3}
|
||||||
active: False
|
active: False
|
||||||
|
|
||||||
|
MDBoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
size_hint_y: None
|
||||||
|
padding: [0,0,dp(24),dp(0)]
|
||||||
|
height: dp(48)
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
text: "Only display from trusted"
|
||||||
|
font_style: "H6"
|
||||||
|
|
||||||
|
MDSwitch:
|
||||||
|
id: telemetry_display_trusted_only
|
||||||
|
pos_hint: {"center_y": 0.3}
|
||||||
|
active: False
|
||||||
|
|
||||||
MDBoxLayout:
|
MDBoxLayout:
|
||||||
orientation: "horizontal"
|
orientation: "horizontal"
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
|
@ -2,7 +2,6 @@ import time
|
|||||||
import RNS
|
import RNS
|
||||||
|
|
||||||
from kivy.metrics import dp,sp
|
from kivy.metrics import dp,sp
|
||||||
from kivy.uix.label import MDLabel
|
|
||||||
from kivy.lang.builder import Builder
|
from kivy.lang.builder import Builder
|
||||||
|
|
||||||
if RNS.vendor.platformutils.get_platform() == "android":
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
@ -16,6 +15,12 @@ class ObjectDetails():
|
|||||||
self.widget = None
|
self.widget = None
|
||||||
self.object_hash = object_hash
|
self.object_hash = object_hash
|
||||||
|
|
||||||
|
if not self.app.root.ids.screen_manager.has_screen("object_details_screen"):
|
||||||
|
self.screen = Builder.load_string(layou_object_details)
|
||||||
|
self.screen.app = self.app
|
||||||
|
self.ids = self.screen.ids
|
||||||
|
self.app.root.ids.screen_manager.add_widget(self.screen)
|
||||||
|
|
||||||
def reload(self):
|
def reload(self):
|
||||||
self.clear_widget()
|
self.clear_widget()
|
||||||
self.update()
|
self.update()
|
||||||
@ -35,6 +40,44 @@ class ObjectDetails():
|
|||||||
def get_widget(self):
|
def get_widget(self):
|
||||||
return self.widget
|
return self.widget
|
||||||
|
|
||||||
Builder.load_string("""
|
layou_object_details = """
|
||||||
|
MDScreen:
|
||||||
|
name: "object_details_screen"
|
||||||
|
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "vertical"
|
||||||
|
|
||||||
""")
|
MDTopAppBar:
|
||||||
|
title: "Details"
|
||||||
|
anchor_title: "left"
|
||||||
|
elevation: 0
|
||||||
|
left_action_items:
|
||||||
|
[['menu', lambda x: root.app.nav_drawer.set_state("open")]]
|
||||||
|
right_action_items:
|
||||||
|
[
|
||||||
|
['close', lambda x: root.app.close_sub_map_action(self)],
|
||||||
|
]
|
||||||
|
|
||||||
|
ScrollView:
|
||||||
|
id: object_details_scrollview
|
||||||
|
|
||||||
|
MDBoxLayout:
|
||||||
|
orientation: "vertical"
|
||||||
|
spacing: dp(48)
|
||||||
|
size_hint_y: None
|
||||||
|
height: self.minimum_height
|
||||||
|
padding: [dp(28), dp(48), dp(28), dp(16)]
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
id: name_label
|
||||||
|
markup: True
|
||||||
|
text: "Object Name"
|
||||||
|
font_style: "H6"
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
id: test_label
|
||||||
|
markup: True
|
||||||
|
text: "Test"
|
||||||
|
font_style: "H6"
|
||||||
|
|
||||||
|
"""
|
Loading…
Reference in New Issue
Block a user