From 7cd0d752a2d4c5bb1aa75158a9b6c77f713133df Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Thu, 5 May 2022 08:55:50 +0200 Subject: [PATCH] fiat and balance amount fixes --- electrum/gui/qml/components/Receive.qml | 4 +++- electrum/gui/qml/components/Send.qml | 4 +++- electrum/gui/qml/qefx.py | 4 ---- electrum/gui/qml/qewallet.py | 16 +++++++++------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/electrum/gui/qml/components/Receive.qml b/electrum/gui/qml/components/Receive.qml index 4703b3373..b04a89f5f 100644 --- a/electrum/gui/qml/components/Receive.qml +++ b/electrum/gui/qml/components/Receive.qml @@ -253,7 +253,9 @@ Pane { Connections { target: Daemon.fx function onQuotesUpdated() { - amountFiat.text = Daemon.fx.fiatValue(Config.unitsToSats(amount.text)) + amountFiat.text = amount.text == '' + ? '' + : Daemon.fx.fiatValue(Config.unitsToSats(amount.text)) } } diff --git a/electrum/gui/qml/components/Send.qml b/electrum/gui/qml/components/Send.qml index c3ab6cfdc..55de55518 100644 --- a/electrum/gui/qml/components/Send.qml +++ b/electrum/gui/qml/components/Send.qml @@ -268,7 +268,9 @@ Pane { Connections { target: Daemon.fx function onQuotesUpdated() { - amountFiat.text = Daemon.fx.fiatValue(Config.unitsToSats(amount.text)) + amountFiat.text = amount.text == '' + ? '' + : Daemon.fx.fiatValue(Config.unitsToSats(amount.text)) } } diff --git a/electrum/gui/qml/qefx.py b/electrum/gui/qml/qefx.py index 2102a2cdd..2de44e567 100644 --- a/electrum/gui/qml/qefx.py +++ b/electrum/gui/qml/qefx.py @@ -99,8 +99,6 @@ class QEFX(QObject): else: try: sd = Decimal(satoshis) - #if sd == 0: - #return '' except: return '' if plain: @@ -118,8 +116,6 @@ class QEFX(QObject): else: try: sd = Decimal(satoshis) - if sd == 0: - return '' except: return '' diff --git a/electrum/gui/qml/qewallet.py b/electrum/gui/qml/qewallet.py index 2b499d97d..2aa2a7007 100644 --- a/electrum/gui/qml/qewallet.py +++ b/electrum/gui/qml/qewallet.py @@ -225,20 +225,22 @@ class QEWallet(QObject): balanceChanged = pyqtSignal() - @pyqtProperty('quint64', notify=balanceChanged) + @pyqtProperty(QEAmount, notify=balanceChanged) def frozenBalance(self): - return self.wallet.get_frozen_balance() + self._frozenbalance = QEAmount(amount_sat=self.wallet.get_frozen_balance()) + return self._frozenbalance - @pyqtProperty('quint64', notify=balanceChanged) + @pyqtProperty(QEAmount, notify=balanceChanged) def unconfirmedBalance(self): - return self.wallet.get_balance()[1] + self._unconfirmedbalance = QEAmount(amount_sat=self.wallet.get_balance()[1]) + return self._unconfirmedbalance - @pyqtProperty('quint64', notify=balanceChanged) + @pyqtProperty(QEAmount, notify=balanceChanged) def confirmedBalance(self): c, u, x = self.wallet.get_balance() self._logger.info('balance: ' + str(c) + ' ' + str(u) + ' ' + str(x) + ' ') - - return c+x + self._confirmedbalance = QEAmount(amount_sat=c+x) + return self._confirmedbalance @pyqtSlot('QString', int, int, bool) def send_onchain(self, address, amount, fee=None, rbf=False):