ColinDuquesnoy / QDarkStyleSheet

A dark style sheet for QtWidgets application
Other
2.76k stars 725 forks source link

BUG: Cannot use 3.2.2 on PySide2 (probably anything other than PyQt5) #341

Closed larsoner closed 7 months ago

larsoner commented 7 months ago

From a recent CI run where we installed PySide2:

https://dev.azure.com/mne-tools/mne-python/_build/results?buildId=28161&view=logs&jobId=2b5832ae-6860-5681-a4e1-fd132048f8b4&j=2b5832ae-6860-5681-a4e1-fd132048f8b4&t=4fa6a6b5-0a24-5933-b3b1-1c0e575a8064

_________________________ test_layered_mesh[pyvistaqt] _________________________
mne/viz/_brain/tests/test_brain.py:130: in test_layered_mesh
    renderer=renderer_interactive_pyvistaqt._get_renderer(size=(300, 300)),
...
mne/viz/backends/_utils.py:356: in _qt_get_stylesheet
    stylesheet = qdarkstyle.load_stylesheet(klass)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/qdarkstyle/__init__.py:368: in load_stylesheet
    stylesheet = _load_stylesheet(palette=palette_arg)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/qdarkstyle/__init__.py:248: in _load_stylesheet
    from qdarkstyle.light import lightstyle_rc  # noqa
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/__feature__.py:142: in _import
    return original_import(name, *args, **kwargs)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/qdarkstyle/light/lightstyle_rc.py:9: in <module>
    from PyQt5 import QtCore
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/__feature__.py:142: in _import
    return original_import(name, *args, **kwargs)
E   ModuleNotFoundError: No module named 'PyQt5'

So I'm assuming this is due to commit https://github.com/ColinDuquesnoy/QDarkStyleSheet/commit/1c5be2e296e643ca47ec7450f17264ffb4d00251 which switched to an explicit PyQt5 import from the old qtpy one:

https://github.com/ColinDuquesnoy/QDarkStyleSheet/blob/969fd6042659e8cd3a18d95710e697013887a133/qdarkstyle/light/lightstyle_rc.py#L6

dpizetta commented 7 months ago

Thanks for reporting, oh, the substitution failed. I'll fix it. Thanks. It should be working in this new version from PyPI

ccordoba12 commented 7 months ago

@larsoner, could you check if 3.2.3 fixes the problem? That way I could merge the PR for that version in Conda-forge.

larsoner commented 7 months ago

Yes 3.2.3 was installed in this recent CI run and it's green, thanks!