Skip to content

Fix hardcoded GUI icon path - #3200

Merged
C-Achard merged 3 commits into
mainfrom
jaap/fix_gui_icon_not_found
Feb 13, 2026
Merged

Fix hardcoded GUI icon path#3200
C-Achard merged 3 commits into
mainfrom
jaap/fix_gui_icon_not_found

Conversation

@deruyter92

Copy link
Copy Markdown
Collaborator

This PR addresses a small issue regarding the scaling of the GUI icon pixmap in window.py.

The hardcoded path:

pixmap = QPixmap(f"deeplabcut/gui/media/dlc-{engine}.png")

fails when the GUI is launched from any directory other than the project root, causing QPixmap to return a null pixmap. When scaled() is then called on this null pixmap, Qt raises an error.

This is now fixed by using a relative path and a null-check for the pixmap.

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.
@deruyter92
deruyter92 requested a review from C-Achard February 6, 2026 08:58
@deruyter92
deruyter92 marked this pull request as ready for review February 6, 2026 08:59
@C-Achard

C-Achard commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator

Could we use importlib.resources ? I think it is more standard/robust but otherwise this is fine

@C-Achard C-Achard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be best moving forward, lmk @deruyter92

Comment thread deeplabcut/gui/window.py Outdated
deruyter92 and others added 2 commits February 6, 2026 13:55
Co-authored-by: Cyril Achard <cyril.achard@alumni.epfl.ch>
@C-Achard C-Achard added the GUI issues relating to GUI label Feb 6, 2026
@C-Achard
C-Achard merged commit 2deeab4 into main Feb 13, 2026
19 of 20 checks passed
@C-Achard
C-Achard deleted the jaap/fix_gui_icon_not_found branch February 13, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI issues relating to GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants