From d2c26a306e802e632422398f0ba022cc0a236c53 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 12 Oct 2022 16:33:05 +0200 Subject: [PATCH] Tuned UI behaviour --- sbapp/main.py | 14 ++++++++++---- sbapp/ui/conversations.py | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sbapp/main.py b/sbapp/main.py index 44ca7e2..6dffa49 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -122,7 +122,7 @@ class SidebandApp(MDApp): self.loading_updater.cancel() def start_core(self, dt): - self.loading_updater = Clock.schedule_interval(self.update_init_status, 0.3) + self.loading_updater = Clock.schedule_interval(self.update_init_status, 0.1) self.check_permissions() self.start_service() @@ -242,7 +242,8 @@ class SidebandApp(MDApp): self.sideband.should_persist_data() if self.conversations_view != None: self.root.ids.conversations_scrollview.effect_cls = ScrollEffect - self.conversations_view.update() + # TODO: Check if we actually need this + self.sideband.setstate("wants.viewupdate.conversations", True) self.root.ids.conversations_scrollview.scroll = 1 RNS.log("App paused", RNS.LOG_DEBUG) @@ -256,7 +257,8 @@ class SidebandApp(MDApp): self.app_state = SidebandApp.ACTIVE if self.conversations_view != None: self.root.ids.conversations_scrollview.effect_cls = ScrollEffect - self.conversations_view.update() + # TODO: Check if we actually need this + # self.sideband.setstate("wants.viewupdate.conversations", True) self.root.ids.conversations_scrollview.scroll = 1 else: @@ -351,6 +353,10 @@ class SidebandApp(MDApp): if self.conversations_view != None: self.conversations_view.update() + if self.sideband.getstate("wants.viewupdate.conversations"): + if self.conversations_view != None: + self.conversations_view.update() + def on_start(self): self.last_exit_event = time.time() self.root.ids.screen_manager.transition.duration = 0.25 @@ -464,7 +470,7 @@ class SidebandApp(MDApp): MDApp.get_running_app().stop() Window.close() - Clock.schedule_once(final_exit, 0.5) + Clock.schedule_once(final_exit, 0.65) def announce_now_action(self, sender=None): self.sideband.lxmf_announce() diff --git a/sbapp/ui/conversations.py b/sbapp/ui/conversations.py index 56e74a6..27bf00b 100644 --- a/sbapp/ui/conversations.py +++ b/sbapp/ui/conversations.py @@ -58,6 +58,7 @@ class Conversations(): self.app.sideband.setstate("app.flags.unread_conversations", False) self.app.sideband.setstate("app.flags.new_conversations", False) + self.app.sideband.setstate("wants.viewupdate.conversations", False) def update_widget(self): us = time.time()