From 623b4b251b4caa5909ca43f57389aa385e2541b9 Mon Sep 17 00:00:00 2001 From: Vincent Bolta Date: Sun, 2 Apr 2023 16:48:48 +0200 Subject: [PATCH] Make dialog disappear as soon as leaving animation is started --- kvs/ProductScreen.kv | 1 - scrs/ProductScreen.py | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/kvs/ProductScreen.kv b/kvs/ProductScreen.kv index d96d3f4..ef11592 100644 --- a/kvs/ProductScreen.kv +++ b/kvs/ProductScreen.kv @@ -14,7 +14,6 @@ id: android_tabs tab_bar_height: '50dp' lock_swiping: True -# anim_duration: 0.0 text_color_normal: (0,0,0,1) text_color_active: (1,1,1,1) color_indicator: (0,0,0,1) diff --git a/scrs/ProductScreen.py b/scrs/ProductScreen.py index 89f2257..94f4ab2 100644 --- a/scrs/ProductScreen.py +++ b/scrs/ProductScreen.py @@ -193,7 +193,7 @@ def on_timeout(self, dt): # # upon leaving the screen, cancel the timeout event # - def on_leave(self, *args): + def on_pre_leave(self, *args): self.timeout_event.cancel() if self.final_dialog is not None: @@ -271,11 +271,7 @@ def on_cancel_payment(self, dt): def on_confirm_payment(self, dt=None): Logger.info(f"StellaPayUI: Payment was confirmed by the user.") - spinner = MDSpinner( - size_hint=(None, None), - size=(dp(32), dp(32)), - active=True - ) + spinner = MDSpinner(size_hint=(None, None), size=(dp(32), dp(32)), active=True) # Show a spinner when user confirms the payment and hide the other buttons self.shopping_cart_dialog.ids.button_box.add_widget(spinner) @@ -310,7 +306,10 @@ def update_ui_after_payment(self, transaction_successful: bool): def show_thanks_dialog(self): self.timeout_event.cancel() - self.final_dialog = MDDialog(text="Gelukt! Je aankoop is geregistreerd!", on_dismiss=self.on_thanks) + self.final_dialog = MDDialog( + text="Gelukt! Je aankoop is geregistreerd!", + on_dismiss=self.on_thanks, + ) self.timeout_event = Clock.schedule_once(self.on_thanks, 5) self.final_dialog.open()