Browse Source

qml: handle unsigned, local tx in history

patch-4
Sander van Grieken 2 years ago
parent
commit
46641e7874
  1. 6
      electrum/gui/qml/components/controls/HistoryItemDelegate.qml
  2. 11
      electrum/gui/qml/qetransactionlistmodel.py

6
electrum/gui/qml/components/controls/HistoryItemDelegate.qml

@ -59,7 +59,11 @@ Item {
Layout.preferredHeight: constants.iconSizeLarge
Layout.alignment: Qt.AlignVCenter
Layout.rowSpan: 2
source: model.lightning ? "../../../icons/lightning.png" : tx_icons[Math.min(6,model.confirmations)]
source: model.lightning
? "../../../icons/lightning.png"
: model.complete
? tx_icons[Math.min(6,model.confirmations)]
: '../../../icons/offline_tx.png'
}
Label {

11
electrum/gui/qml/qetransactionlistmodel.py

@ -21,7 +21,7 @@ class QETransactionListModel(QAbstractListModel):
# define listmodel rolemap
_ROLE_NAMES=('txid','fee_sat','height','confirmations','timestamp','monotonic_timestamp',
'incoming','value','balance','date','label','txpos_in_block','fee',
'inputs','outputs','section','type','lightning','payment_hash','key')
'inputs','outputs','section','type','lightning','payment_hash','key','complete')
_ROLE_KEYS = range(Qt.UserRole, Qt.UserRole + len(_ROLE_NAMES))
_ROLE_MAP = dict(zip(_ROLE_KEYS, [bytearray(x.encode()) for x in _ROLE_NAMES]))
_ROLE_RMAP = dict(zip(_ROLE_NAMES, _ROLE_KEYS))
@ -54,7 +54,7 @@ class QETransactionListModel(QAbstractListModel):
self.endResetModel()
def tx_to_model(self, tx):
#self._logger.debug(str(tx))
self._logger.debug(str(tx))
item = tx
item['key'] = item['txid'] if 'txid' in item else item['payment_hash']
@ -92,6 +92,13 @@ class QETransactionListModel(QAbstractListModel):
item['section'] = 'older'
item['date'] = self.format_date_by_section(item['section'], datetime.fromtimestamp(item['timestamp']))
if 'txid' in item:
tx = self.wallet.get_input_tx(item['txid'])
item['complete'] = tx.is_complete()
#else:
#item['complete'] = True
return item
def format_date_by_section(self, section, date):

Loading…
Cancel
Save