Fix PySide6 stylesheet usage - #3371
Merged
Merged
Conversation
…h Path(..).absolute()
deruyter92
force-pushed
the
cy/update-gui-assets-imports
branch
from
June 25, 2026 15:33
44ba095 to
c8ca7e0
Compare
Base automatically changed from
cy/update-gui-assets-imports
to
jaap/pathlib_path_policy
June 25, 2026 15:35
Update `test_auxiliaryfunctions.py` to assert `project_path` as a `pathlib.Path` instead of a string. The tests now cast to `str` only for the `"Volume{"` check, use `.exists()` for filesystem validation, and compare against `project_dir.absolute()` directly.
…ise `safe_resolve()`
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Introduce deeplabcut.gui.gui_assets module providing utilities to load bundled GUI assets. It locates the package assets directory via importlib.resources, and exposes resource_bytes, resource_text, get_assets_dir, get_style_qss, pixmap_from_resource and icon_from_resource helpers (using PySide6 QPixmap/QIcon). Includes error handling when image data cannot be loaded and uses type annotations for clarity.
Replace direct filesystem asset loading (BASE_DIR/assets and manual Path lookups) with centralized gui_assets helpers (icon_from_resource, pixmap_from_resource, get_style_qss/get_assets_dir) across multiple GUI modules. Updated imports and calls in components, launch_script, create_project, modelzoo, open_project, train_network, and window to use the new resource functions and remove redundant logo path handling, improving resource access and packaging robustness.
Load the GUI stylesheet via get_style_qss (from gui_assets) instead of reading BASE_DIR/style.qss, and switch qdarkstyle to the PySide6 loader. Also adjust pyproject.toml to declare qdarkstyle for non-Linux x86_64 platforms and pin qdarkstyle==3.1 only for Linux x86_64 (matching the conditional pyside6 pin). This centralizes style handling in gui_assets and aligns the qdarkstyle loader and dependency constraints with PySide6 usage.
Add logging and a try/except around qdarkstyle.load_stylesheet_pyside6() to catch failures and fall back to load_stylesheet_pyside2(). This prevents the app from crashing if the PySide6 stylesheet cannot be loaded and logs a warning with the exception details.
C-Achard
force-pushed
the
cy/fix-pyside6-theme
branch
from
July 16, 2026 13:46
2cd803e to
4dec33a
Compare
C-Achard
marked this pull request as ready for review
July 16, 2026 13:47
Cleaned up minor style issues by removing unused `os` imports in GUI tab modules and deleting an extra blank line in `video_processor.py`. This reduces lint noise and keeps the codebase consistent.
deruyter92
approved these changes
Jul 16, 2026
Co-authored-by: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com>
Collaborator
|
Resolved conflicts. Ready to merge!! Note will likely conflict with #3370, but I can handle it if that occurs. |
MMathisLab
approved these changes
Jul 17, 2026
AlexEMG
approved these changes
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The GUI was still using a pyside2-only stylesheet rather than the updated PySide6 one.
The qdarkstyle version was also not dynamically resolved based on OS (unlike PySide6 itself), leading to potential inconsistencies.
This PR updates the dependencies and stylesheet usage to address this.
Note
I would suggest merging #3350 and #3370 together first, and once the pathlib overhaul is over, merge this into main instead, as it may not belong directly in the pathlib-related work.
Automated summary
This pull request updates how the application's dark mode stylesheet is loaded and improves platform compatibility for dependencies. The main changes are focused on improving stylesheet loading logic in the GUI and making the
qdarkstyledependency more robust across different platforms.GUI stylesheet loading improvements:
style.qssfile with the newget_style_qss()function to set the initial stylesheet inlaunch_script.py[1] [2].qdarkstylestylesheet for PySide6: if loading fails, the code logs a warning and falls back to the PySide2 stylesheet.Dependency management updates:
qdarkstyledependency inpyproject.tomlto use version-specific and platform-specific selectors, ensuring compatibility with different operating systems and architectures.