electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 77d6ee74f9910c27fe9c4eaa994e63b818d9426b
parent dae9352c18e837d4a4fa98cd9bcd9ea1d32d062d
Author: ThomasV <thomasv@electrum.org>
Date:   Sat, 31 Oct 2015 11:47:42 +0100

revert PR #1492. clear clipboard instead

Diffstat:
Mgui/qt/__init__.py | 4++--
Mgui/qt/installwizard.py | 7++++---
Mgui/qt/qrtextedit.py | 18+-----------------
Mgui/qt/seed_dialog.py | 12++++++------
4 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py @@ -143,7 +143,7 @@ class ElectrumGui: action = wallet.get_action() # run wizard 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) # keep current wallet if not wallet: @@ -174,7 +174,7 @@ class ElectrumGui: if storage.file_exists: QMessageBox.critical(None, "Error", _("File exists")) return - wizard = InstallWizard(self.config, self.network, storage) + wizard = InstallWizard(self.app, self.config, self.network, storage) wallet = wizard.run('new') if wallet: self.new_window(full_path) diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py @@ -64,8 +64,9 @@ class CosignWidget(QWidget): class InstallWizard(QDialog): - def __init__(self, config, network, storage): + def __init__(self, app, config, network, storage): QDialog.__init__(self) + self.app = app self.config = config self.network = network self.storage = storage @@ -416,12 +417,11 @@ class InstallWizard(QDialog): return True 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")))) self.set_layout(vbox) return self.exec_() - def password_dialog(self): msg = _("Please choose a password to encrypt your wallet keys.")+'\n'\ +_("Leave these fields empty if you want to disable encryption.") @@ -506,6 +506,7 @@ class InstallWizard(QDialog): seed = wallet.make_seed(lang) if not self.show_seed(seed, None): return + self.app.clipboard().clear() if not self.verify_seed(seed, None): return password = self.password_dialog() diff --git a/gui/qt/qrtextedit.py b/gui/qt/qrtextedit.py @@ -8,25 +8,10 @@ from util import ButtonsTextEdit class ShowQRTextEdit(ButtonsTextEdit): - def __init__(self, text=None, paranoid=False): + def __init__(self, text=None): ButtonsTextEdit.__init__(self, text) self.setReadOnly(1) 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) @@ -39,7 +24,6 @@ class ShowQRTextEdit(ButtonsTextEdit): QRDialog(s).exec_() def contextMenuEvent(self, e): - if self.paranoid: return m = self.createStandardContextMenu() m.addAction(_("Show as QR code"), self.qr_show) m.exec_(e.globalPos()) diff --git a/gui/qt/seed_dialog.py b/gui/qt/seed_dialog.py @@ -47,9 +47,9 @@ def icon_filename(sid): 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") + ":" - vbox = show_seed_box(msg, seedphrase, sid, paranoid=paranoid) + vbox = show_seed_box(msg, seedphrase, sid) msg = ''.join([ "<p>", _("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) return vbox -def show_seed_box(msg, seed, sid, paranoid=False): - vbox, seed_e = enter_seed_box(msg, None, sid=sid, text=seed, paranoid=paranoid) +def show_seed_box(msg, seed, sid): + vbox, seed_e = enter_seed_box(msg, None, sid=sid, text=seed) 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() logo = QLabel() 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.setTabChangesFocus(True) else: - seed_e = ShowQRTextEdit(text=text, paranoid=paranoid) + seed_e = ShowQRTextEdit(text=text) seed_e.setMaximumHeight(130) vbox.addWidget(label) grid = QGridLayout()