electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 270c60b3c8b26f9767446e52c053d4c3e1d61c64
parent 99f5d368e64334b7c2cb9cb1499fcd2d08e0d5b7
Author: ThomasV <thomasv@gitorious>
Date:   Tue, 11 Nov 2014 15:51:39 +0100

add status icons for invoices

Diffstat:
Mgui/qt/main_window.py | 54+++++++++++++++++++++++++++++++-----------------------
Micons.qrc | 2++
Aicons/expired.png | 0
Aicons/unpaid.png | 0
4 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -56,12 +56,6 @@ import csv -# status of payment requests -PR_UNPAID = 0 -PR_EXPIRED = 1 -PR_SENT = 2 # sent but not propagated -PR_PAID = 3 # send and propagated -PR_ERROR = 4 # could not parse from electrum import ELECTRUM_VERSION @@ -71,13 +65,6 @@ from util import MyTreeWidget, HelpButton, EnterButton, line_dialog, text_dialog from util import filename_field, ok_cancel_buttons2, address_field from util import MONOSPACE_FONT -def format_status(x): - if x == PR_UNPAID: - return _('Unpaid') - elif x == PR_PAID: - return _('Paid') - elif x == PR_EXPIRED: - return _('Expired') class StatusBarButton(QPushButton): @@ -96,15 +83,32 @@ class StatusBarButton(QPushButton): +default_column_widths = { + "history":[40,140,350,140], + "contacts":[350,330], + "receive": [370,200,130] +} +# status of payment requests +PR_UNPAID = 0 +PR_EXPIRED = 1 +PR_SENT = 2 # sent but not propagated +PR_PAID = 3 # send and propagated +PR_ERROR = 4 # could not parse +pr_icons = { + PR_UNPAID:":icons/unpaid.png", + PR_PAID:":icons/confirmed.png", + PR_EXPIRED:":icons/expired.png" +} +pr_tooltips = { + PR_UNPAID:_('Unpaid'), + PR_PAID:_('Paid'), + PR_EXPIRED:_('Expired') +} - - -default_column_widths = { "history":[40,140,350,140], "contacts":[350,330], "receive": [370,200,130] } - class ElectrumWindow(QMainWindow): labelsChanged = pyqtSignal() @@ -1350,13 +1354,14 @@ class ElectrumWindow(QMainWindow): def create_invoices_tab(self): - l, w = self.create_list_tab([_('Date'), _('Requestor'), _('Memo'), _('Amount'), _('Status')]) - l.setColumnWidth(0, 150) + l, w = self.create_list_tab([_('Status'), _('Date'), _('Requestor'), _('Memo'), _('Amount')]) + l.setColumnWidth(0, 60) l.setColumnWidth(1, 150) - l.setColumnWidth(3, 150) + l.setColumnWidth(2, 150) + l.setColumnWidth(4, 150) h = l.header() h.setStretchLastSection(False) - h.setResizeMode(2, QHeaderView.Stretch) + h.setResizeMode(3, QHeaderView.Stretch) l.setContextMenuPolicy(Qt.CustomContextMenu) l.customContextMenuRequested.connect(self.create_invoice_menu) self.invoices_list = l @@ -1371,9 +1376,12 @@ class ElectrumWindow(QMainWindow): if status == PR_UNPAID and expiration_date and expiration_date < time.time(): status = PR_EXPIRED date_str = datetime.datetime.fromtimestamp(expiration_date).isoformat(' ')[:-3] - item = QTreeWidgetItem( [ date_str, domain, memo, self.format_amount(amount, whitespaces=True), format_status(status)] ) + item = QTreeWidgetItem( [ '', date_str, domain, memo, self.format_amount(amount, whitespaces=True)] ) + icon = QIcon(pr_icons.get(status)) + item.setIcon(0, icon) + item.setToolTip(0, pr_tooltips.get(status,'')) item.setData(0, 32, key) - item.setFont(1, QFont(MONOSPACE_FONT)) + item.setFont(2, QFont(MONOSPACE_FONT)) item.setFont(3, QFont(MONOSPACE_FONT)) l.addTopLevelItem(item) l.setCurrentItem(l.topLevelItem(0)) diff --git a/icons.qrc b/icons.qrc @@ -7,6 +7,7 @@ <file>icons/clock4.png</file> <file>icons/clock5.png</file> <file>icons/confirmed.png</file> + <file>icons/expired.png</file> <file>icons/key.png</file> <file>icons/lock.png</file> <file>icons/unlock.png</file> @@ -22,6 +23,7 @@ <file>icons/electrum_light_icon.png</file> <file>icons/electrum_dark_icon.png</file> <file>icons/unconfirmed.png</file> + <file>icons/unpaid.png</file> <file>icons/network.png</file> <file>icons/dark_background.png</file> <file>icons/qrcode.png</file> diff --git a/icons/expired.png b/icons/expired.png Binary files differ. diff --git a/icons/unpaid.png b/icons/unpaid.png Binary files differ.