Browse Source

qt history list: optimise update_item (tx mined status)

master
SomberNight 7 years ago
parent
commit
696db310a5
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 11
      electrum/gui/qt/history_list.py
  2. 4
      electrum/gui/qt/main_window.py

11
electrum/gui/qt/history_list.py

@ -247,8 +247,15 @@ class HistoryModel(QAbstractItemModel, PrintError):
tx_item.update(fiat_fields) tx_item.update(fiat_fields)
self.dataChanged.emit(idx, idx, [Qt.DisplayRole, Qt.ForegroundRole]) self.dataChanged.emit(idx, idx, [Qt.DisplayRole, Qt.ForegroundRole])
def update_item(self, *args): def update_tx_mined_status(self, tx_hash: str, tx_mined_info: TxMinedInfo):
self.refresh('update_item') self.tx_status_cache[tx_hash] = self.parent.wallet.get_tx_status(tx_hash, tx_mined_info)
try:
row = self.transactions.pos_from_key(tx_hash)
except KeyError:
return
topLeft = self.createIndex(row, 0)
bottomRight = self.createIndex(row, self.NUM_COLUMNS-1)
self.dataChanged.emit(topLeft, bottomRight)
def headerData(self, section: int, orientation: Qt.Orientation, role: Qt.ItemDataRole): def headerData(self, section: int, orientation: Qt.Orientation, role: Qt.ItemDataRole):
assert orientation == Qt.Horizontal assert orientation == Qt.Horizontal

4
electrum/gui/qt/main_window.py

@ -346,8 +346,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.console.showMessage(args[0]) self.console.showMessage(args[0])
elif event == 'verified': elif event == 'verified':
wallet, tx_hash, tx_mined_status = args wallet, tx_hash, tx_mined_status = args
if wallet == self.wallet and wallet.up_to_date: if wallet == self.wallet:
self.history_model.update_item(tx_hash, tx_mined_status) self.history_model.update_tx_mined_status(tx_hash, tx_mined_status)
elif event == 'fee': elif event == 'fee':
if self.config.is_dynfee(): if self.config.is_dynfee():
self.fee_slider.update() self.fee_slider.update()

Loading…
Cancel
Save