Skip to content

Commit

Permalink
Make dialog disappear as soon as leaving animation is started
Browse files Browse the repository at this point in the history
  • Loading branch information
Staartvin committed Apr 2, 2023
1 parent 355ee98 commit 623b4b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion kvs/ProductScreen.kv
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 6 additions & 7 deletions scrs/ProductScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 623b4b2

Please sign in to comment.