Migrate to Qt6 and PySide6

This commit is contained in:
Raoul Snyman 2024-09-27 10:00:58 -05:00
parent 43215e5d94
commit 09bf97c38e
2 changed files with 15 additions and 17 deletions

View File

@ -15,6 +15,7 @@ authors = [
]
keywords = [
"Qt",
"Qt6",
"website",
]
classifiers = [
@ -27,16 +28,15 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Desktop Environment",
"Topic :: Internet :: WWW/HTTP :: Browsers",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"PyQt5",
"PyQtWebEngine",
"PySide6",
]
dynamic = [
"version",

View File

@ -2,8 +2,8 @@
WebAppify
=========
WebAppify is a simple module to easily create your own desktop apps of websites. WebAppify uses PyQt5 and QtWebKit or
QtWebEngine for displaying the web page, and works on Python 2.7 and Python 3.4 and up.
WebAppify is a simple module to easily create your own desktop apps of websites. WebAppify uses PySide6 and
QtWebEngine for displaying the web page, and works on Python 3.10 and up.
To create your own desktop web app, import and set up the WebApp class.
@ -18,30 +18,29 @@ This will create a window with the website, using the icon provided.
.. note::
If your site needs Flash Player, you'll need the appropriate Flash Player plugin installed system-wide. For QtWebKit
you will need the NPAPI plugin, and for QtWebEngine you will need the PPAPI plugin.
If your site needs Flash Player, you'll need the appropriate Flash Player plugin installed system-wide.
"""
import logging
import sys
import platform
from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
from PySide6 import QtCore, QtGui, QtWidgets, QtWebEngineCore, QtWebEngineWidgets
SETTINGS = [
QtWebEngineWidgets.QWebEngineSettings.PluginsEnabled,
QtWebEngineWidgets.QWebEngineSettings.JavascriptCanAccessClipboard,
QtWebEngineWidgets.QWebEngineSettings.LocalContentCanAccessRemoteUrls
QtWebEngineCore.QWebEngineSettings.PluginsEnabled,
QtWebEngineCore.QWebEngineSettings.JavascriptCanAccessClipboard,
QtWebEngineCore.QWebEngineSettings.LocalContentCanAccessRemoteUrls
]
LOG_LEVELS = {
QtWebEngineWidgets.QWebEnginePage.InfoMessageLevel: logging.INFO,
QtWebEngineWidgets.QWebEnginePage.WarningMessageLevel: logging.WARNING,
QtWebEngineWidgets.QWebEnginePage.ErrorMessageLevel: logging.ERROR
QtWebEngineCore.QWebEnginePage.InfoMessageLevel: logging.INFO,
QtWebEngineCore.QWebEnginePage.WarningMessageLevel: logging.WARNING,
QtWebEngineCore.QWebEnginePage.ErrorMessageLevel: logging.ERROR
}
log = logging.getLogger(__name__)
class WebPage(QtWebEngineWidgets.QWebEnginePage):
class WebPage(QtWebEngineCore.QWebEnginePage):
"""
A custom QWebEnginePage which logs JS console messages to the Python logging system
"""
@ -50,7 +49,6 @@ class WebPage(QtWebEngineWidgets.QWebEnginePage):
Custom logger to log console messages to the Python logging system
"""
log.log(LOG_LEVELS[level], f'{source_id}:{line_number} {message}')
print(message)
class WebWindow(QtWidgets.QWidget):