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.
|
hmm on my system I get: ModuleNotFoundError: No module named 'qtpy.Qsci' |
|
if in gcode_editor, I change to: try: then dragon runs. |
|
That is interesting because I have actually verified that module to work on Debian bookworm. Support for qtpy.Qsci was introduced in QtPy 2.3.0. So probably you are using an older version. |
|
If the goal of this pull request is to allow Debian to drop python3-poppler-qt5, then I think we should limit the changes to only what is necessary to support the necessary updates in PDFViewer.py. I understand and appreciate the groundwork being done with this commit to support our future conversion to pyqt6, but that introduces additional changes that require extensive testing and review. Given that our master branch is approaching a release state, this may not be the right time to include the broader refactoring. At this point, I recommend we focus only on the changes necessary to remove poppler from the codebase so Debian can proceed with dropping the package from Forky. The rest can be handled by Chris and myself in a separate effort where the changes can be reviewed and tested thoroughly (after 2.10 is released). |
snowgoer540
left a comment
There was a problem hiding this comment.
After further consideration, I recommend changing this pull request to encompass only what is absolutely necessary to remove python3-poppler-qt5 from PDFViewer.py in support of dropping the package for Debian Forky.
|
That is okay. The Debian package can just drop the optional dependency. There is nothing in this PR that suggests to integrate it very soon. |
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