Browse Source
kivy: make ActionDropdown disappear when an action is selected
patch-4
SomberNight
4 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
6 additions and
1 deletions
-
electrum/gui/kivy/uix/actiondropdown.py
|
@ -53,6 +53,11 @@ class ActionDropdown(Button): |
|
|
dropdown = DropDown() |
|
|
dropdown = DropDown() |
|
|
self.text = self.dropdown_text |
|
|
self.text = self.dropdown_text |
|
|
self._on_release = dropdown.open |
|
|
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: |
|
|
for option in options: |
|
|
if option.enabled: |
|
|
if option.enabled: |
|
|
btn = Button( |
|
|
btn = Button( |
|
@ -62,7 +67,7 @@ class ActionDropdown(Button): |
|
|
halign='center', |
|
|
halign='center', |
|
|
valign='center', |
|
|
valign='center', |
|
|
) |
|
|
) |
|
|
btn.bind(on_release=option.func) |
|
|
btn.bind(on_release=on_btn(option.func)) |
|
|
dropdown.add_widget(btn) |
|
|
dropdown.add_widget(btn) |
|
|
|
|
|
|
|
|
def on_release(self): |
|
|
def on_release(self): |
|
|