Refactored telemetry screen

This commit is contained in:
Mark Qvist 2023-10-29 10:43:34 +01:00
parent 93a0b5fb55
commit c39a87a5f3
4 changed files with 970 additions and 888 deletions

View file

@ -1001,590 +1001,6 @@ MDScreen:
id: map_layout
"""
layout_telemetry_screen = """
MDScreen:
name: "telemetry_screen"
BoxLayout:
orientation: "vertical"
MDTopAppBar:
title: "Telemetry"
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_any_action(self)],
]
ScrollView:
id: telemetry_scrollview
MDBoxLayout:
orientation: "vertical"
size_hint_y: None
height: self.minimum_height
padding: [dp(28), dp(48), dp(28), dp(16)]
MDLabel:
text: "Telemetry Over LXMF"
font_style: "H6"
MDLabel:
id: telemetry_info
markup: True
text: ""
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDLabel:
markup: True
text: "\\n\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDBoxLayout:
orientation: "vertical"
spacing: dp(24)
size_hint_y: None
padding: [dp(0),dp(24),dp(0),dp(0)]
height: dp(232)
MDRectangleFlatIconButton:
id: telemetry_send_update_button
icon: "upload-lock"
text: "Send Telemetry Update Now"
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_send_update(self)
disabled: True
MDRectangleFlatIconButton:
id: telemetry_request_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: True
MDRectangleFlatIconButton:
id: telemetry_copy_button
icon: "content-copy"
text: "Copy Telemetry Data To Clipboard"
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_copy(self)
disabled: False
MDRectangleFlatIconButton:
id: telemetry_own_button
icon: "database-eye-outline"
text: "Display Own Telemetry"
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.map_display_own_telemetry(self)
disabled: False
MDBoxLayout:
id: telemetry_enabled_fields
orientation: "vertical"
size_hint_y: None
height: self.minimum_height
padding: [0, dp(16), 0, dp(0)]
MDTextField:
id: telemetry_collector
max_text_length: 32
hint_text: "Telemetry Collector LXMF Address"
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
padding: [0,0,dp(24),0]
size_hint_y: None
height: dp(48)
MDLabel:
id: telemetry_enabled_label
text: "Enable Telemetry"
font_style: "H6"
MDSwitch:
id: telemetry_enabled
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Automatically send to collector"
font_style: "H6"
MDSwitch:
id: telemetry_send_to_collector
pos_hint: {"center_y": 0.3}
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:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Send to all trusted peers"
font_style: "H6"
MDSwitch:
id: telemetry_send_to_trusted
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Send display style to everyone"
font_style: "H6"
MDSwitch:
id: telemetry_send_appearance
pos_hint: {"center_y": 0.3}
active: False
MDLabel:
markup: True
text: "\\n\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDLabel:
text: "Display Options"
font_style: "H6"
MDLabel:
id: telemetry_info4
markup: True
text: "\\nYou can customise the display style of your telemetry data when viewed by others, by setting an icon and color options. This is usually used by clients to display your telemetry entry on a map or in lists and overviews. If left unset, the receiver will decide how to display the data.\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDBoxLayout:
orientation: "vertical"
size_hint_y: None
height: dp(112)
padding: [dp(0), dp(24), dp(0), dp(24)]
pos_hint: {"center_x": .5}
MDIconButton:
pos_hint: {"center_x": .5}
id: telemetry_icon_preview
icon: "account"
type: "large"
theme_icon_color: "Custom"
icon_color: [0, 0, 0, 1]
md_bg_color: [1, 1, 1, 1]
icon_size: dp(64)
size_hint_y: None
# width: dp(64)
height: dp(80)
on_release: root.app.icons_action(self)
MDRectangleFlatIconButton:
id: telemetry_icons_button
icon: "list-box-outline"
text: "Select From Available Icons"
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.icons_action(self)
disabled: False
MDBoxLayout:
orientation: "vertical"
size_hint_y: None
padding: [dp(0),dp(24),dp(0),dp(0)]
height: dp(74)
MDBoxLayout:
orientation: "horizontal"
#size_hint_y: None
spacing: dp(24)
# padding: [0,0,dp(24),dp(0)]
# height: dp(48)
MDRectangleFlatIconButton:
id: telemetry_icons_button
icon: "list-box-outline"
text: "Set Foreground Color"
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_fg_color(self)
disabled: False
MDRectangleFlatIconButton:
id: telemetry_icons_button
icon: "list-box-outline"
text: "Set Background Color"
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_bg_color(self)
disabled: False
MDLabel:
markup: True
text: "\\n\\n\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDLabel:
text: "Sensor Types"
font_style: "H6"
MDLabel:
id: telemetry_info3
markup: True
text: ""
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Location"
font_style: "H6"
MDSwitch:
id: telemetry_s_location
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Battery State"
font_style: "H6"
MDSwitch:
id: telemetry_s_battery
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Pressure"
font_style: "H6"
MDSwitch:
id: telemetry_s_barometer
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Temperature"
font_style: "H6"
MDSwitch:
id: telemetry_s_temperature
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Humidity"
font_style: "H6"
MDSwitch:
id: telemetry_s_humidity
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Magnetic Field"
font_style: "H6"
MDSwitch:
id: telemetry_s_compass
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Ambient Light"
font_style: "H6"
MDSwitch:
id: telemetry_s_light
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Gravity"
font_style: "H6"
MDSwitch:
id: telemetry_s_gravity
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Angular Velocity"
font_style: "H6"
MDSwitch:
id: telemetry_s_gyroscope
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Acceleration"
font_style: "H6"
MDSwitch:
id: telemetry_s_accelerometer
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Proximity"
font_style: "H6"
MDSwitch:
id: telemetry_s_proximity
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Information"
font_style: "H6"
MDSwitch:
id: telemetry_s_information
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
id: telemetry_information_fields
orientation: "horizontal"
size_hint_y: None
spacing: dp(16)
height: dp(64)
padding: [0, dp(0), 0, dp(0)]
MDTextField:
id: telemetry_s_information_text
size_hint: [1.0, None]
hint_text: "Custom information text"
max_text_length: 256
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Fixed Location"
font_style: "H6"
MDSwitch:
id: telemetry_s_fixed_location
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
id: telemetry_fixed_location_fields
orientation: "horizontal"
size_hint_y: None
spacing: dp(16)
height: dp(64)
padding: [0, dp(0), 0, dp(0)]
# md_bg_color: [1,0,0,1]
MDTextField:
id: telemetry_s_fixed_latlon
size_hint: [0.618, None]
hint_text: "Latitude, longtitude"
text: ""
font_size: dp(24)
MDTextField:
id: telemetry_s_fixed_altitude
size_hint: [0.382, None]
hint_text: "Altitude"
text: ""
font_size: dp(24)
MDLabel:
markup: True
text: "\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
"""
layout_icons_screen = """
MDScreen:
name: "icons_screen"
BoxLayout:
orientation: "vertical"
MDTopAppBar:
title: "Available Icons"
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_telemetry_action(self)],
]
MDBoxLayout:
orientation: 'vertical'
spacing: dp(10)
padding: dp(20)
MDBoxLayout:
adaptive_height: True
MDIconButton:
icon: 'magnify'
MDTextField:
id: icons_search_field
hint_text: 'Search icon'
on_text: root.app.icons_filter(self.text, True)
RecycleView:
id: icons_rv
key_viewclass: 'viewclass'
key_size: 'height'
RecycleBoxLayout:
padding: dp(10)
default_size: None, dp(48)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
"""
layout_keys_screen = """
MDScreen:
name: "keys_screen"