1
0

small optimisations for history tab refresh (and related)

This commit is contained in:
SomberNight
2018-08-03 16:12:41 +02:00
parent 6b42e8448c
commit 7307c800d7
6 changed files with 29 additions and 18 deletions

View File

@@ -93,8 +93,9 @@ class AddressList(MyTreeWidget):
else:
addr_list = self.wallet.get_addresses()
self.clear()
fx = self.parent.fx
for address in addr_list:
num = len(self.wallet.get_address_history(address))
num = self.wallet.get_address_history_len(address)
label = self.wallet.labels.get(address, '')
c, u, x = self.wallet.get_addr_balance(address)
balance = c + u + x
@@ -106,7 +107,6 @@ class AddressList(MyTreeWidget):
if self.show_used == 3 and not is_used_and_empty:
continue
balance_text = self.parent.format_amount(balance, whitespaces=True)
fx = self.parent.fx
# create item
if fx and fx.get_fiat_address_config():
rate = fx.exchange_rate()

View File

@@ -229,6 +229,9 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
current_tx = item.data(0, Qt.UserRole) if item else None
self.clear()
if fx: fx.history_used_spot = False
blue_brush = QBrush(QColor("#1E1EFF"))
red_brush = QBrush(QColor("#BC1E1E"))
monospace_font = QFont(MONOSPACE_FONT)
for tx_item in self.transactions:
tx_hash = tx_item['txid']
height = tx_item['height']
@@ -263,12 +266,12 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
if i>3:
item.setTextAlignment(i, Qt.AlignRight | Qt.AlignVCenter)
if i!=2:
item.setFont(i, QFont(MONOSPACE_FONT))
item.setFont(i, monospace_font)
if value and value < 0:
item.setForeground(3, QBrush(QColor("#BC1E1E")))
item.setForeground(4, QBrush(QColor("#BC1E1E")))
item.setForeground(3, red_brush)
item.setForeground(4, red_brush)
if fiat_value and not tx_item['fiat_default']:
item.setForeground(6, QBrush(QColor("#1E1EFF")))
item.setForeground(6, blue_brush)
if tx_hash:
item.setData(0, Qt.UserRole, tx_hash)
self.insertTopLevelItem(0, item)