From 587ca5dd42e832db277e0a3d754ad98e71cfbefa Mon Sep 17 00:00:00 2001 From: ThomasV Date: Tue, 15 Dec 2020 15:51:06 +0100 Subject: [PATCH] kivy: initialize app.android_backups from config, and show error message if save_backup raises an exception --- electrum/gui/kivy/main_window.py | 8 +++++++- electrum/gui/kivy/uix/ui_screens/status.kv | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py index a0368fa3d..9f36cc01f 100644 --- a/electrum/gui/kivy/main_window.py +++ b/electrum/gui/kivy/main_window.py @@ -381,6 +381,7 @@ class ElectrumWindow(App, Logger): self.daemon = self.gui_object.daemon self.fx = self.daemon.fx self.use_rbf = config.get('use_rbf', True) + self.android_backups = config.get('android_backups', False) self.use_unconfirmed = not config.get('confirmed_only', False) # create triggers so as to minimize updating a max of 2 times a sec @@ -1244,7 +1245,12 @@ class ElectrumWindow(App, Logger): request_permissions([Permission.WRITE_EXTERNAL_STORAGE], cb) def _save_backup(self): - new_path = self.wallet.save_backup() + try: + new_path = self.wallet.save_backup() + except Exception as e: + self.logger.exception("Failed to save wallet backup") + self.show_error("Failed to save wallet backup" + '\n' + str(e)) + return if new_path: self.show_info(_("Backup saved:") + f"\n{new_path}") else: diff --git a/electrum/gui/kivy/uix/ui_screens/status.kv b/electrum/gui/kivy/uix/ui_screens/status.kv index 12c9634f8..41f75b7a8 100644 --- a/electrum/gui/kivy/uix/ui_screens/status.kv +++ b/electrum/gui/kivy/uix/ui_screens/status.kv @@ -81,7 +81,8 @@ Popup: Button: size_hint: 0.5, None height: '48dp' - text: _('Save Backup') + text: _('Export Backup') + disabled: not app.android_backups on_release: root.dismiss() app.save_backup()