Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark theme in version 3.2.1 is not working #339

Open
skp17 opened this issue Nov 21, 2023 · 3 comments
Open

Dark theme in version 3.2.1 is not working #339

skp17 opened this issue Nov 21, 2023 · 3 comments
Assignees
Milestone

Comments

@skp17
Copy link

skp17 commented Nov 21, 2023

Describe Your Environment

  • PYTHON DISTRIBUTION------------------------------------------------------------
    • Version....................... 3.7.1
    • C Compiler.................... MSC v.1915 32 bit (Intel)
    • C API Version................. 1013
    • Implementation................ cpython
    • Implementation Version........ 3.7.1
  • QT BINDINGS--------------------------------------------------------------------
    • PyQt5 Version................. 5.11.3
    • PyQt5 Qt Version.............. 5.11.2
  • QT ABSTRACTIONS----------------------------------------------------------------
    • qtpy Version.................. 2.4.0
    • qtpy Binding.................. pyqt5
    • qtpy Binding Variable......... os.environ['QT_API']
    • qtpy Import Name.............. qtpy
    • qtpy Status................... OK
  • PYTHON PACKAGES----------------------------------------------------------------
    • helpdev....................... 0.7.1
    • QDarkStyle.................... 3.2.1

Language

Python

Description / Steps to Reproduce [if necessary]

Simply running the command $ qdarkstyle.example --palette=dark produces an error.
Everything works fine with QDarkStyle v3.1. However, I'm getting problems with v3.2 & v3.2.1.

Actual Result

Traceback (most recent call last):
  File "c:\users\steven\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\steven\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\steven\.virtualenvs\nep_generic_db_tool-OeiXJOWV\Scripts\qdarkstyle.example.exe\__main__.py", line 7, in <module>
  File "C:\Users\steven\.virtualenvs\nep_generic_db_tool-OeiXJOWV\lib\site-packages\qdarkstyle\example\__main__.py", line 111, in main
    from qtpy import API_NAME, QT_VERSION, PYQT_VERSION, PYSIDE_VERSION, uic
  File "C:\Users\steven\.virtualenvs\nep_generic_db_tool-OeiXJOWV\lib\site-packages\qtpy\__init__.py", line 287, in <module>
    raise QtBindingsNotFoundError from None
qtpy.QtBindingsNotFoundError: No Qt bindings could be found

Expected Results / Proposed Result

[A description, output ou image of the expected/proposed result]

Relevant Code [if necessary]

$ qdarkstyle.example --palette=dark
@ccordoba12 ccordoba12 added this to the 3.2.2 milestone Nov 23, 2023
@ccordoba12
Copy link
Collaborator

ccordoba12 commented Nov 23, 2023

Hey @skp17, thanks for reporting. We've also noticed a similar problem in Spyder.

@dpizetta, a simple way to reproduce this is by running the following commands in a virtualenv:

pip install pyqt==5.12 ipython
ipython

and then

In [1]: from qdarkstyle import load_stylesheet

In [2]: css = load_stylesheet()
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[2], line 1
----> 1 css = load_stylesheet()

File ~/.virtualenvs/test-qdark/lib/python3.8/site-packages/qdarkstyle/__init__.py:341, in load_stylesheet(*args, **kwargs)
    339 # No arguments
    340 if not kwargs and not args:
--> 341     stylesheet = _load_stylesheet(qt_api='pyqt5')
    343 # Old API arguments
    344 elif 'pyside' in kwargs or isinstance(arg, bool):

File ~/.virtualenvs/test-qdark/lib/python3.8/site-packages/qdarkstyle/__init__.py:273, in _load_stylesheet(qt_api, palette)
    271     stylesheet = ""
    272     # Todo: check this raise type and add to docs
--> 273     raise FileNotFoundError("Unable to find QSS file '{}' "
    274                             "in resources.".format(qss_rc_path))
    276 _logger.debug("Checking patches for being applied.")
    278 # Todo: check execution order for these functions
    279 # 1. Apply OS specific patches

FileNotFoundError: Unable to find QSS file ':qdarkstyle/dark/darkstyle.qss' in resources.

This error doesn't happen in PyQt 5.15, but it does in version 5.12 and, according to the info reported by @skp17, in 5.11 as well.

So, I think the assets need to be regenerated so that they work in older PyQt versions.

Could you take a look at that? Thanks!

@dpizetta
Copy link
Collaborator

Hey guys, thank you for reporting, I'll take a look this weekend. I think I generated the assets with pyside6, so maybe thats the problem. Thanks!

@dpizetta dpizetta self-assigned this Nov 23, 2023
@dpizetta
Copy link
Collaborator

dpizetta commented Nov 27, 2023

Actually, this is a problem with the QtPy already mentioned some time ago in this.

Since I'm building the assets in the Qt6, QtPy will try in this order PyQt5/PySide2/PyQt6/Pyside6. So, if it start with PySide6, QtPy won't test the other possibilities.

For now I'll rebuild the assets in Qt5, them with some time I can help with the PR for the QtPy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants