Migrate to Qt6 and PySide6 #9
@ -15,6 +15,7 @@ authors = [
|
|||||||
]
|
]
|
||||||
keywords = [
|
keywords = [
|
||||||
"Qt",
|
"Qt",
|
||||||
|
"Qt6",
|
||||||
"website",
|
"website",
|
||||||
]
|
]
|
||||||
classifiers = [
|
classifiers = [
|
||||||
@ -27,16 +28,15 @@ classifiers = [
|
|||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
"Topic :: Desktop Environment",
|
"Topic :: Desktop Environment",
|
||||||
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
||||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"PyQt5",
|
"PySide6",
|
||||||
"PyQtWebEngine",
|
|
||||||
]
|
]
|
||||||
dynamic = [
|
dynamic = [
|
||||||
"version",
|
"version",
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
WebAppify
|
WebAppify
|
||||||
=========
|
=========
|
||||||
|
|
||||||
WebAppify is a simple module to easily create your own desktop apps of websites. WebAppify uses PyQt5 and QtWebKit or
|
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 2.7 and Python 3.4 and up.
|
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.
|
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::
|
.. note::
|
||||||
|
|
||||||
If your site needs Flash Player, you'll need the appropriate Flash Player plugin installed system-wide. For QtWebKit
|
If your site needs Flash Player, you'll need the appropriate Flash Player plugin installed system-wide.
|
||||||
you will need the NPAPI plugin, and for QtWebEngine you will need the PPAPI plugin.
|
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
|
from PySide6 import QtCore, QtGui, QtWidgets, QtWebEngineCore, QtWebEngineWidgets
|
||||||
|
|
||||||
SETTINGS = [
|
SETTINGS = [
|
||||||
QtWebEngineWidgets.QWebEngineSettings.PluginsEnabled,
|
QtWebEngineCore.QWebEngineSettings.PluginsEnabled,
|
||||||
QtWebEngineWidgets.QWebEngineSettings.JavascriptCanAccessClipboard,
|
QtWebEngineCore.QWebEngineSettings.JavascriptCanAccessClipboard,
|
||||||
QtWebEngineWidgets.QWebEngineSettings.LocalContentCanAccessRemoteUrls
|
QtWebEngineCore.QWebEngineSettings.LocalContentCanAccessRemoteUrls
|
||||||
]
|
]
|
||||||
LOG_LEVELS = {
|
LOG_LEVELS = {
|
||||||
QtWebEngineWidgets.QWebEnginePage.InfoMessageLevel: logging.INFO,
|
QtWebEngineCore.QWebEnginePage.InfoMessageLevel: logging.INFO,
|
||||||
QtWebEngineWidgets.QWebEnginePage.WarningMessageLevel: logging.WARNING,
|
QtWebEngineCore.QWebEnginePage.WarningMessageLevel: logging.WARNING,
|
||||||
QtWebEngineWidgets.QWebEnginePage.ErrorMessageLevel: logging.ERROR
|
QtWebEngineCore.QWebEnginePage.ErrorMessageLevel: logging.ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
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
|
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
|
Custom logger to log console messages to the Python logging system
|
||||||
"""
|
"""
|
||||||
log.log(LOG_LEVELS[level], f'{source_id}:{line_number} {message}')
|
log.log(LOG_LEVELS[level], f'{source_id}:{line_number} {message}')
|
||||||
print(message)
|
|
||||||
|
|
||||||
|
|
||||||
class WebWindow(QtWidgets.QWidget):
|
class WebWindow(QtWidgets.QWidget):
|
||||||
|
Loading…
Reference in New Issue
Block a user