Don't enable keyboard shortcuts until start is complete

This commit is contained in:
Mark Qvist 2023-10-31 22:28:17 +01:00
parent 5398afcefe
commit 5f74ac590c
1 changed files with 122 additions and 118 deletions

View File

@ -168,6 +168,7 @@ class SidebandApp(MDApp):
self.android_service = None self.android_service = None
self.app_dir = plyer.storagepath.get_application_dir() self.app_dir = plyer.storagepath.get_application_dir()
self.shaders_disabled = __disable_shaders__ self.shaders_disabled = __disable_shaders__
self.keyboard_enabled = False
self.no_transition = NoTransition() self.no_transition = NoTransition()
self.slide_transition = SlideTransition() self.slide_transition = SlideTransition()
@ -289,7 +290,7 @@ class SidebandApp(MDApp):
self.guide_action() self.guide_action()
def fp(delta_time): def fp(delta_time):
self.request_permissions() self.request_permissions()
Clock.schedule_once(fp, 3) Clock.schedule_once(fp, 5)
else: else:
self.open_conversations() self.open_conversations()
@ -301,6 +302,7 @@ class SidebandApp(MDApp):
self.app_state = SidebandApp.ACTIVE self.app_state = SidebandApp.ACTIVE
self.loading_updater.cancel() self.loading_updater.cancel()
self.final_load_completed = True self.final_load_completed = True
self.keyboard_enabled = True
def check_errors(dt): def check_errors(dt):
if self.sideband.getpersistent("startup.errors.rnode") != None: if self.sideband.getpersistent("startup.errors.rnode") != None:
@ -769,6 +771,7 @@ class SidebandApp(MDApp):
Clock.schedule_once(self.start_core, 0.25) Clock.schedule_once(self.start_core, 0.25)
def keydown_event(self, instance, keyboard, keycode, text, modifiers): def keydown_event(self, instance, keyboard, keycode, text, modifiers):
if self.keyboard_enabled:
if self.root.ids.screen_manager.current == "map_screen": if self.root.ids.screen_manager.current == "map_screen":
if not (len(modifiers) > 0 and "ctrl" in modifiers): if not (len(modifiers) > 0 and "ctrl" in modifiers):
if len(modifiers) > 0 and "shift" in modifiers: if len(modifiers) > 0 and "shift" in modifiers:
@ -872,6 +875,7 @@ class SidebandApp(MDApp):
self.new_conversation_action(self) self.new_conversation_action(self)
def keyboard_event(self, window, key, *largs): def keyboard_event(self, window, key, *largs):
if self.keyboard_enabled:
# Handle escape/back # Handle escape/back
if key == 27: if key == 27:
if self.root.ids.screen_manager.current == "conversations_screen": if self.root.ids.screen_manager.current == "conversations_screen":