From 0ab9687734251353e7aa2812757a9d6dedc09ced Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 19 Apr 2021 18:36:59 +0200 Subject: [PATCH] kivy: make ActionDropdown disappear when an action is selected --- electrum/gui/kivy/uix/actiondropdown.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electrum/gui/kivy/uix/actiondropdown.py b/electrum/gui/kivy/uix/actiondropdown.py index 27d5fc93f..cf6cf1ea9 100644 --- a/electrum/gui/kivy/uix/actiondropdown.py +++ b/electrum/gui/kivy/uix/actiondropdown.py @@ -53,6 +53,11 @@ class ActionDropdown(Button): dropdown = DropDown() self.text = self.dropdown_text self._on_release = dropdown.open + def on_btn(option_func): + def _on_btn(btn): + dropdown.dismiss() + option_func(btn) + return _on_btn for option in options: if option.enabled: btn = Button( @@ -62,7 +67,7 @@ class ActionDropdown(Button): halign='center', valign='center', ) - btn.bind(on_release=option.func) + btn.bind(on_release=on_btn(option.func)) dropdown.add_widget(btn) def on_release(self):