URI: 
       tMerge pull request #1492 from ctrlcctrlv/uncopyable-seed - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit b1ab49a282811cdbbd0b449a1659b2a7760747f6
   DIR parent 0e0118bd5973a3f3f3d5e28dd3b747d3317e54ef
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Sat, 31 Oct 2015 10:59:19 +0100
       
       Merge pull request #1492 from ctrlcctrlv/uncopyable-seed
       
       Make seed uncopyable
       Diffstat:
         M gui/qt/installwizard.py             |       2 +-
         M gui/qt/qrtextedit.py                |      19 ++++++++++++++++++-
         M gui/qt/seed_dialog.py               |      12 ++++++------
       
       3 files changed, 25 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py
       t@@ -416,7 +416,7 @@ class InstallWizard(QDialog):
                return True
        
            def show_seed(self, seed, sid):
       -        vbox = seed_dialog.show_seed_box_msg(seed, sid)
       +        vbox = seed_dialog.show_seed_box_msg(seed, sid, paranoid=True)
                vbox.addLayout(Buttons(CancelButton(self), OkButton(self, _("Next"))))
                self.set_layout(vbox)
                return self.exec_()
   DIR diff --git a/gui/qt/qrtextedit.py b/gui/qt/qrtextedit.py
       t@@ -8,10 +8,26 @@ from util import ButtonsTextEdit
        
        class ShowQRTextEdit(ButtonsTextEdit):
        
       -    def __init__(self, text=None):
       +    def __init__(self, text=None, paranoid=False):
                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)
        
            def qr_show(self):
       t@@ -23,6 +39,7 @@ 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())
   DIR diff --git a/gui/qt/seed_dialog.py b/gui/qt/seed_dialog.py
       t@@ -47,9 +47,9 @@ def icon_filename(sid):
                return ":icons/seed.png"
        
        
       -def show_seed_box_msg(seedphrase, sid=None):
       +def show_seed_box_msg(seedphrase, sid=None, paranoid=False):
            msg =  _("Your wallet generation seed is") + ":"
       -    vbox = show_seed_box(msg, seedphrase, sid)
       +    vbox = show_seed_box(msg, seedphrase, sid, paranoid=paranoid)
            save_msg = _("Please save these %d words on paper (order is important).")%len(seedphrase.split()) + " "
            msg2 = save_msg + " " \
                   + _("This seed will allow you to recover your wallet in case of computer failure.") + "<br/>" \
       t@@ -60,11 +60,11 @@ def show_seed_box_msg(seedphrase, sid=None):
            vbox.addStretch(1)
            return vbox
        
       -def show_seed_box(msg, seed, sid):
       -    vbox, seed_e = enter_seed_box(msg, None, sid=sid, text=seed)
       +def show_seed_box(msg, seed, sid, paranoid=False):
       +    vbox, seed_e = enter_seed_box(msg, None, sid=sid, text=seed, paranoid=paranoid)
            return vbox
        
       -def enter_seed_box(msg, window, sid=None, text=None):
       +def enter_seed_box(msg, window, sid=None, text=None, paranoid=False):
            vbox = QVBoxLayout()
            logo = QLabel()
            logo.setPixmap(QPixmap(icon_filename(sid)).scaledToWidth(56))
       t@@ -75,7 +75,7 @@ def enter_seed_box(msg, window, sid=None, text=None):
                seed_e = ScanQRTextEdit()
                seed_e.setTabChangesFocus(True)
            else:
       -        seed_e = ShowQRTextEdit(text=text)
       +        seed_e = ShowQRTextEdit(text=text, paranoid=paranoid)
            seed_e.setMaximumHeight(130)
            vbox.addWidget(label)
            grid = QGridLayout()