Pass fields of ProgressUpdate explicitly

This commit is contained in:
RumovZ 2022-04-30 08:54:17 +02:00
parent 1ffcc5321c
commit b002c45848

View file

@ -3,7 +3,7 @@
from __future__ import annotations from __future__ import annotations
import time import time
from dataclasses import asdict, dataclass from dataclasses import dataclass
import aqt.forms import aqt.forms
from anki._legacy import print_deprecation_warning from anki._legacy import print_deprecation_warning
@ -190,7 +190,7 @@ class ProgressManager:
return return
if dialog and dialog.wantCancel: if dialog and dialog.wantCancel:
self.mw.backend.set_wants_abort() self.mw.backend.set_wants_abort()
self.update(**asdict(update)) self.update(label=update.label, value=update.value, max=update.max)
qconnect(self._backend_timer.timeout, on_progress) qconnect(self._backend_timer.timeout, on_progress)
self._backend_timer.start() self._backend_timer.start()
@ -333,6 +333,4 @@ class ProgressDialog(QDialog):
class ProgressUpdate: class ProgressUpdate:
label: str | None = None label: str | None = None
value: int | None = None value: int | None = None
process: bool = True
maybeShow: bool = True
max: int | None = None max: int | None = None