* Pass parents to timer() in mediasync.py

* Fix typo

* Fix deleted widget in `closeTooltip()`

* Pass parent in recursive `progress.timer()`
This commit is contained in:
RumovZ 2022-02-22 11:09:43 +01:00 committed by GitHub
parent 5e1432ff6b
commit 52865cf284
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View file

@ -94,7 +94,7 @@ the path, and Bazel will be configured to output build products into
However, this will not work in PowerShell, as .bat files are executed in a subprocess. However, this will not work in PowerShell, as .bat files are executed in a subprocess.
To invoke bazel scripts, you will have to adjust your session path manually. To invoke bazel scripts, you will have to adjust your session path manually.
One option is to create a script that sets up your Anki develop environment for you. One option is to create a script that sets up your Anki development environment for you.
Here is an example: Here is an example:
```powershell ```powershell

View file

@ -59,7 +59,7 @@ class MediaSyncer:
self._log_and_notify(tr.sync_media_starting()) self._log_and_notify(tr.sync_media_starting())
self._syncing = True self._syncing = True
self._progress_timer = self.mw.progress.timer( self._progress_timer = self.mw.progress.timer(
1000, self._on_progress, True, True 1000, self._on_progress, True, True, parent=self.mw
) )
gui_hooks.media_sync_did_start_or_stop(True) gui_hooks.media_sync_did_start_or_stop(True)
@ -134,7 +134,7 @@ class MediaSyncer:
timer.stop() timer.stop()
on_finished() on_finished()
timer = self.mw.progress.timer(150, check_finished, True, False) timer = self.mw.progress.timer(150, check_finished, True, False, parent=self.mw)
def seconds_since_last_sync(self) -> int: def seconds_since_last_sync(self) -> int:
if self.is_syncing(): if self.is_syncing():

View file

@ -70,7 +70,7 @@ class ProgressManager:
pass pass
else: else:
# retry in 100ms # retry in 100ms
self.timer(100, func, False, requiresCollection) self.timer(100, func, False, requiresCollection, parent=parent)
t = QTimer(parent) t = QTimer(parent)
if not repeat: if not repeat:

View file

@ -757,12 +757,15 @@ def closeTooltip() -> None:
if _tooltipLabel: if _tooltipLabel:
try: try:
_tooltipLabel.deleteLater() _tooltipLabel.deleteLater()
except: except RuntimeError:
# already deleted as parent window closed # already deleted as parent window closed
pass pass
_tooltipLabel = None _tooltipLabel = None
if _tooltipTimer: if _tooltipTimer:
_tooltipTimer.stop() try:
_tooltipTimer.deleteLater()
except RuntimeError:
pass
_tooltipTimer = None _tooltipTimer = None