Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions deeplabcut/gui/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from deeplabcut.gui import BASE_DIR, components, utils
from deeplabcut.gui.tabs import *
from deeplabcut.gui.widgets import StreamReceiver, StreamWriter
from napari_deeplabcut import misc
from PySide6.QtWidgets import QMessageBox, QMenu, QWidget, QMainWindow
from PySide6 import QtCore
from PySide6.QtGui import QIcon, QAction
Expand All @@ -31,9 +32,25 @@

def _check_for_updates():
is_latest, latest_version = utils.is_latest_deeplabcut_version()
if not is_latest:
is_latest_plugin, latest_plugin_version = misc.is_latest_version()
if is_latest and is_latest_plugin:
msg = QtWidgets.QMessageBox(
text=f"DeepLabCut {latest_version} available",
text=f"DeepLabCut is up-to-date",
)
msg.exec_()
else:
if not is_latest and is_latest_plugin:
text = f"DeepLabCut {latest_version} available"
command = "pip", "install", "-U", "deeplabcut"
elif not is_latest_plugin and is_latest:
text = f"DeepLabCut labeling plugin {latest_plugin_version} available"
command = "pip", "install", "-U", "napari-deeplabcut"
else:
text = f"DeepLabCut {latest_version}\nand labeling plugin {latest_plugin_version} available"
command = "pip", "install", "-U", "deeplabcut", "napari-deeplabcut"

msg = QtWidgets.QMessageBox(
text=text,
)
msg.setIcon(QtWidgets.QMessageBox.Information)
update_btn = msg.addButton("Update", msg.AcceptRole)
Expand All @@ -42,13 +59,8 @@ def _check_for_updates():
msg.exec_()
if msg.clickedButton() is update_btn:
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "-U", "deeplabcut"]
[sys.executable, "-m", *command]
)
else:
msg = QtWidgets.QMessageBox(
text=f"DeepLabCut is up-to-date",
)
msg.exec_()


class MainWindow(QMainWindow):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"gui": [
"pyside6<6.3.2",
"qdarkstyle==3.1",
"napari-deeplabcut>=0.2",
"napari-deeplabcut>=0.2.1.2",
],
"openvino": ["openvino-dev==2022.1.0"],
"docs": ["numpydoc"],
Expand Down