MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / _on_update_check_finished

Method _on_update_check_finished

deeplabcut/gui/window.py:433–485  ·  view source on GitHub ↗
(self, result)

Source from the content-addressed store, hash-verified

431 self._cleanup_update_process()
432
433 def _on_update_check_finished(self, result):
434 if self._closing:
435 return
436
437 silent = result.get("silent", True)
438 error = result.get("error")
439
440 if error is not None:
441 self.logger.debug(f"Update check failed with error: {error!r}")
442 if not silent:
443 QtWidgets.QMessageBox.warning(
444 self,
445 "Update check failed",
446 f"Could not check for updates.\n\n{error}",
447 )
448 return
449
450 is_latest = result["is_latest"]
451 latest_version = result["latest_version"]
452 is_latest_plugin = result["is_latest_plugin"]
453 latest_plugin_version = result["latest_plugin_version"]
454
455 if is_latest and is_latest_plugin:
456 if not silent:
457 QtWidgets.QMessageBox.information(
458 self,
459 "Up to date",
460 "You are using the latest version of DeepLabCut and the labeling plugin.",
461 )
462 return
463
464 parts = []
465 packages = []
466
467 if not is_latest:
468 parts.append(f"DeepLabCut {latest_version} available")
469 packages.append("deeplabcut")
470
471 if not is_latest_plugin:
472 parts.append(f"DeepLabCut labeling plugin {latest_plugin_version} available")
473 packages.append("napari-deeplabcut")
474
475 msg = QtWidgets.QMessageBox(self)
476 msg.setIcon(QtWidgets.QMessageBox.Information)
477 msg.setText("\n".join(parts))
478
479 update_btn = msg.addButton("Update", QtWidgets.QMessageBox.AcceptRole)
480 msg.addButton("Skip", QtWidgets.QMessageBox.RejectRole)
481 msg.setDefaultButton(update_btn)
482 msg.exec()
483
484 if msg.clickedButton() is update_btn:
485 self._run_update_command(packages)
486
487 def add_video_files(self, new_video_files):
488 """

Callers

nothing calls this directly

Calls 2

_run_update_commandMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected