add file reader to QRTextEdit, to facilitate key imports
This commit is contained in:
parent
d94aee83b9
commit
eff977081d
@ -128,6 +128,7 @@ class InstallWizard(QDialog):
|
|||||||
if func is None:
|
if func is None:
|
||||||
func = self.is_any
|
func = self.is_any
|
||||||
vbox, seed_e = seed_dialog.enter_seed_box(msg, self, sid)
|
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)
|
vbox.addStretch(1)
|
||||||
button = OkButton(self, _('Next'))
|
button = OkButton(self, _('Next'))
|
||||||
vbox.addLayout(Buttons(CancelButton(self), button))
|
vbox.addLayout(Buttons(CancelButton(self), button))
|
||||||
|
|||||||
@ -38,6 +38,14 @@ class ScanQRTextEdit(ButtonsTextEdit):
|
|||||||
self.addButton(":icons/qrcode.png", self.qr_input, _("Read QR code"))
|
self.addButton(":icons/qrcode.png", self.qr_input, _("Read QR code"))
|
||||||
run_hook('scan_text_edit', self)
|
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):
|
def qr_input(self):
|
||||||
from electrum import qrscanner
|
from electrum import qrscanner
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user