commit cc2ef02c2bd345bdca38307e0c597f4f7a4536b6
parent 871cf26d5c25945a198d45cb30769750fdf34705
Author: ThomasV <thomasv@gitorious>
Date: Thu, 15 Nov 2012 09:14:24 +0100
gui fixes
Diffstat:
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/lib/gui_qt.py b/lib/gui_qt.py
@@ -437,7 +437,12 @@ class ElectrumWindow(QMainWindow):
tx_hash = tx['tx_hash']
conf = self.wallet.verifier.get_confirmations(tx_hash)
if conf:
- time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
+ try:
+ time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
+ except:
+ time_str = "unknown"
+ if conf == -1:
+ icon = None
if conf == 0:
icon = QIcon(":icons/unconfirmed.png")
elif conf < 6:
@@ -845,13 +850,16 @@ class ElectrumWindow(QMainWindow):
label = self.wallet.labels.get(address,'')
n = 0
h = self.wallet.history.get(address,[])
- if h == ['*']: h = []
- for tx_hash, tx_height in h:
- tx = self.wallet.transactions.get(tx_hash)
- if tx: n += 1
+ if h != ['*']:
+ for tx_hash, tx_height in h:
+ tx = self.wallet.transactions.get(tx_hash)
+ if tx: n += 1
+ num_tx = "%d "%n
+ else:
+ n = -1
+ num_tx = "*"
- tx = "%d "%n
if n==0:
if address in self.wallet.addresses:
gap += 1
@@ -864,7 +872,7 @@ class ElectrumWindow(QMainWindow):
c, u = self.wallet.get_addr_balance(address)
balance = format_satoshis( c + u, False, self.wallet.num_zeros )
flags = self.wallet.get_address_flags(address)
- item = QTreeWidgetItem( [ flags, address, label, balance, tx] )
+ item = QTreeWidgetItem( [ flags, address, label, balance, num_tx] )
item.setFont(0, QFont(MONOSPACE_FONT))
item.setFont(1, QFont(MONOSPACE_FONT))
diff --git a/lib/verifier.py b/lib/verifier.py
@@ -50,7 +50,7 @@ class WalletVerifier(threading.Thread):
""" return the number of confirmations of a monitored transaction. """
with self.lock:
if tx in self.transactions.keys():
- return (self.local_height - self.verified_tx[tx] + 1) if tx in self.verified_tx else 0
+ return (self.local_height - self.verified_tx[tx] + 1) if tx in self.verified_tx else -1
else:
return 0
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -445,6 +445,7 @@ class Wallet:
for addr in domain:
h = self.history.get(addr, [])
+ if h == ['*']: continue
for tx_hash, tx_height, in h:
tx = self.transactions.get(tx_hash)
for output in tx.get('outputs'):
@@ -1071,7 +1072,7 @@ class WalletSynchronizer(threading.Thread):
hist.append( (tx_hash, item['height']) )
if len(hist) != len(result):
- raise BaseException("error: server sent history with non-unique txid")
+ raise BaseException("error: server sent history with non-unique txid", result)
# check that the status corresponds to what was announced
rs = requested_histories.pop(addr)