Skip to content

Fix PySide6 stylesheet usage - #3371

Merged
deruyter92 merged 23 commits into
mainfrom
cy/fix-pyside6-theme
Jul 20, 2026
Merged

Fix PySide6 stylesheet usage#3371
deruyter92 merged 23 commits into
mainfrom
cy/fix-pyside6-theme

Conversation

@C-Achard

@C-Achard C-Achard commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

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 qdarkstyle dependency more robust across different platforms.

GUI stylesheet loading improvements:

  • Replaced the manual loading of the style.qss file with the new get_style_qss() function to set the initial stylesheet in launch_script.py [1] [2].
  • Improved error handling when loading the qdarkstyle stylesheet for PySide6: if loading fails, the code logs a warning and falls back to the PySide2 stylesheet.

Dependency management updates:

  • Updated the qdarkstyle dependency in pyproject.toml to use version-specific and platform-specific selectors, ensuring compatibility with different operating systems and architectures.

@C-Achard C-Achard self-assigned this Jun 15, 2026
@C-Achard C-Achard added enhancement New feature or request GUI issues relating to GUI labels Jun 15, 2026
@C-Achard C-Achard changed the title Cy/fix pyside6 theme Fix PySide6 theme usage Jun 15, 2026
@C-Achard C-Achard changed the title Fix PySide6 theme usage Fix PySide6 stylesheet usage Jun 15, 2026
@deruyter92
deruyter92 force-pushed the cy/update-gui-assets-imports branch from 44ba095 to c8ca7e0 Compare June 25, 2026 15:33
Base automatically changed from cy/update-gui-assets-imports to jaap/pathlib_path_policy June 25, 2026 15:35
deruyter92 and others added 3 commits June 26, 2026 19:56
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.
@C-Achard C-Achard added this to the v3.0.1 milestone Jun 29, 2026
Base automatically changed from jaap/pathlib_path_policy to main July 15, 2026 15:53
@C-Achard
C-Achard changed the base branch from main to jaap/safe_resolve_paths July 16, 2026 13:40
C-Achard added 5 commits July 16, 2026 15:42
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
C-Achard force-pushed the cy/fix-pyside6-theme branch from 2cd803e to 4dec33a Compare July 16, 2026 13:46
@C-Achard
C-Achard marked this pull request as ready for review July 16, 2026 13:47
@C-Achard
C-Achard requested a review from deruyter92 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.
Comment thread deeplabcut/gui/window.py Outdated
Comment thread deeplabcut/gui/components.py Outdated
Co-authored-by: Jaap de Ruyter van Steveninck <32810691+deruyter92@users.noreply.github.com>
@deruyter92
deruyter92 changed the base branch from jaap/safe_resolve_paths to main July 17, 2026 11:30
@deruyter92

Copy link
Copy Markdown
Collaborator

Resolved conflicts. Ready to merge!!

Note

will likely conflict with #3370, but I can handle it if that occurs.

@deruyter92
deruyter92 requested review from AlexEMG and MMathisLab July 17, 2026 16:52
@deruyter92
deruyter92 merged commit 785bcda into main Jul 20, 2026
32 checks passed
@deruyter92
deruyter92 deleted the cy/fix-pyside6-theme branch July 20, 2026 11:41
@deruyter92 deruyter92 mentioned this pull request Jul 20, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request GUI issues relating to GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants