mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
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:
parent
31a3add848
commit
a82744a3e5
1 changed files with 7 additions and 4 deletions
|
@ -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():
|
||||||
|
|
Loading…
Reference in a new issue