progress bar tweaks
This commit is contained in:
parent
42302b070e
commit
87ca8e39a8
@ -194,6 +194,8 @@ class ProgressDialog(QDialog):
|
||||
self.form.setupUi(self)
|
||||
self._closingDown = False
|
||||
self.wantCancel = False
|
||||
# required for smooth progress bars
|
||||
self.form.progressBar.setStyleSheet("QProgressBar::chunk { width: 1px; }")
|
||||
|
||||
def cancel(self):
|
||||
self._closingDown = True
|
||||
|
@ -54,7 +54,14 @@ def sync(mw: aqt.main.AnkiQt) -> None:
|
||||
|
||||
def on_done(fut):
|
||||
mw.col.db.begin()
|
||||
out: SyncOutput = fut.result()
|
||||
try:
|
||||
out: SyncOutput = fut.result()
|
||||
except InterruptedError:
|
||||
return
|
||||
except Exception as e:
|
||||
showWarning(str(e))
|
||||
return
|
||||
|
||||
mw.pm.set_host_number(out.host_number)
|
||||
if out.required == out.NO_CHANGES:
|
||||
# all done
|
||||
@ -101,8 +108,8 @@ def on_full_sync_timer(mw: aqt.main.AnkiQt) -> None:
|
||||
if progress.kind != ProgressKind.FullSync:
|
||||
return
|
||||
|
||||
assert isinstance(progress, FullSyncProgress)
|
||||
mw.progress.update(value=progress.val.transferred, max=progress.val.total)
|
||||
assert isinstance(progress.val, FullSyncProgress)
|
||||
mw.progress.update(value=progress.val.transferred, max=progress.val.total, process=False)
|
||||
|
||||
if mw.progress.want_cancel():
|
||||
mw.col.backend.abort_sync()
|
||||
|
Loading…
Reference in New Issue
Block a user