kivy: add delay to ActionButtons

This commit is contained in:
ThomasV 2015-12-16 12:40:30 +01:00
parent b3ef2249b5
commit f8f124ad84
2 changed files with 8 additions and 9 deletions

View File

@ -1,3 +1,4 @@
#:import Clock kivy.clock.Clock
#:import Window kivy.core.window.Window
#:import Factory kivy.factory.Factory
#:import _ electrum.i18n._
@ -354,8 +355,8 @@
<ActionOvrButton@ActionButton>
on_release:
if self.parent: self.parent.parent.dismiss()
Clock.schedule_once(lambda dt: self.parent.parent.dismiss() if self.parent else None, 0.05)
Clock.schedule_once(lambda dt: app.popup_dialog(self.name), 0.05)
<SettingsItem@ButtonBehavior+BoxLayout>
orientation: 'vertical'
@ -422,20 +423,15 @@ BoxLayout:
# when widget overflow drop down is shown, adjust the width
parent = args[1]
if parent: ao._dropdown.width = sp(200)
on_release: app.popup_dialog(self.name)
ActionOvrButton:
name: 'settings'
text: _('Settings')
on_release: app.settings_dialog()
ActionOvrButton:
name: 'wallets'
text: _('Wallets')
on_release: app.popup_dialog(self.name)
ActionOvrButton:
name: 'plugins'
text: _('Plugins')
on_release: app.popup_dialog(self.name)
ScreenManager:
id: manager
ScreenTabs:

View File

@ -409,8 +409,11 @@ class ElectrumWindow(App):
self.load_wallet(wallet)
def popup_dialog(self, name):
popup = Builder.load_file('gui/kivy/uix/ui_screens/'+name+'.kv')
popup.open()
if name == 'settings':
self.settings_dialog()
else:
popup = Builder.load_file('gui/kivy/uix/ui_screens/'+name+'.kv')
popup.open()