revert PR #1492. clear clipboard instead
This commit is contained in:
parent
dae9352c18
commit
77d6ee74f9
|
@ -143,7 +143,7 @@ class ElectrumGui:
|
||||||
action = wallet.get_action()
|
action = wallet.get_action()
|
||||||
# run wizard
|
# run wizard
|
||||||
if action is not None:
|
if action is not None:
|
||||||
wizard = InstallWizard(self.config, self.network, storage)
|
wizard = InstallWizard(self.app, self.config, self.network, storage)
|
||||||
wallet = wizard.run(action)
|
wallet = wizard.run(action)
|
||||||
# keep current wallet
|
# keep current wallet
|
||||||
if not wallet:
|
if not wallet:
|
||||||
|
@ -174,7 +174,7 @@ class ElectrumGui:
|
||||||
if storage.file_exists:
|
if storage.file_exists:
|
||||||
QMessageBox.critical(None, "Error", _("File exists"))
|
QMessageBox.critical(None, "Error", _("File exists"))
|
||||||
return
|
return
|
||||||
wizard = InstallWizard(self.config, self.network, storage)
|
wizard = InstallWizard(self.app, self.config, self.network, storage)
|
||||||
wallet = wizard.run('new')
|
wallet = wizard.run('new')
|
||||||
if wallet:
|
if wallet:
|
||||||
self.new_window(full_path)
|
self.new_window(full_path)
|
||||||
|
|
|
@ -64,8 +64,9 @@ class CosignWidget(QWidget):
|
||||||
|
|
||||||
class InstallWizard(QDialog):
|
class InstallWizard(QDialog):
|
||||||
|
|
||||||
def __init__(self, config, network, storage):
|
def __init__(self, app, config, network, storage):
|
||||||
QDialog.__init__(self)
|
QDialog.__init__(self)
|
||||||
|
self.app = app
|
||||||
self.config = config
|
self.config = config
|
||||||
self.network = network
|
self.network = network
|
||||||
self.storage = storage
|
self.storage = storage
|
||||||
|
@ -416,12 +417,11 @@ class InstallWizard(QDialog):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def show_seed(self, seed, sid):
|
def show_seed(self, seed, sid):
|
||||||
vbox = seed_dialog.show_seed_box_msg(seed, sid, paranoid=True)
|
vbox = seed_dialog.show_seed_box_msg(seed, sid)
|
||||||
vbox.addLayout(Buttons(CancelButton(self), OkButton(self, _("Next"))))
|
vbox.addLayout(Buttons(CancelButton(self), OkButton(self, _("Next"))))
|
||||||
self.set_layout(vbox)
|
self.set_layout(vbox)
|
||||||
return self.exec_()
|
return self.exec_()
|
||||||
|
|
||||||
|
|
||||||
def password_dialog(self):
|
def password_dialog(self):
|
||||||
msg = _("Please choose a password to encrypt your wallet keys.")+'\n'\
|
msg = _("Please choose a password to encrypt your wallet keys.")+'\n'\
|
||||||
+_("Leave these fields empty if you want to disable encryption.")
|
+_("Leave these fields empty if you want to disable encryption.")
|
||||||
|
@ -506,6 +506,7 @@ class InstallWizard(QDialog):
|
||||||
seed = wallet.make_seed(lang)
|
seed = wallet.make_seed(lang)
|
||||||
if not self.show_seed(seed, None):
|
if not self.show_seed(seed, None):
|
||||||
return
|
return
|
||||||
|
self.app.clipboard().clear()
|
||||||
if not self.verify_seed(seed, None):
|
if not self.verify_seed(seed, None):
|
||||||
return
|
return
|
||||||
password = self.password_dialog()
|
password = self.password_dialog()
|
||||||
|
|
|
@ -8,25 +8,10 @@ from util import ButtonsTextEdit
|
||||||
|
|
||||||
class ShowQRTextEdit(ButtonsTextEdit):
|
class ShowQRTextEdit(ButtonsTextEdit):
|
||||||
|
|
||||||
def __init__(self, text=None, paranoid=False):
|
def __init__(self, text=None):
|
||||||
ButtonsTextEdit.__init__(self, text)
|
ButtonsTextEdit.__init__(self, text)
|
||||||
self.setReadOnly(1)
|
self.setReadOnly(1)
|
||||||
self.addButton(":icons/qrcode.png", self.qr_show, _("Show as QR code"))
|
self.addButton(":icons/qrcode.png", self.qr_show, _("Show as QR code"))
|
||||||
self.paranoid = paranoid
|
|
||||||
|
|
||||||
if paranoid:
|
|
||||||
# Paranoid flag forces the user to write down what's in the box,
|
|
||||||
# like Mycelium does. This is useful since many users just copy
|
|
||||||
# and paste their code, then when disaster strikes they don't have
|
|
||||||
# it written down anywhere.
|
|
||||||
self.setAcceptDrops(False) # No dragging and dropping
|
|
||||||
# Use custom context menu to remove copy/paste from menu
|
|
||||||
self.setContextMenuPolicy(Qt.ActionsContextMenu)
|
|
||||||
self.qaction = QAction(_("Show as QR code"), self)
|
|
||||||
self.qaction.triggered.connect(self.qr_show)
|
|
||||||
self.addAction(self.qaction)
|
|
||||||
# No text selection allowed.
|
|
||||||
self.setTextInteractionFlags(Qt.NoTextInteraction)
|
|
||||||
|
|
||||||
run_hook('show_text_edit', self)
|
run_hook('show_text_edit', self)
|
||||||
|
|
||||||
|
@ -39,7 +24,6 @@ class ShowQRTextEdit(ButtonsTextEdit):
|
||||||
QRDialog(s).exec_()
|
QRDialog(s).exec_()
|
||||||
|
|
||||||
def contextMenuEvent(self, e):
|
def contextMenuEvent(self, e):
|
||||||
if self.paranoid: return
|
|
||||||
m = self.createStandardContextMenu()
|
m = self.createStandardContextMenu()
|
||||||
m.addAction(_("Show as QR code"), self.qr_show)
|
m.addAction(_("Show as QR code"), self.qr_show)
|
||||||
m.exec_(e.globalPos())
|
m.exec_(e.globalPos())
|
||||||
|
|
|
@ -47,9 +47,9 @@ def icon_filename(sid):
|
||||||
return ":icons/seed.png"
|
return ":icons/seed.png"
|
||||||
|
|
||||||
|
|
||||||
def show_seed_box_msg(seedphrase, sid=None, paranoid=False):
|
def show_seed_box_msg(seedphrase, sid=None):
|
||||||
msg = _("Your wallet generation seed is") + ":"
|
msg = _("Your wallet generation seed is") + ":"
|
||||||
vbox = show_seed_box(msg, seedphrase, sid, paranoid=paranoid)
|
vbox = show_seed_box(msg, seedphrase, sid)
|
||||||
msg = ''.join([
|
msg = ''.join([
|
||||||
"<p>",
|
"<p>",
|
||||||
_("Please save these %d words on paper (order is important).")%len(seedphrase.split()) + " ",
|
_("Please save these %d words on paper (order is important).")%len(seedphrase.split()) + " ",
|
||||||
|
@ -68,11 +68,11 @@ def show_seed_box_msg(seedphrase, sid=None, paranoid=False):
|
||||||
vbox.addStretch(1)
|
vbox.addStretch(1)
|
||||||
return vbox
|
return vbox
|
||||||
|
|
||||||
def show_seed_box(msg, seed, sid, paranoid=False):
|
def show_seed_box(msg, seed, sid):
|
||||||
vbox, seed_e = enter_seed_box(msg, None, sid=sid, text=seed, paranoid=paranoid)
|
vbox, seed_e = enter_seed_box(msg, None, sid=sid, text=seed)
|
||||||
return vbox
|
return vbox
|
||||||
|
|
||||||
def enter_seed_box(msg, window, sid=None, text=None, paranoid=False):
|
def enter_seed_box(msg, window, sid=None, text=None):
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
logo = QLabel()
|
logo = QLabel()
|
||||||
logo.setPixmap(QPixmap(icon_filename(sid)).scaledToWidth(56))
|
logo.setPixmap(QPixmap(icon_filename(sid)).scaledToWidth(56))
|
||||||
|
@ -83,7 +83,7 @@ def enter_seed_box(msg, window, sid=None, text=None, paranoid=False):
|
||||||
seed_e = ScanQRTextEdit()
|
seed_e = ScanQRTextEdit()
|
||||||
seed_e.setTabChangesFocus(True)
|
seed_e.setTabChangesFocus(True)
|
||||||
else:
|
else:
|
||||||
seed_e = ShowQRTextEdit(text=text, paranoid=paranoid)
|
seed_e = ShowQRTextEdit(text=text)
|
||||||
seed_e.setMaximumHeight(130)
|
seed_e.setMaximumHeight(130)
|
||||||
vbox.addWidget(label)
|
vbox.addWidget(label)
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
|
|
Loading…
Reference in New Issue