Browse Source

Reset scroll position after updating list

3.1
Johann Bauer 7 years ago
parent
commit
9e057e5446
  1. 4
      gui/qt/history_list.py
  2. 4
      gui/qt/util.py

4
gui/qt/history_list.py

@ -70,7 +70,6 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
@profiler @profiler
def on_update(self): def on_update(self):
# TODO save and restore scroll position (maybe based on y coord or selected item?)
self.wallet = self.parent.wallet self.wallet = self.parent.wallet
h = self.wallet.get_history(self.get_domain()) h = self.wallet.get_history(self.get_domain())
item = self.currentItem() item = self.currentItem()
@ -213,4 +212,5 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
self.parent.show_error(e) self.parent.show_error(e)
else: else:
self.wallet.save_transactions(write=True) 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()

4
gui/qt/util.py

@ -478,8 +478,12 @@ class MyTreeWidget(QTreeWidget):
self.pending_update = True self.pending_update = True
else: else:
self.setUpdatesEnabled(False) self.setUpdatesEnabled(False)
scroll_pos = self.verticalScrollBar().value()
self.on_update() self.on_update()
self.setUpdatesEnabled(True) 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: if self.current_filter:
self.filter(self.current_filter) self.filter(self.current_filter)

Loading…
Cancel
Save