mirror of
https://github.com/markqvist/Sideband.git
synced 2025-08-03 20:14:24 -04:00
Added lazy-loader for complex views
This commit is contained in:
parent
d870585178
commit
ef7dd1e2f2
3 changed files with 528 additions and 135 deletions
|
@ -9,7 +9,6 @@ MDNavigationLayout:
|
|||
ScreenManager:
|
||||
id: screen_manager
|
||||
transition: SlideTransition()
|
||||
# transition: NoTransition()
|
||||
|
||||
MDScreen:
|
||||
name: "starting_screen"
|
||||
|
@ -241,6 +240,39 @@ MDScreen:
|
|||
font_size: "32dp"
|
||||
"""
|
||||
|
||||
layout_loader_screen = """
|
||||
MDScreen:
|
||||
name: "loader_screen"
|
||||
|
||||
BoxLayout:
|
||||
orientation: "vertical"
|
||||
|
||||
MDTopAppBar:
|
||||
title: ""
|
||||
anchor_title: "left"
|
||||
elevation: 0
|
||||
left_action_items:
|
||||
[['menu', None ]]
|
||||
right_action_items:
|
||||
[
|
||||
]
|
||||
|
||||
AnchorLayout:
|
||||
padding: [dp(0), dp(72), dp(0), dp(0)]
|
||||
anchor_x: "center"
|
||||
anchor_y: "center"
|
||||
|
||||
BoxLayout:
|
||||
spacing: dp(36)
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
|
||||
MDIconButton:
|
||||
pos_hint: {"center_x": .5, "center_y": .5}
|
||||
icon: "dots-horizontal"
|
||||
icon_size: "64dp"
|
||||
"""
|
||||
|
||||
layout_connectivity_screen = """
|
||||
MDScreen:
|
||||
name: "connectivity_screen"
|
||||
|
|
|
@ -366,13 +366,32 @@ class Telemetry():
|
|||
self.sensors_screen.ids.telemetry_s_information_text.text = str(self.app.sideband.config["telemetry_s_information_text"])
|
||||
self.sensors_screen.ids.telemetry_s_information_text.bind(focus=self.sensors_save)
|
||||
|
||||
def sensors_action(self, sender=None):
|
||||
self.sensors_init()
|
||||
self.app.root.ids.screen_manager.transition.direction = "left"
|
||||
def sensors_open(self, sender=None, direction="left", no_transition=False):
|
||||
if no_transition:
|
||||
self.app.root.ids.screen_manager.transition = self.app.no_transition
|
||||
else:
|
||||
self.app.root.ids.screen_manager.transition = self.app.slide_transition
|
||||
self.app.root.ids.screen_manager.transition.direction = direction
|
||||
|
||||
self.app.root.ids.screen_manager.current = "sensors_screen"
|
||||
self.app.root.ids.nav_drawer.set_state("closed")
|
||||
self.app.sideband.setstate("app.displaying", self.app.root.ids.screen_manager.current)
|
||||
|
||||
if no_transition:
|
||||
self.app.root.ids.screen_manager.transition = self.app.slide_transition
|
||||
|
||||
def sensors_action(self, sender=None):
|
||||
if self.app.root.ids.screen_manager.has_screen("sensors_screen"):
|
||||
self.sensors_open()
|
||||
else:
|
||||
self.app.loader_action()
|
||||
def final(dt):
|
||||
self.sensors_init()
|
||||
def o(dt):
|
||||
self.sensors_open(no_transition=True)
|
||||
Clock.schedule_once(o, 0.45)
|
||||
Clock.schedule_once(final, 0.275)
|
||||
|
||||
def telemetry_location_toggle(self, sender=None, event=None):
|
||||
if sender == self.sensors_screen.ids.telemetry_s_location:
|
||||
if self.sensors_screen.ids.telemetry_s_location.active:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue