electrum-bitcoinprivate/gui/history_widget.py

27 lines
746 B
Python
Raw Normal View History

2012-08-12 13:17:43 -07:00
from PyQt4.QtGui import *
from i18n import _
class HistoryWidget(QTreeWidget):
def __init__(self, parent=None):
QTreeWidget.__init__(self, parent)
self.setColumnCount(2)
self.setHeaderLabels([_("Amount"), _("To / From"), _("When")])
2012-08-12 13:17:43 -07:00
self.setIndentation(0)
def empty(self):
self.clear()
def append(self, address, amount, date):
2012-12-14 03:14:38 -08:00
if address is None:
address = _("Unknown")
2012-12-14 03:14:38 -08:00
if amount is None:
amount = _("Unknown")
2012-12-14 03:14:38 -08:00
if date is None:
date = _("Unknown")
item = QTreeWidgetItem([amount, address, date])
2013-01-03 21:25:29 -08:00
if float(amount) < 0:
2013-01-03 21:33:57 -08:00
item.setForeground(0, QBrush(QColor("#BC1E1E")))
2012-08-12 13:17:43 -07:00
self.insertTopLevelItem(0, item)