tMerge pull request #3851 from bauerj/update-scrollpos - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 4e19484b4aa06557085bde5dcb785dd7e4e9048e
DIR parent d9cf4c2b63ed8c6c07b26a31d322cd5e69e55ad1
HTML Author: ThomasV <thomasv@electrum.org>
Date: Tue, 6 Feb 2018 10:07:36 +0100
Merge pull request #3851 from bauerj/update-scrollpos
Reset scroll position after updating lists
Diffstat:
M gui/qt/history_list.py | 4 ++--
M gui/qt/util.py | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
---
DIR diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py
t@@ -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()
t@@ -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()
DIR diff --git a/gui/qt/util.py b/gui/qt/util.py
t@@ -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)