1
0

QR code fixes

New classes ScanQRTextEdit and ShowQRTextEdit.
Reason: dependencies on zbar availability and issues with the QRTextEdit constructor.
- ScanQRTextEdit needs access to the config (fetch camera). It needs to load
the zbar processor properly before trying to scan. Keeping a reference to
the processor in qrscaner fixes the crashes on windows.
- ShowQRTextEdit should not have access to scan_qr().
- no need to setReadOnly anymore. It is clear from the class name.

Show master pub keys now has a Combobox if multiple accounts are
available.
This commit is contained in:
Tafelpoot
2014-10-24 15:45:10 +02:00
parent babead68b6
commit 256a467dd7
8 changed files with 111 additions and 50 deletions

View File

@@ -18,7 +18,7 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qrtextedit import QRTextEdit
from qrtextedit import ScanQRTextEdit
import re
from decimal import Decimal
@@ -30,11 +30,9 @@ RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>'
frozen_style = "QWidget { background-color:none; border:none;}"
normal_style = "QPlainTextEdit { }"
class PayToEdit(QRTextEdit):
class PayToEdit(ScanQRTextEdit):
def __init__(self, win):
QRTextEdit.__init__(self)
self.win = win
super(PayToEdit,self).__init__(win=win)
self.amount_edit = win.amount_e
self.document().contentsChanged.connect(self.update_size)
self.heightMin = 0
@@ -235,3 +233,10 @@ class PayToEdit(QRTextEdit):
cr = self.cursorRect()
cr.setWidth(self.c.popup().sizeHintForColumn(0) + self.c.popup().verticalScrollBar().sizeHint().width())
self.c.complete(cr)
def qr_input(self):
data = super(PayToEdit,self).qr_input()
if data.startswith("bitcoin:"):
self.scan_f(data)
# TODO: update fee