Fix PySide6 stylesheet usage#3371
Draft
C-Achard wants to merge 3 commits into
Draft
Conversation
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.
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.