def _on_finished(self, future: Future) -> None: self._syncing = False gui_hooks.media_sync_did_start_or_stop(False) exc = future.exception() if exc is not None: self._handle_sync_error(exc) else: self._log_and_notify(tr(TR.SYNC_MEDIA_COMPLETE))
def _on_finished(self, future: Future) -> None: self._syncing = False gui_hooks.media_sync_did_start_or_stop(False) exc = future.exception() if exc is not None: self._handle_sync_error(exc) else: self._log_and_notify(tr(StringsGroup.SYNC, "media-complete"))
def _on_finished(self, future: Future) -> None: self._syncing = False if self._progress_timer: self._progress_timer.stop() self._progress_timer = None gui_hooks.media_sync_did_start_or_stop(False) exc = future.exception() if exc is not None: self._handle_sync_error(exc) else: self._log_and_notify(tr.sync_media_complete())
def start(self) -> None: "Start media syncing in the background, if it's not already running." if self._syncing: return hkey = self.mw.pm.sync_key() if hkey is None: return if not self.mw.pm.media_syncing_enabled(): self._log_and_notify(tr(TR.SYNC_MEDIA_DISABLED)) return self._log_and_notify(tr(TR.SYNC_MEDIA_STARTING)) self._syncing = True self._want_stop = False gui_hooks.media_sync_did_start_or_stop(True) def run() -> None: self.mw.col.backend.sync_media(hkey, self._endpoint()) self.mw.taskman.run_in_background(run, self._on_finished)
def start(self) -> None: "Start media syncing in the background, if it's not already running." if self._syncing: return if not self.mw.pm.media_syncing_enabled(): self._log_and_notify(tr(TR.SYNC_MEDIA_DISABLED)) return auth = self.mw.pm.sync_auth() if auth is None: return self._log_and_notify(tr(TR.SYNC_MEDIA_STARTING)) self._syncing = True self._progress_timer = self.mw.progress.timer(1000, self._on_progress, True, True) gui_hooks.media_sync_did_start_or_stop(True) def run() -> None: self.mw.col.sync_media(auth) self.mw.taskman.run_in_background(run, self._on_finished)