kivy: use Clock to improve button responsiveness
This commit is contained in:
@@ -6,6 +6,7 @@ from kivy.animation import Animation
|
||||
from kivy.uix.floatlayout import FloatLayout
|
||||
from kivy.lang import Builder
|
||||
from kivy.factory import Factory
|
||||
from kivy.clock import Clock
|
||||
|
||||
Builder.load_string('''
|
||||
<MenuItem@Button>
|
||||
@@ -33,6 +34,7 @@ class MenuItem(Factory.Button):
|
||||
pass
|
||||
|
||||
class ContextMenu(Bubble):
|
||||
|
||||
def __init__(self, obj, action_list):
|
||||
Bubble.__init__(self)
|
||||
self.obj = obj
|
||||
@@ -40,7 +42,11 @@ class ContextMenu(Bubble):
|
||||
l = MenuItem()
|
||||
l.text = k
|
||||
def func(f=v):
|
||||
f(obj)
|
||||
if self.parent: self.parent.hide_menu()
|
||||
Clock.schedule_once(lambda dt: self.hide(), 0.1)
|
||||
Clock.schedule_once(lambda dt: f(obj), 0.15)
|
||||
l.on_release = func
|
||||
self.ids.buttons.add_widget(l)
|
||||
|
||||
def hide(self):
|
||||
if self.parent:
|
||||
self.parent.hide_menu()
|
||||
|
||||
@@ -225,6 +225,9 @@ class SendScreen(CScreen):
|
||||
self.screen.address = ''
|
||||
self.payment_request = None
|
||||
|
||||
def amount_dialog(self):
|
||||
Clock.schedule_once(lambda dt: self.app.amount_dialog(self, True), .25)
|
||||
|
||||
def set_request(self, pr):
|
||||
self.payment_request = pr
|
||||
self.screen.address = pr.get_requestor()
|
||||
|
||||
@@ -53,7 +53,7 @@ SendScreen:
|
||||
id: amount_e
|
||||
default_text: _('Amount')
|
||||
text: s.amount if s.amount else _('Amount')
|
||||
on_release: app.amount_dialog(s, True)
|
||||
on_release: s.amount_dialog()
|
||||
CardSeparator:
|
||||
opacity: message_selection.opacity
|
||||
color: blue_bottom.foreground_color
|
||||
|
||||
Reference in New Issue
Block a user