Visitar URL original
Fallback to PySide2 qdarkstyle stylesheet · DeepLabCut/DeepLabCut@4dec33a · GitHub
Skip to content

Commit 4dec33a

Browse files
committed
Fallback to PySide2 qdarkstyle stylesheet
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.
1 parent 2a59325 commit 4dec33a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎deeplabcut/gui/launch_script.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
"""
2121

22-
import os
22+
import logging
2323
import sys
2424

2525
import PySide6.QtWidgets as QtWidgets
@@ -28,6 +28,8 @@
2828

2929
from deeplabcut.gui.gui_assets import get_style_qss, icon_from_resource, pixmap_from_resource
3030

31+
logger = logging.getLogger(__name__)
32+
3133

3234
def launch_dlc():
3335
app = QtWidgets.QApplication(sys.argv)
@@ -38,7 +40,11 @@ def launch_dlc():
3840
splash.show()
3941

4042
app.setStyleSheet(get_style_qss()) # this gets overridden immediately?
41-
dark_stylesheet = qdarkstyle.load_stylesheet_pyside6()
43+
try:
44+
dark_stylesheet = qdarkstyle.load_stylesheet_pyside6()
45+
except Exception as e:
46+
logger.warning(f"Could not load qdarkstyle stylesheet for PySide6: {e}. Falling back to PySide2 stylesheet.")
47+
dark_stylesheet = qdarkstyle.load_stylesheet_pyside2()
4248
app.setStyleSheet(dark_stylesheet)
4349

4450
# Set up a logger and add an stdout handler.

0 commit comments

Comments
 (0)