commit 3a35ab2574fc59d8385f0218569b741fab82482e
parent d9a67c6e5d0c7dcaa2e7324d4651ebed00670503
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 2 Aug 2019 12:06:06 +0200
Merge pull request #5534 from zebra-lucky/kivy_installwizard_back_button
gui/kivy: fix installwizard back button behaviour
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/electrum/gui/kivy/uix/dialogs/installwizard.py b/electrum/gui/kivy/uix/dialogs/installwizard.py
@@ -533,6 +533,7 @@ class WizardDialog(EventsDialog):
crcontent = ObjectProperty(None)
def __init__(self, wizard, **kwargs):
+ self.auto_dismiss = False
super(WizardDialog, self).__init__()
self.wizard = wizard
self.ids.back.disabled = not wizard.can_go_back()
@@ -540,7 +541,8 @@ class WizardDialog(EventsDialog):
self.run_next = kwargs['run_next']
_trigger_size_dialog = Clock.create_trigger(self._size_dialog)
Window.bind(size=_trigger_size_dialog,
- rotation=_trigger_size_dialog)
+ rotation=_trigger_size_dialog,
+ on_keyboard=self.on_keyboard)
_trigger_size_dialog()
self._on_release = False
@@ -562,6 +564,20 @@ class WizardDialog(EventsDialog):
else:
self.crcontent.add_widget(widget, index=index)
+ def on_keyboard(self, instance, key, keycode, codepoint, modifier):
+ if key == 27:
+ if self.wizard.can_go_back():
+ self.wizard.go_back()
+ else:
+ app = App.get_running_app()
+ if not app.is_exit:
+ app.is_exit = True
+ app.show_info(_('Press again to exit'))
+ else:
+ self._on_release = False
+ self.dismiss()
+ return True
+
def on_dismiss(self):
app = App.get_running_app()
if app.wallet is None and not self._on_release: