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,11 +219,14 @@ class SidebarTreeView(QTreeView):
if not self.isVisible(): if not self.isVisible():
return return
root = self._root_tree() def on_done(fut: Future):
root = fut.result()
model = SidebarModel(root) model = SidebarModel(root)
self.setModel(model) self.setModel(model)
model.expandWhereNeccessary(self) model.expandWhereNeccessary(self)
self.mw.taskman.run_in_background(self._root_tree, on_done)
def onClickCurrent(self) -> None: def onClickCurrent(self) -> None:
idx = self.currentIndex() idx = self.currentIndex()
if idx.isValid(): if idx.isValid():