1
0

rework exchange_rate hooks

This commit is contained in:
ThomasV
2015-09-05 09:11:48 +02:00
parent 0ef7320d7d
commit 015e274dab
3 changed files with 20 additions and 26 deletions

View File

@@ -28,7 +28,9 @@ from electrum.plugins import run_hook
class HistoryWidget(MyTreeWidget):
def __init__(self, parent=None):
MyTreeWidget.__init__(self, parent, self.create_menu, ['', '', _('Date'), _('Description') , _('Amount'), _('Balance')], 3)
headers = ['', '', _('Date'), _('Description') , _('Amount'), _('Balance')]
run_hook('history_tab_headers', headers)
MyTreeWidget.__init__(self, parent, self.create_menu, headers, 3)
self.setColumnHidden(1, True)
self.config = self.parent.config
self.setSortingEnabled(False)
@@ -63,11 +65,12 @@ class HistoryWidget(MyTreeWidget):
v_str = self.parent.format_amount(value, True, whitespaces=True)
balance_str = self.parent.format_amount(balance, whitespaces=True)
label, is_default_label = self.wallet.get_label(tx_hash)
item = EditableItem(['', tx_hash, time_str, label, v_str, balance_str])
entry = ['', tx_hash, time_str, label, v_str, balance_str]
run_hook('history_tab_update', tx, entry)
item = EditableItem(entry)
item.setIcon(0, icon)
item.setFont(3, QFont(MONOSPACE_FONT))
item.setFont(4, QFont(MONOSPACE_FONT))
item.setFont(5, QFont(MONOSPACE_FONT))
for i in range(len(entry)):
item.setFont(i, QFont(MONOSPACE_FONT))
if value < 0:
item.setForeground(4, QBrush(QColor("#BC1E1E")))
if tx_hash:
@@ -78,7 +81,6 @@ class HistoryWidget(MyTreeWidget):
if current_tx == tx_hash:
self.setCurrentItem(item)
entries.append((item, tx))
run_hook('history_tab_update', self.parent, entries)
def update_item(self, tx_hash, conf, timestamp):
icon, time_str = self.get_icon(conf, timestamp)