diff --git a/electrum/gui/qml/qeconfig.py b/electrum/gui/qml/qeconfig.py index 14e9f9ba2..ebf736e1e 100644 --- a/electrum/gui/qml/qeconfig.py +++ b/electrum/gui/qml/qeconfig.py @@ -3,6 +3,7 @@ from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject from decimal import Decimal from electrum.logging import get_logger +from electrum.util import DECIMAL_POINT_DEFAULT class QEConfig(QObject): def __init__(self, config, parent=None): @@ -78,7 +79,7 @@ class QEConfig(QObject): # TODO delegate all this to config.py/util.py def decimal_point(self): - return self.config.get('decimal_point') + return self.config.get('decimal_point', DECIMAL_POINT_DEFAULT) def max_precision(self): return self.decimal_point() + 0 #self.extra_precision @@ -89,13 +90,14 @@ class QEConfig(QObject): try: x = Decimal(unitAmount) except: - return None + return 0 # scale it to max allowed precision, make it an int max_prec_amount = int(pow(10, self.max_precision()) * x) # if the max precision is simply what unit conversion allows, just return if self.max_precision() == self.decimal_point(): return max_prec_amount + self._logger.debug('fallthrough') # otherwise, scale it back to the expected unit #amount = Decimal(max_prec_amount) / Decimal(pow(10, self.max_precision()-self.decimal_point())) #return int(amount) #Decimal(amount) if not self.is_int else int(amount) - + return 0 diff --git a/electrum/gui/qml/qenetwork.py b/electrum/gui/qml/qenetwork.py index aa64e13aa..0f9ea33bc 100644 --- a/electrum/gui/qml/qenetwork.py +++ b/electrum/gui/qml/qenetwork.py @@ -23,7 +23,7 @@ class QENetwork(QObject): defaultServerChanged = pyqtSignal() proxySet = pyqtSignal() proxyChanged = pyqtSignal() - statusUpdated = pyqtSignal() + statusChanged = pyqtSignal() feeHistogramUpdated = pyqtSignal() dataChanged = pyqtSignal() # dummy to silence warnings @@ -52,12 +52,12 @@ class QENetwork(QObject): self.proxySet.emit() def on_status(self, event, *args): - self._logger.info('status updated') + self._logger.debug('status updated: %s' % self.network.connection_status) self._status = self.network.connection_status - self.statusUpdated.emit() + self.statusChanged.emit() def on_fee_histogram(self, event, *args): - self._logger.warning('fee histogram updated') + self._logger.debug('fee histogram updated') self.feeHistogramUpdated.emit() @pyqtProperty(int,notify=networkUpdated) @@ -83,7 +83,7 @@ class QENetwork(QObject): net_params = net_params._replace(server=server) self.network.run_from_another_thread(self.network.set_parameters(net_params)) - @pyqtProperty('QString',notify=statusUpdated) + @pyqtProperty('QString',notify=statusChanged) def status(self): return self._status diff --git a/electrum/gui/qml/qetransactionlistmodel.py b/electrum/gui/qml/qetransactionlistmodel.py index e95bd588e..88a44627d 100644 --- a/electrum/gui/qml/qetransactionlistmodel.py +++ b/electrum/gui/qml/qetransactionlistmodel.py @@ -13,8 +13,9 @@ class QETransactionListModel(QAbstractListModel): _logger = get_logger(__name__) # define listmodel rolemap - _ROLE_NAMES=('txid','fee_sat','height','confirmations','timestamp','monotonic_timestamp','incoming','bc_value', - 'bc_balance','date','label','txpos_in_block','fee','inputs','outputs') + _ROLE_NAMES=('txid','fee_sat','height','confirmations','timestamp','monotonic_timestamp', + 'incoming','bc_value','bc_balance','date','label','txpos_in_block','fee', + 'inputs','outputs') _ROLE_KEYS = range(Qt.UserRole + 1, Qt.UserRole + 1 + len(_ROLE_NAMES)) _ROLE_MAP = dict(zip(_ROLE_KEYS, [bytearray(x.encode()) for x in _ROLE_NAMES])) diff --git a/electrum/gui/qml/qewallet.py b/electrum/gui/qml/qewallet.py index eed5cef49..7e0a6b40e 100644 --- a/electrum/gui/qml/qewallet.py +++ b/electrum/gui/qml/qewallet.py @@ -172,7 +172,6 @@ class QEWallet(QObject): key = self.create_bitcoin_request(amount, message, expiry, ignore_gap) if not key: return - #self.address_list.update() self._addressModel.init_model() except InvoiceError as e: self.requestCreateError.emit('fatal',_('Error creating payment request') + ':\n' + str(e))