mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 08:51:32 +00:00
qt: allow QR codes to store a bit more data
by decreasing error correction (about ~26% larger max payload)
This commit is contained in:
parent
aec53ae6af
commit
c776af41f6
2 changed files with 10 additions and 2 deletions
|
@ -27,7 +27,11 @@ class QRCodeWidget(QWidget):
|
||||||
if self.data != data:
|
if self.data != data:
|
||||||
self.data = data
|
self.data = data
|
||||||
if self.data:
|
if self.data:
|
||||||
self.qr = qrcode.QRCode()
|
self.qr = qrcode.QRCode(
|
||||||
|
error_correction=qrcode.constants.ERROR_CORRECT_L,
|
||||||
|
box_size=10,
|
||||||
|
border=0,
|
||||||
|
)
|
||||||
self.qr.add_data(self.data)
|
self.qr.add_data(self.data)
|
||||||
if not self.fixedSize:
|
if not self.fixedSize:
|
||||||
k = len(self.qr.get_matrix())
|
k = len(self.qr.get_matrix())
|
||||||
|
|
|
@ -28,6 +28,7 @@ import copy
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import traceback
|
import traceback
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, Qt
|
from PyQt5.QtCore import QSize, Qt
|
||||||
from PyQt5.QtGui import QTextCharFormat, QBrush, QFont
|
from PyQt5.QtGui import QTextCharFormat, QBrush, QFont
|
||||||
|
@ -47,6 +48,9 @@ from electrum.logging import get_logger
|
||||||
from .util import (MessageBoxMixin, read_QIcon, Buttons, CopyButton,
|
from .util import (MessageBoxMixin, read_QIcon, Buttons, CopyButton,
|
||||||
MONOSPACE_FONT, ColorScheme, ButtonsLineEdit)
|
MONOSPACE_FONT, ColorScheme, ButtonsLineEdit)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .main_window import ElectrumWindow
|
||||||
|
|
||||||
|
|
||||||
SAVE_BUTTON_ENABLED_TOOLTIP = _("Save transaction offline")
|
SAVE_BUTTON_ENABLED_TOOLTIP = _("Save transaction offline")
|
||||||
SAVE_BUTTON_DISABLED_TOOLTIP = _("Please sign this transaction in order to save it")
|
SAVE_BUTTON_DISABLED_TOOLTIP = _("Please sign this transaction in order to save it")
|
||||||
|
@ -83,7 +87,7 @@ class TxDialog(QDialog, MessageBoxMixin):
|
||||||
self.tx.deserialize()
|
self.tx.deserialize()
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
raise SerializationError(e)
|
raise SerializationError(e)
|
||||||
self.main_window = parent
|
self.main_window = parent # type: ElectrumWindow
|
||||||
self.wallet = parent.wallet
|
self.wallet = parent.wallet
|
||||||
self.prompt_if_unsaved = prompt_if_unsaved
|
self.prompt_if_unsaved = prompt_if_unsaved
|
||||||
self.saved = False
|
self.saved = False
|
||||||
|
|
Loading…
Add table
Reference in a new issue