From 36fabc608f5de0d7b35759069b537422f3643b94 Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Fri, 6 Feb 2026 09:14:09 +0100 Subject: [PATCH 1/3] Fix GUI icon relative path Before, when an absolute path was used, this resulted in a crash when loading GUI from a different directory. (Rescaling the icon when it is null). This is fixed by making the path relative and also adding a null-check. --- deeplabcut/gui/window.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deeplabcut/gui/window.py b/deeplabcut/gui/window.py index 0f29cc3577..7f93a8106c 100644 --- a/deeplabcut/gui/window.py +++ b/deeplabcut/gui/window.py @@ -517,10 +517,11 @@ def create_toolbar(self): engine_icon.setStyleSheet("background: transparent;") def _update_icon(engine: str): - pixmap = QPixmap(f"deeplabcut/gui/media/dlc-{engine}.png") - engine_icon.setPixmap( - pixmap.scaled(56, 56, Qt.AspectRatioMode.KeepAspectRatio) - ) + pixmap = QPixmap(os.path.join(BASE_DIR, "media", f"dlc-{engine}.png")) + if not pixmap.isNull(): + engine_icon.setPixmap( + pixmap.scaled(56, 56, Qt.AspectRatioMode.KeepAspectRatio) + ) _update_icon("pt" if self.engine == Engine.PYTORCH else "tf") From b41a361c0638388ebbd1cadf6222cff92d8baa36 Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com> Date: Fri, 6 Feb 2026 13:55:20 +0100 Subject: [PATCH 2/3] Update deeplabcut/gui/window.py Co-authored-by: Cyril Achard --- deeplabcut/gui/window.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/deeplabcut/gui/window.py b/deeplabcut/gui/window.py index 7f93a8106c..2e0ba2009d 100644 --- a/deeplabcut/gui/window.py +++ b/deeplabcut/gui/window.py @@ -517,7 +517,17 @@ def create_toolbar(self): engine_icon.setStyleSheet("background: transparent;") def _update_icon(engine: str): - pixmap = QPixmap(os.path.join(BASE_DIR, "media", f"dlc-{engine}.png")) + +from importlib.resources import files + +def _update_icon(engine): + file = files("deeplabcut.gui.media") / f"dlc-{engine}.png" + pixmap = QPixmap(str(file)) + if not pixmap.isNull(): + engine_icon.setPixmap( + pixmap.scaled(56, 56, Qt.AspectRatioMode.KeepAspectRatio) + ) + if not pixmap.isNull(): engine_icon.setPixmap( pixmap.scaled(56, 56, Qt.AspectRatioMode.KeepAspectRatio) From e6e952421e6434a6cb9bdba0afbcd5014d7cefa9 Mon Sep 17 00:00:00 2001 From: Jaap de Ruyter Date: Fri, 6 Feb 2026 14:03:48 +0100 Subject: [PATCH 3/3] fix autocommit suggestion (indentation) --- deeplabcut/gui/window.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/deeplabcut/gui/window.py b/deeplabcut/gui/window.py index 2e0ba2009d..c91d6050f6 100644 --- a/deeplabcut/gui/window.py +++ b/deeplabcut/gui/window.py @@ -18,6 +18,7 @@ from urllib.error import URLError import warnings import qdarkstyle +from importlib.resources import files import deeplabcut from deeplabcut import auxiliaryfunctions, VERSION, compat @@ -517,17 +518,8 @@ def create_toolbar(self): engine_icon.setStyleSheet("background: transparent;") def _update_icon(engine: str): - -from importlib.resources import files - -def _update_icon(engine): - file = files("deeplabcut.gui.media") / f"dlc-{engine}.png" - pixmap = QPixmap(str(file)) - if not pixmap.isNull(): - engine_icon.setPixmap( - pixmap.scaled(56, 56, Qt.AspectRatioMode.KeepAspectRatio) - ) - + file = files("deeplabcut.gui.media") / f"dlc-{engine}.png" + pixmap = QPixmap(str(file)) if not pixmap.isNull(): engine_icon.setPixmap( pixmap.scaled(56, 56, Qt.AspectRatioMode.KeepAspectRatio)