mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Cleanup (#1676)
* 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:
parent
5e1432ff6b
commit
52865cf284
4 changed files with 9 additions and 6 deletions
|
@ -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.
|
||||
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:
|
||||
|
||||
```powershell
|
||||
|
|
|
@ -59,7 +59,7 @@ class MediaSyncer:
|
|||
self._log_and_notify(tr.sync_media_starting())
|
||||
self._syncing = True
|
||||
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)
|
||||
|
||||
|
@ -134,7 +134,7 @@ class MediaSyncer:
|
|||
timer.stop()
|
||||
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:
|
||||
if self.is_syncing():
|
||||
|
|
|
@ -70,7 +70,7 @@ class ProgressManager:
|
|||
pass
|
||||
else:
|
||||
# retry in 100ms
|
||||
self.timer(100, func, False, requiresCollection)
|
||||
self.timer(100, func, False, requiresCollection, parent=parent)
|
||||
|
||||
t = QTimer(parent)
|
||||
if not repeat:
|
||||
|
|
|
@ -757,12 +757,15 @@ def closeTooltip() -> None:
|
|||
if _tooltipLabel:
|
||||
try:
|
||||
_tooltipLabel.deleteLater()
|
||||
except:
|
||||
except RuntimeError:
|
||||
# already deleted as parent window closed
|
||||
pass
|
||||
_tooltipLabel = None
|
||||
if _tooltipTimer:
|
||||
_tooltipTimer.stop()
|
||||
try:
|
||||
_tooltipTimer.deleteLater()
|
||||
except RuntimeError:
|
||||
pass
|
||||
_tooltipTimer = None
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue