load sidebar in background

Allows the UI to repaint during processing, but will still block
DB operations until the call completes.
This commit is contained in:
Damien Elmes 2021-01-26 09:02:08 +10:00
parent 31a3add848
commit a82744a3e5

View File

@ -219,10 +219,13 @@ class SidebarTreeView(QTreeView):
if not self.isVisible():
return
root = self._root_tree()
model = SidebarModel(root)
self.setModel(model)
model.expandWhereNeccessary(self)
def on_done(fut: Future):
root = fut.result()
model = SidebarModel(root)
self.setModel(model)
model.expandWhereNeccessary(self)
self.mw.taskman.run_in_background(self._root_tree, on_done)
def onClickCurrent(self) -> None:
idx = self.currentIndex()