Browse Source

add frozen balance to balancesummary

patch-4
Sander van Grieken 3 years ago
parent
commit
b3920f0408
  1. 22
      electrum/gui/qml/components/BalanceSummary.qml
  2. 1
      electrum/gui/qml/qeaddressdetails.py
  3. 4
      electrum/gui/qml/qewallet.py

22
electrum/gui/qml/components/BalanceSummary.qml

@ -9,19 +9,23 @@ Frame {
font.pixelSize: constants.fontSizeMedium
property string formattedBalance
property string formattedUnconfirmed
property string formattedBalanceFiat
property string formattedUnconfirmed
property string formattedUnconfirmedFiat
property string formattedFrozen
property string formattedFrozenFiat
property string formattedLightningBalance
property string formattedLightningBalanceFiat
function setBalances() {
root.formattedBalance = Config.formatSats(Daemon.currentWallet.confirmedBalance)
root.formattedUnconfirmed = Config.formatSats(Daemon.currentWallet.unconfirmedBalance)
root.formattedFrozen = Config.formatSats(Daemon.currentWallet.frozenBalance)
root.formattedLightningBalance = Config.formatSats(Daemon.currentWallet.lightningBalance)
if (Daemon.fx.enabled) {
root.formattedBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.confirmedBalance, false)
root.formattedUnconfirmedFiat = Daemon.fx.fiatValue(Daemon.currentWallet.unconfirmedBalance, false)
root.formattedFrozenFiat = Daemon.fx.fiatValue(Daemon.currentWallet.frozenBalance, false)
root.formattedLightningBalanceFiat = Daemon.fx.fiatValue(Daemon.currentWallet.lightningBalance, false)
}
}
@ -53,14 +57,16 @@ Frame {
}
}
Label {
text: qsTr('Confirmed: ')
visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0
font.pixelSize: constants.fontSizeSmall
text: qsTr('Unconfirmed: ')
}
RowLayout {
visible: Daemon.currentWallet.unconfirmedBalance.satsInt > 0
Label {
font.pixelSize: constants.fontSizeSmall
font.family: FixedFont
text: formattedBalance
text: formattedUnconfirmed
}
Label {
font.pixelSize: constants.fontSizeSmall
@ -70,19 +76,21 @@ Frame {
Label {
font.pixelSize: constants.fontSizeSmall
text: Daemon.fx.enabled
? '(' + root.formattedBalanceFiat + ' ' + Daemon.fx.fiatCurrency + ')'
? '(' + root.formattedUnconfirmedFiat + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
}
Label {
visible: Daemon.currentWallet.frozenBalance.satsInt > 0
font.pixelSize: constants.fontSizeSmall
text: qsTr('Unconfirmed: ')
text: qsTr('Frozen: ')
}
RowLayout {
visible: Daemon.currentWallet.frozenBalance.satsInt > 0
Label {
font.pixelSize: constants.fontSizeSmall
font.family: FixedFont
text: formattedUnconfirmed
text: root.formattedFrozen
}
Label {
font.pixelSize: constants.fontSizeSmall
@ -92,7 +100,7 @@ Frame {
Label {
font.pixelSize: constants.fontSizeSmall
text: Daemon.fx.enabled
? '(' + root.formattedUnconfirmedFiat + ' ' + Daemon.fx.fiatCurrency + ')'
? '(' + root.formattedFrozenFiat + ' ' + Daemon.fx.fiatCurrency + ')'
: ''
}
}

1
electrum/gui/qml/qeaddressdetails.py

@ -93,6 +93,7 @@ class QEAddressDetails(QObject):
self._wallet.wallet.set_frozen_state_of_addresses([self._address], freeze=freeze)
self._frozen = freeze
self.frozenChanged.emit()
self._wallet.balanceChanged.emit()
@pyqtSlot(str)
def set_label(self, label: str):

4
electrum/gui/qml/qewallet.py

@ -286,7 +286,9 @@ class QEWallet(QObject):
@pyqtProperty(QEAmount, notify=balanceChanged)
def frozenBalance(self):
self._frozenbalance = QEAmount(amount_sat=self.wallet.get_frozen_balance())
c, u, x = self.wallet.get_frozen_balance()
self._logger.info('frozen balance: ' + str(c) + ' ' + str(u) + ' ' + str(x) + ' ')
self._frozenbalance = QEAmount(amount_sat=c+x)
return self._frozenbalance
@pyqtProperty(QEAmount, notify=balanceChanged)

Loading…
Cancel
Save