|
|
|
|
@ -187,10 +187,12 @@ class ElectrumWindow(QMainWindow):
|
|
|
|
|
|
|
|
|
|
def load_wallet(self, wallet): |
|
|
|
|
import electrum |
|
|
|
|
|
|
|
|
|
self.wallet = wallet |
|
|
|
|
self.update_wallet_format() |
|
|
|
|
|
|
|
|
|
self.accounts_expanded = self.wallet.storage.get('accounts_expanded',{}) |
|
|
|
|
self.current_account = self.wallet.storage.get("current_account", None) |
|
|
|
|
|
|
|
|
|
title = 'Electrum ' + self.wallet.electrum_version + ' - ' + self.wallet.storage.path |
|
|
|
|
if self.wallet.is_watching_only(): title += ' [%s]' % (_('watching only')) |
|
|
|
|
self.setWindowTitle( title ) |
|
|
|
|
@ -213,6 +215,16 @@ class ElectrumWindow(QMainWindow):
|
|
|
|
|
run_hook('load_wallet', wallet) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_wallet_format(self): |
|
|
|
|
# convert old-format imported keys |
|
|
|
|
if self.wallet.imported_keys: |
|
|
|
|
password = self.password_dialog(_("Please enter your password in order to update imported keys")) |
|
|
|
|
try: |
|
|
|
|
self.wallet.convert_imported_keys(password) |
|
|
|
|
except: |
|
|
|
|
self.show_message("error") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def open_wallet(self): |
|
|
|
|
wallet_folder = self.wallet.storage.path |
|
|
|
|
filename = unicode( QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) ) |
|
|
|
|
@ -1491,7 +1503,7 @@ class ElectrumWindow(QMainWindow):
|
|
|
|
|
QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK')) |
|
|
|
|
return |
|
|
|
|
from seed_dialog import SeedDialog |
|
|
|
|
d = SeedDialog(self, mnemonic, self.wallet.imported_keys) |
|
|
|
|
d = SeedDialog(self, mnemonic, self.wallet.has_imported_keys()) |
|
|
|
|
d.exec_() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1730,7 +1742,7 @@ class ElectrumWindow(QMainWindow):
|
|
|
|
|
def show_message(self, msg): |
|
|
|
|
QMessageBox.information(self, _('Message'), msg, _('OK')) |
|
|
|
|
|
|
|
|
|
def password_dialog(self ): |
|
|
|
|
def password_dialog(self, msg=None): |
|
|
|
|
d = QDialog(self) |
|
|
|
|
d.setModal(1) |
|
|
|
|
d.setWindowTitle(_("Enter Password")) |
|
|
|
|
@ -1739,7 +1751,8 @@ class ElectrumWindow(QMainWindow):
|
|
|
|
|
pw.setEchoMode(2) |
|
|
|
|
|
|
|
|
|
vbox = QVBoxLayout() |
|
|
|
|
msg = _('Please enter your password') |
|
|
|
|
if not msg: |
|
|
|
|
msg = _('Please enter your password') |
|
|
|
|
vbox.addWidget(QLabel(msg)) |
|
|
|
|
|
|
|
|
|
grid = QGridLayout() |
|
|
|
|
@ -2118,7 +2131,7 @@ class ElectrumWindow(QMainWindow):
|
|
|
|
|
|
|
|
|
|
@protected |
|
|
|
|
def do_import_privkey(self, password): |
|
|
|
|
if not self.wallet.imported_keys: |
|
|
|
|
if not self.wallet.has_imported_keys(): |
|
|
|
|
r = QMessageBox.question(None, _('Warning'), '<b>'+_('Warning') +':\n</b><br/>'+ _('Imported keys are not recoverable from seed.') + ' ' \ |
|
|
|
|
+ _('If you ever need to restore your wallet from its seed, these keys will be lost.') + '<p>' \ |
|
|
|
|
+ _('Are you sure you understand what you are doing?'), 3, 4) |
|
|
|
|
|