Conversation
|
@c-morley The description sounds like a good approach. What do you think? |
|
Made some time to apply this to the project and test it out. After installing the necessary pyqt dependency, I get these in the terminal window when running the qtplasmac GUI: |
I have removed the dbus.mainloop.glib fallback (which was added for PySide which we do not need to support) so this should be fixed. |
|
It still gave the same QSocketNotifier message. In order to fix it, I had to change the order of the import test to prefer testing pyqt5 first. From: To: |
Replace all PyQt5-specific imports and idioms with their QtPy
equivalents, making the codebase compatible with PyQt5 and PyQt6.
Import changes:
- Replace `from PyQt5.XXX import` with `from qtpy.XXX import`
- Replace bare `from PyQt5 import XXX` with `from qtpy import XXX`
- Replace `pyqtSignal`, `pyqtSlot`, `pyqtProperty` with the qtpy
canonical names `Signal`, `Slot`, `Property`
- Port `PyQt5.QtDesigner` imports to `qtpy.QtDesigner`
- Port `PyQt5.Qsci` imports to `qtpy.Qsci`
PDFViewer: add QtPdf backend as Qt6 alternative to popplerqt5
- Try `qtpy.QtPdf.QPdfDocument` first; fall back to popplerqt5
- Use `QPdfDocumentRenderOptions` with Annotations flag for render
quality matching the popplerqt5 Antialiasing/TextAntialiasing hints
sys_notify: make DBus main loop integration backend-agnostic
- Try dbus.mainloop.pyqt5, then dbus.mainloop.pyqt6.
qtplasmac handlers: replace `find_spec("PyQt5.QtWebEngineWidgets")`
- Use a module-level `_WEBENGINE_AVAILABLE` flag set by try/import
of `qtpy.QtWebEngineWidgets` in the qtplasmac handler.
plugins/status_label_plugin: fix pyqtProperty descriptor check
- Replace fragile `'PyQt5.QtCore.pyqtProperty' in str(...)` with
`isinstance(..., Property)` to work across all Qt bindings
Applied to the PR. |
snowgoer540
left a comment
There was a problem hiding this comment.
From a QtPlasmaC standpoint this seems ok to merge. It will require RIP users to install the python3-qtpy dependency.
Will require @c-morley 's review prior to merging, he is much much more familiar with all of the core qtvcp stuff, and has many more affected GUIs.
Replace all PyQt5-specific imports and idioms with their QtPy equivalents, making the codebase compatible with PyQt5 and PyQt6.
Import changes:
from PyQt5.XXX importwithfrom qtpy.XXX importfrom PyQt5 import XXXwithfrom qtpy import XXXpyqtSignal,pyqtSlot,pyqtPropertywith the qtpy canonical namesSignal,Slot,PropertyPyQt5.QtDesignerimports toqtpy.QtDesignerPyQt5.Qsciimports toqtpy.QsciPDFViewer: add QtPdf backend as Qt6 alternative to popplerqt5
qtpy.QtPdf.QPdfDocumentfirst; fall back to popplerqt5QPdfDocumentRenderOptionswith Annotations flag for render quality matching the popplerqt5 Antialiasing/TextAntialiasing hintssys_notify: make DBus main loop integration backend-agnostic
qtplasmac handlers: replace
find_spec("PyQt5.QtWebEngineWidgets")_WEBENGINE_AVAILABLEflag set by try/import ofqtpy.QtWebEngineWidgetsin the qtplasmac handlerplugins/status_label_plugin: fix pyqtProperty descriptor check
'PyQt5.QtCore.pyqtProperty' in str(...)withisinstance(..., Property)to work across all Qt bindings