Browse Source

fiat and balance amount fixes

patch-4
Sander van Grieken 3 years ago
parent
commit
7cd0d752a2
  1. 4
      electrum/gui/qml/components/Receive.qml
  2. 4
      electrum/gui/qml/components/Send.qml
  3. 4
      electrum/gui/qml/qefx.py
  4. 16
      electrum/gui/qml/qewallet.py

4
electrum/gui/qml/components/Receive.qml

@ -253,7 +253,9 @@ Pane {
Connections { Connections {
target: Daemon.fx target: Daemon.fx
function onQuotesUpdated() { function onQuotesUpdated() {
amountFiat.text = Daemon.fx.fiatValue(Config.unitsToSats(amount.text)) amountFiat.text = amount.text == ''
? ''
: Daemon.fx.fiatValue(Config.unitsToSats(amount.text))
} }
} }

4
electrum/gui/qml/components/Send.qml

@ -268,7 +268,9 @@ Pane {
Connections { Connections {
target: Daemon.fx target: Daemon.fx
function onQuotesUpdated() { function onQuotesUpdated() {
amountFiat.text = Daemon.fx.fiatValue(Config.unitsToSats(amount.text)) amountFiat.text = amount.text == ''
? ''
: Daemon.fx.fiatValue(Config.unitsToSats(amount.text))
} }
} }

4
electrum/gui/qml/qefx.py

@ -99,8 +99,6 @@ class QEFX(QObject):
else: else:
try: try:
sd = Decimal(satoshis) sd = Decimal(satoshis)
#if sd == 0:
#return ''
except: except:
return '' return ''
if plain: if plain:
@ -118,8 +116,6 @@ class QEFX(QObject):
else: else:
try: try:
sd = Decimal(satoshis) sd = Decimal(satoshis)
if sd == 0:
return ''
except: except:
return '' return ''

16
electrum/gui/qml/qewallet.py

@ -225,20 +225,22 @@ class QEWallet(QObject):
balanceChanged = pyqtSignal() balanceChanged = pyqtSignal()
@pyqtProperty('quint64', notify=balanceChanged) @pyqtProperty(QEAmount, notify=balanceChanged)
def frozenBalance(self): 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): 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): def confirmedBalance(self):
c, u, x = self.wallet.get_balance() c, u, x = self.wallet.get_balance()
self._logger.info('balance: ' + str(c) + ' ' + str(u) + ' ' + str(x) + ' ') self._logger.info('balance: ' + str(c) + ' ' + str(u) + ' ' + str(x) + ' ')
self._confirmedbalance = QEAmount(amount_sat=c+x)
return c+x return self._confirmedbalance
@pyqtSlot('QString', int, int, bool) @pyqtSlot('QString', int, int, bool)
def send_onchain(self, address, amount, fee=None, rbf=False): def send_onchain(self, address, amount, fee=None, rbf=False):

Loading…
Cancel
Save