commit c506139e686c9fd7845b3bcec3e23810aaad22d8
parent a61d1ad44bea6b9b109da243bdab5490d992cdbc
Author: Amir Taaki <genjix@riseup.net>
Date: Sun, 12 Aug 2012 21:52:28 +0100
use labels for to/from in lite history where available.
Diffstat:
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/lib/gui_lite.py b/lib/gui_lite.py
@@ -334,7 +334,7 @@ class MiniWindow(QDialog):
def update_history(self, tx_history):
for tx in tx_history[-10:]:
- address = tx["dest_address"]
+ address = tx["default_label"]
amount = D(tx["value"]) / 10**8
self.history_list.append(address, amount)
diff --git a/lib/gui_qt.py b/lib/gui_qt.py
@@ -291,7 +291,7 @@ class ElectrumWindow(QMainWindow):
l.setColumnWidth(2, 350)
l.setColumnWidth(3, 140)
l.setColumnWidth(4, 140)
- l.setHeaderLabels( [ '', _( 'Date' ), _( 'Description' ) , _('Amount'), _('Balance')] )
+ l.setHeaderLabels( [ '', _( 'Date' ), _( 'To / From' ) , _('Amount'), _('Balance')] )
self.connect(l, SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'), self.tx_label_clicked)
self.connect(l, SIGNAL('itemChanged(QTreeWidgetItem*, int)'), self.tx_label_changed)
l.setContextMenuPolicy(Qt.CustomContextMenu)
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -892,12 +892,10 @@ class Wallet:
if tx['value']<0:
for o_addr in tx['outputs']:
if not self.is_mine(o_addr):
- dest_label = self.labels.get(o_addr)
- if dest_label:
- default_label = 'to: ' + dest_label
- else:
- default_label = 'to: ' + o_addr
- dest_address = o_addr
+ try:
+ default_label = self.labels[o_addr]
+ except KeyError:
+ default_label = o_addr
else:
for o_addr in tx['outputs']:
if self.is_mine(o_addr) and not self.is_change(o_addr):
@@ -911,14 +909,12 @@ class Wallet:
if o_addr:
dest_label = self.labels.get(o_addr)
- if dest_label:
- default_label = 'at: ' + dest_label
- else:
- default_label = 'at: ' + o_addr
- dest_address = o_addr
+ try:
+ default_label = self.labels[o_addr]
+ except KeyError:
+ default_label = o_addr
tx['default_label'] = default_label
- tx['dest_address'] = dest_address
def mktx(self, to_address, amount, label, password, fee=None, change_addr=None, from_addr= None):
if not self.is_valid(to_address):