Browse Source

kivy: initialize app.android_backups from config, and show error message if save_backup raises an exception

patch-4
ThomasV 4 years ago
parent
commit
587ca5dd42
  1. 8
      electrum/gui/kivy/main_window.py
  2. 3
      electrum/gui/kivy/uix/ui_screens/status.kv

8
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:

3
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()

Loading…
Cancel
Save