mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 09:16:38 -04:00
QueryOp() was attempting to open progress window on background thread
This commit is contained in:
parent
936323e430
commit
42455eca64
1 changed files with 11 additions and 2 deletions
|
@ -176,7 +176,11 @@ class QueryOp(Generic[T]):
|
||||||
self._failure = failure
|
self._failure = failure
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def with_progress(self, label: str | None = None) -> QueryOp[T]:
|
def with_progress(
|
||||||
|
self,
|
||||||
|
label: str | None = None,
|
||||||
|
) -> QueryOp[T]:
|
||||||
|
"If label not provided, will default to 'Processing...'"
|
||||||
self._progress = label or True
|
self._progress = label or True
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -195,7 +199,12 @@ class QueryOp(Generic[T]):
|
||||||
label = self._progress
|
label = self._progress
|
||||||
else:
|
else:
|
||||||
label = None
|
label = None
|
||||||
mw.progress.start(label=label)
|
|
||||||
|
def start_progress() -> None:
|
||||||
|
assert mw
|
||||||
|
mw.progress.start(label=label)
|
||||||
|
|
||||||
|
mw.taskman.run_on_main(start_progress)
|
||||||
return self._op(mw.col)
|
return self._op(mw.col)
|
||||||
|
|
||||||
def wrapped_done(future: Future) -> None:
|
def wrapped_done(future: Future) -> None:
|
||||||
|
|
Loading…
Reference in a new issue