Browse Source

kivy: handle wallet opening failures

master
ThomasV 10 years ago
parent
commit
35fe8fc0c1
  1. 15
      gui/kivy/main_window.py
  2. 2
      gui/kivy/uix/dialogs/wallets.py

15
gui/kivy/main_window.py

@ -1,4 +1,5 @@
import re import re
import os
import sys import sys
import time import time
import datetime import datetime
@ -370,12 +371,21 @@ class ElectrumWindow(App):
if uri: if uri:
self.set_URI(uri) self.set_URI(uri)
def get_wallet_path(self):
if self.wallet:
return self.wallet.storage.path
else:
return ''
def load_wallet_by_name(self, wallet_path): def load_wallet_by_name(self, wallet_path):
if not wallet_path: if not wallet_path:
return return
config = self.electrum_config config = self.electrum_config
storage = WalletStorage(wallet_path) try:
Logger.info('Electrum: Check for existing wallet') storage = WalletStorage(wallet_path)
except IOError:
self.show_error("Cannot read wallet file")
return
if storage.file_exists: if storage.file_exists:
wallet = Wallet(storage) wallet = Wallet(storage)
action = wallet.get_action() action = wallet.get_action()
@ -587,7 +597,6 @@ class ElectrumWindow(App):
global notification, os global notification, os
if not notification: if not notification:
from plyer import notification from plyer import notification
import os
icon = (os.path.dirname(os.path.realpath(__file__)) icon = (os.path.dirname(os.path.realpath(__file__))
+ '/../../' + self.icon) + '/../../' + self.icon)
notification.notify('Electrum', message, notification.notify('Electrum', message,

2
gui/kivy/uix/dialogs/wallets.py

@ -23,7 +23,7 @@ Builder.load_string('''
dirselect: False dirselect: False
filter_dirs: True filter_dirs: True
filter: '*.*' filter: '*.*'
path: os.path.dirname(app.wallet.storage.path) path: os.path.dirname(app.get_wallet_path())
size_hint_y: 0.6 size_hint_y: 0.6
Widget Widget
size_hint_y: 0.1 size_hint_y: 0.1

Loading…
Cancel
Save