commit 9110c0542c40e00604a3d86eaf71e1646a9365d4
parent 826cf467d8638b0e1d17150815738ecb5ffc6c36
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 19 Feb 2018 14:16:11 +0100
follow-up previous commit
Diffstat:
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py
@@ -163,10 +163,14 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
d.setMinimumSize(600, 150)
vbox = QVBoxLayout()
grid = QGridLayout()
+ start_date = h.get('start_date')
+ end_date = h.get('end_date')
+ if start_date is None and end_date is None:
+ return
grid.addWidget(QLabel(_("Start")), 0, 0)
- grid.addWidget(QLabel(h.get('start_date').isoformat(' ')), 0, 1)
+ grid.addWidget(QLabel(start_date.isoformat(' ')), 0, 1)
grid.addWidget(QLabel(_("End")), 1, 0)
- grid.addWidget(QLabel(h.get('end_date').isoformat(' ')), 1, 1)
+ grid.addWidget(QLabel(end_date.isoformat(' ')), 1, 1)
grid.addWidget(QLabel(_("Initial balance")), 2, 0)
grid.addWidget(QLabel(format_amount(h['start_balance'].value)), 2, 1)
grid.addWidget(QLabel(str(h.get('start_fiat_balance'))), 2, 2)
@@ -199,8 +203,11 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
self.transactions = r['transactions']
self.summary = r['summary']
if not self.years and self.start_timestamp is None and self.end_timestamp is None:
- self.years = [str(i) for i in range(self.summary['start_date'].year, self.summary['end_date'].year + 1)]
- self.period_combo.insertItems(1, self.years)
+ start_date = self.summary['start_date']
+ end_date = self.summary['end_date']
+ if start_date and end_date:
+ self.years = [str(i) for i in range(start_date.year, end_date.year + 1)]
+ self.period_combo.insertItems(1, self.years)
item = self.currentItem()
current_tx = item.data(0, Qt.UserRole) if item else None
self.clear()
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -952,6 +952,9 @@ class Abstract_Wallet(PrintError):
from .util import timestamp_to_datetime, Satoshis, Fiat
out = []
init_balance = None
+ init_timestamp = None
+ end_balance = None
+ end_timestamp = None
end_balance = 0
capital_gains = 0
fiat_income = 0