From eff977081db0c908c021c09281af7138ce114a74 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 24 Apr 2015 00:14:21 +0200 Subject: [PATCH] add file reader to QRTextEdit, to facilitate key imports --- gui/qt/installwizard.py | 1 + gui/qt/qrtextedit.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py index daab12f64..7a59e1fa7 100644 --- a/gui/qt/installwizard.py +++ b/gui/qt/installwizard.py @@ -128,6 +128,7 @@ class InstallWizard(QDialog): if func is None: func = self.is_any vbox, seed_e = seed_dialog.enter_seed_box(msg, self, sid) + seed_e.addButton(":icons/copy.png", seed_e.file_input, _("Read file")) vbox.addStretch(1) button = OkButton(self, _('Next')) vbox.addLayout(Buttons(CancelButton(self), button)) diff --git a/gui/qt/qrtextedit.py b/gui/qt/qrtextedit.py index 2b5b98c7a..9d0f4ac12 100644 --- a/gui/qt/qrtextedit.py +++ b/gui/qt/qrtextedit.py @@ -38,6 +38,14 @@ class ScanQRTextEdit(ButtonsTextEdit): self.addButton(":icons/qrcode.png", self.qr_input, _("Read QR code")) run_hook('scan_text_edit', self) + def file_input(self): + fileName = unicode(QFileDialog.getOpenFileName(self, 'select file')) + if not fileName: + return + with open(fileName, "r") as f: + data = f.read() + self.setText(data) + def qr_input(self): from electrum import qrscanner try: