From 9e057e5446a9b64feabc61aa9748db7add908c98 Mon Sep 17 00:00:00 2001 From: Johann Bauer Date: Mon, 5 Feb 2018 22:11:29 +0100 Subject: [PATCH] Reset scroll position after updating list --- gui/qt/history_list.py | 4 ++-- gui/qt/util.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py index 084b527d..63a0b4b9 100644 --- a/gui/qt/history_list.py +++ b/gui/qt/history_list.py @@ -70,7 +70,6 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): @profiler def on_update(self): - # TODO save and restore scroll position (maybe based on y coord or selected item?) self.wallet = self.parent.wallet h = self.wallet.get_history(self.get_domain()) item = self.currentItem() @@ -213,4 +212,5 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): self.parent.show_error(e) else: self.wallet.save_transactions(write=True) - self.on_update() + # need to update at least: history_list, utxo_list, address_list + self.parent.need_update.set() diff --git a/gui/qt/util.py b/gui/qt/util.py index cd552e40..5dbda84a 100644 --- a/gui/qt/util.py +++ b/gui/qt/util.py @@ -478,8 +478,12 @@ class MyTreeWidget(QTreeWidget): self.pending_update = True else: self.setUpdatesEnabled(False) + scroll_pos = self.verticalScrollBar().value() self.on_update() self.setUpdatesEnabled(True) + # To paint the list before resetting the scroll position + self.parent.app.processEvents() + self.verticalScrollBar().setValue(scroll_pos) if self.current_filter: self.filter(self.current_filter)