follow-up 5473320ce4: do not call get_full_history in constructor
This commit is contained in:
@@ -104,27 +104,10 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
self.end_timestamp = None
|
self.end_timestamp = None
|
||||||
self.years = []
|
self.years = []
|
||||||
self.create_toolbar_buttons()
|
self.create_toolbar_buttons()
|
||||||
|
|
||||||
self.wallet = self.parent.wallet # type: Abstract_Wallet
|
self.wallet = self.parent.wallet # type: Abstract_Wallet
|
||||||
fx = self.parent.fx
|
|
||||||
r = self.wallet.get_full_history(domain=self.get_domain(), from_timestamp=None, to_timestamp=None, fx=fx)
|
|
||||||
self.transactions.update([(x['txid'], x) for x in r['transactions']])
|
|
||||||
self.summary = r['summary']
|
|
||||||
if not self.years and self.transactions:
|
|
||||||
start_date = next(iter(self.transactions.values())).get('date') or date.today()
|
|
||||||
end_date = next(iter(reversed(self.transactions.values()))).get('date') or date.today()
|
|
||||||
self.years = [str(i) for i in range(start_date.year, end_date.year + 1)]
|
|
||||||
self.period_combo.insertItems(1, self.years)
|
|
||||||
if fx: fx.history_used_spot = False
|
|
||||||
self.refresh_headers()
|
self.refresh_headers()
|
||||||
for tx_item in self.transactions.values():
|
|
||||||
self.insert_tx(tx_item)
|
|
||||||
self.sortByColumn(0, Qt.AscendingOrder)
|
self.sortByColumn(0, Qt.AscendingOrder)
|
||||||
|
|
||||||
#def on_activated(self, idx: QModelIndex):
|
|
||||||
# # TODO use siblingAtColumn when min Qt version is >=5.11
|
|
||||||
# self.edit(idx.sibling(idx.row(), 2))
|
|
||||||
|
|
||||||
def format_date(self, d):
|
def format_date(self, d):
|
||||||
return str(datetime.date(d.year, d.month, d.day)) if d else _('None')
|
return str(datetime.date(d.year, d.month, d.day)) if d else _('None')
|
||||||
|
|
||||||
@@ -338,6 +321,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
@profiler
|
@profiler
|
||||||
def update(self):
|
def update(self):
|
||||||
fx = self.parent.fx
|
fx = self.parent.fx
|
||||||
|
if fx: fx.history_used_spot = False
|
||||||
r = self.wallet.get_full_history(domain=self.get_domain(), from_timestamp=None, to_timestamp=None, fx=fx)
|
r = self.wallet.get_full_history(domain=self.get_domain(), from_timestamp=None, to_timestamp=None, fx=fx)
|
||||||
seen = set()
|
seen = set()
|
||||||
history = fx.show_history()
|
history = fx.show_history()
|
||||||
@@ -385,6 +369,13 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
assert removed_txid == txid, (idx, removed)
|
assert removed_txid == txid, (idx, removed)
|
||||||
removed += 1
|
removed += 1
|
||||||
self.apply_filter()
|
self.apply_filter()
|
||||||
|
# update summary
|
||||||
|
self.summary = r['summary']
|
||||||
|
if not self.years and self.transactions:
|
||||||
|
start_date = next(iter(self.transactions.values())).get('date') or date.today()
|
||||||
|
end_date = next(iter(reversed(self.transactions.values()))).get('date') or date.today()
|
||||||
|
self.years = [str(i) for i in range(start_date.year, end_date.year + 1)]
|
||||||
|
self.period_combo.insertItems(1, self.years)
|
||||||
|
|
||||||
def update_fiat(self, txid, row):
|
def update_fiat(self, txid, row):
|
||||||
cap_gains = self.parent.fx.get_history_capital_gains_config()
|
cap_gains = self.parent.fx.get_history_capital_gains_config()
|
||||||
|
|||||||
Reference in New Issue
Block a user