-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix(web_viewer): switch from QtWebKit to QtWebEngine #186
Conversation
As discussed in geotribu#99, QtWebKit is deprecated. The previous fix was not portable. Even when QGIS has QtWebKitWidgets, it fails if not present on the system. This change adopts a more sustainable method using only QtWebEngineWidgets, which will also be available in Qt6. Additionally, instead of calling PyQt (which can be PyQt5 or PyQt6 depending on the system), we now use the link provided by QGIS with qgis.PyQt.
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #186 +/- ##
==========================================
- Coverage 21.52% 14.39% -7.14%
==========================================
Files 17 21 +4
Lines 734 1091 +357
Branches 76 140 +64
==========================================
- Hits 158 157 -1
- Misses 575 933 +358
Partials 1 1
|
Salut @lbartoletti, sur Ubuntu 22.04, le plugin fait planter QGIS LTR (dépôts officiels) alors que ça ne plante pas sur master. La trace : ModuleNotFoundError: No module named 'qgis.PyQt.QtWebEngineWidgets'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 423, in _startPlugin
plugins[packageName] = package.classFactory(iface)
File "/home/jmo/Git/Geotribu/qtribu/qtribu/__init__.py", line 21, in classFactory
from .plugin_main import GeotribuPlugin
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmo/Git/Geotribu/qtribu/qtribu/plugin_main.py", line 21, in
from qtribu.gui.dlg_contents import GeotribuContentsDialog
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmo/Git/Geotribu/qtribu/qtribu/gui/dlg_contents.py", line 17, in
from qtribu.gui.form_article import ArticleForm
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmo/Git/Geotribu/qtribu/qtribu/gui/form_article.py", line 22, in
from qtribu.toolbelt.commons import open_url_in_browser
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmo/Git/Geotribu/qtribu/qtribu/toolbelt/commons.py", line 4, in
from qtribu.logic import WebViewer
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmo/Git/Geotribu/qtribu/qtribu/logic/__init__.py", line 5, in
from .web_viewer import WebViewer # noqa: F401
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/jmo/Git/Geotribu/qtribu/qtribu/logic/web_viewer.py", line 21, in
from qgis.PyQt.QtWebEngineWidgets import QWebEngineView as QWebView
File "/usr/lib/python3/dist-packages/qgis/utils.py", line 892, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'qgis.PyQt.QtWebEngineWidgets'
Quelle est la commande d'install sur Debian et ubuntu ? |
sudo apt install qtwebengine5 ? |
Certainement, quelque chose comme |
C'est celui là le bon oui |
Signed-off-by: Julien <dev@ingeoveritas.com>
Quality Gate passedIssues Measures |
As discussed in #99, QtWebKit is deprecated. The previous fix was not portable. Even when QGIS has QtWebKitWidgets, it fails if not present on the system. This change adopts a more sustainable method using only QtWebEngineWidgets, which will also be available in Qt6.
Additionally, instead of calling PyQt (which can be PyQt5 or PyQt6 depending on the system), we now use the link provided by QGIS with qgis.PyQt.
Tested on FreeBSD and Windows (Osgeo4w). PyQt with QtWebEngine must be installed.
cc @kikislater