Browse Source

qml: improve info text for incomplete transactions and transactions in mempool on transaction details page.

master
Sander van Grieken 2 years ago
parent
commit
297f971fae
No known key found for this signature in database
GPG Key ID: 9BCF8209EA402EBA
  1. 31
      electrum/gui/qml/components/TxDetails.qml
  2. 7
      electrum/gui/qml/qetxdetails.py

31
electrum/gui/qml/components/TxDetails.qml

@ -64,33 +64,46 @@ Pane {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge
visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel || txdetails.canRemove || txdetails.isUnrelated
visible: txdetails.isUnrelated || !txdetails.isMined
text: txdetails.isUnrelated
? qsTr('Transaction is unrelated to this wallet')
: txdetails.canRemove
? txdetails.lockDelay
? qsTr('Transaction is unrelated to this wallet.')
: txdetails.inMempool
? qsTr('This transaction is still unconfirmed.') + '\n' +
(txdetails.canBump || txdetails.canCpfp || txdetails.canCancel
? txdetails.canCancel
? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction.')
: qsTr('You can bump its fee to speed up its confirmation.')
: '')
: txdetails.lockDelay
? qsTr('This transaction is local to your wallet and locked for the next %1 blocks.').arg(txdetails.lockDelay)
: qsTr('This transaction is local to your wallet. It has not been published yet.')
: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel
? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction')
: qsTr('You can bump its fee to speed up its confirmation'))
: txdetails.isComplete
? qsTr('This transaction is local to your wallet. It has not been published yet.')
: txdetails.canSign
? qsTr('This transaction is not fully signed and can be signed by this wallet.')
: qsTr('This transaction is not fully signed.') + '\n' +
(txdetails.wallet.isWatchOnly
? qsTr('Present this transaction to the signing wallet.')
: qsTr('Present this transaction to the next cosigner.'))
iconStyle: txdetails.isUnrelated
? InfoTextArea.IconStyle.Warn
: InfoTextArea.IconStyle.Info
}
Label {
Layout.preferredWidth: 1
Layout.fillWidth: true
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
text: txdetails.amount.satsInt > 0
? qsTr('Amount received onchain')
: qsTr('Amount sent onchain')
color: Material.accentColor
wrapMode: Text.Wrap
}
FormattedAmount {
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
Layout.preferredWidth: 1
Layout.fillWidth: true
visible: !txdetails.isUnrelated && txdetails.amount.satsInt != 0
amount: txdetails.amount
timestamp: txdetails.timestamp
}

7
electrum/gui/qml/qetxdetails.py

@ -60,6 +60,7 @@ class QETxDetails(QObject, QtEventListener):
self._should_confirm = False
self._mempool_depth = ''
self._in_mempool = False
self._date = ''
self._timestamp = 0
@ -178,6 +179,10 @@ class QETxDetails(QObject, QtEventListener):
def mempoolDepth(self):
return self._mempool_depth
@pyqtProperty(bool, notify=detailsChanged)
def inMempool(self):
return self._in_mempool
@pyqtProperty(str, notify=detailsChanged)
def date(self):
return self._date
@ -298,12 +303,14 @@ class QETxDetails(QObject, QtEventListener):
should_reject = False
self._lock_delay = 0
self._in_mempool = False
self._is_mined = False if not txinfo.tx_mined_status else txinfo.tx_mined_status.height > 0
if self._is_mined:
self.update_mined_status(txinfo.tx_mined_status)
else:
if txinfo.tx_mined_status.height in [TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT]:
self._mempool_depth = self._wallet.wallet.config.depth_tooltip(txinfo.mempool_depth_bytes)
self._in_mempool = True
elif txinfo.tx_mined_status.height == TX_HEIGHT_FUTURE:
self._lock_delay = txinfo.tx_mined_status.wanted_height - self._wallet.wallet.adb.get_local_height()
if isinstance(self._tx, PartialTransaction):

Loading…
Cancel
Save