Browse Source

qml: fix lnurl-pay when config.BTC_AMOUNTS_ADD_THOUSANDS_SEP is True

when paying an lnurl-pay that provides an amount interval,
the amount field is editable by the user and it expects no spaces
master
SomberNight 3 years ago
parent
commit
888291a8f8
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/gui/qml/components/LnurlPayRequestDialog.qml
  2. 9
      electrum/gui/qml/qeconfig.py

2
electrum/gui/qml/components/LnurlPayRequestDialog.qml

@ -64,7 +64,7 @@ ElDialog {
BtcField { BtcField {
id: amountBtc id: amountBtc
Layout.preferredWidth: rootLayout.width /3 Layout.preferredWidth: rootLayout.width /3
text: Config.formatSats(invoiceParser.lnurlData['min_sendable_sat']) text: Config.formatSatsForEditing(invoiceParser.lnurlData['min_sendable_sat'])
enabled: invoiceParser.lnurlData['min_sendable_sat'] != invoiceParser.lnurlData['max_sendable_sat'] enabled: invoiceParser.lnurlData['min_sendable_sat'] != invoiceParser.lnurlData['max_sendable_sat']
color: Material.foreground // override gray-out on disabled color: Material.foreground // override gray-out on disabled
fiatfield: amountFiat fiatfield: amountFiat

9
electrum/gui/qml/qeconfig.py

@ -211,6 +211,15 @@ class QEConfig(AuthMixin, QObject):
self.config.GUI_QML_USER_KNOWS_PRESS_AND_HOLD = userKnowsPressAndHold self.config.GUI_QML_USER_KNOWS_PRESS_AND_HOLD = userKnowsPressAndHold
self.userKnowsPressAndHoldChanged.emit() self.userKnowsPressAndHoldChanged.emit()
@pyqtSlot('qint64', result=str)
@pyqtSlot(QEAmount, result=str)
def formatSatsForEditing(self, satoshis):
if isinstance(satoshis, QEAmount):
satoshis = satoshis.satsInt
return self.config.format_amount(
satoshis,
add_thousands_sep=False,
)
@pyqtSlot('qint64', result=str) @pyqtSlot('qint64', result=str)
@pyqtSlot('qint64', bool, result=str) @pyqtSlot('qint64', bool, result=str)

Loading…
Cancel
Save