Browse Source
Merge pull request #8072 from SomberNight/202211_2fa_qrcode
qt wizard: (fix) during 2fa wallet creation, shared QR to be drawn
patch-4
ThomasV
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
6 deletions
-
electrum/gui/qt/qrcodewidget.py
-
electrum/gui/qt/receive_tab.py
|
|
@ -18,14 +18,14 @@ from .util import WindowModalDialog, WWLabel, getSaveFileName |
|
|
|
|
|
|
|
class QRCodeWidget(QWidget): |
|
|
|
|
|
|
|
def __init__(self, data = None): |
|
|
|
def __init__(self, data=None, *, manual_size: bool = False): |
|
|
|
QWidget.__init__(self) |
|
|
|
self.data = None |
|
|
|
self.qr = None |
|
|
|
self._framesize = None # type: Optional[int] |
|
|
|
self._manual_size = manual_size |
|
|
|
self.setData(data) |
|
|
|
|
|
|
|
|
|
|
|
def setData(self, data): |
|
|
|
if self.data != data: |
|
|
|
self.data = data |
|
|
@ -36,6 +36,9 @@ class QRCodeWidget(QWidget): |
|
|
|
border=0, |
|
|
|
) |
|
|
|
self.qr.add_data(self.data) |
|
|
|
if not self._manual_size: |
|
|
|
k = len(self.qr.get_matrix()) |
|
|
|
self.setMinimumSize(k * 5, k * 5) |
|
|
|
else: |
|
|
|
self.qr = None |
|
|
|
|
|
|
@ -120,7 +123,7 @@ class QRDialog(WindowModalDialog): |
|
|
|
|
|
|
|
vbox = QVBoxLayout() |
|
|
|
|
|
|
|
qrw = QRCodeWidget(data) |
|
|
|
qrw = QRCodeWidget(data, manual_size=True) |
|
|
|
qrw.setMinimumSize(250, 250) |
|
|
|
vbox.addWidget(qrw, 1) |
|
|
|
|
|
|
|
|
|
@ -135,9 +135,9 @@ class ReceiveTab(QWidget, MessageBoxMixin, Logger): |
|
|
|
self.receive_lightning_help = FramedWidget() |
|
|
|
self.receive_lightning_help.setVisible(False) |
|
|
|
self.receive_lightning_help.setLayout(vbox) |
|
|
|
self.receive_address_qr = QRCodeWidget() |
|
|
|
self.receive_URI_qr = QRCodeWidget() |
|
|
|
self.receive_lightning_qr = QRCodeWidget() |
|
|
|
self.receive_address_qr = QRCodeWidget(manual_size=True) |
|
|
|
self.receive_URI_qr = QRCodeWidget(manual_size=True) |
|
|
|
self.receive_lightning_qr = QRCodeWidget(manual_size=True) |
|
|
|
|
|
|
|
for e in [self.receive_address_e, self.receive_URI_e, self.receive_lightning_e]: |
|
|
|
e.setFont(QFont(MONOSPACE_FONT)) |
|
|
|