Compare commits

..

No commits in common. "53b28e29374da344949923c86a049c3a8b084ff4" and "43215e5d946721a119e886ef50eb99162d416c38" have entirely different histories.

2 changed files with 17 additions and 15 deletions

View File

@ -15,7 +15,6 @@ authors = [
] ]
keywords = [ keywords = [
"Qt", "Qt",
"Qt6",
"website", "website",
] ]
classifiers = [ classifiers = [
@ -28,15 +27,16 @@ 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 = [
"PySide6", "PyQt5",
"PyQtWebEngine",
] ]
dynamic = [ dynamic = [
"version", "version",

View File

@ -2,8 +2,8 @@
WebAppify WebAppify
========= =========
WebAppify is a simple module to easily create your own desktop apps of websites. WebAppify uses PySide6 and 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 3.10 and up. QtWebEngine for displaying the web page, and works on Python 2.7 and Python 3.4 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,29 +18,30 @@ 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. 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.
""" """
import logging import logging
import sys import sys
import platform import platform
from PySide6 import QtCore, QtGui, QtWidgets, QtWebEngineCore, QtWebEngineWidgets from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
SETTINGS = [ SETTINGS = [
QtWebEngineCore.QWebEngineSettings.PluginsEnabled, QtWebEngineWidgets.QWebEngineSettings.PluginsEnabled,
QtWebEngineCore.QWebEngineSettings.JavascriptCanAccessClipboard, QtWebEngineWidgets.QWebEngineSettings.JavascriptCanAccessClipboard,
QtWebEngineCore.QWebEngineSettings.LocalContentCanAccessRemoteUrls QtWebEngineWidgets.QWebEngineSettings.LocalContentCanAccessRemoteUrls
] ]
LOG_LEVELS = { LOG_LEVELS = {
QtWebEngineCore.QWebEnginePage.InfoMessageLevel: logging.INFO, QtWebEngineWidgets.QWebEnginePage.InfoMessageLevel: logging.INFO,
QtWebEngineCore.QWebEnginePage.WarningMessageLevel: logging.WARNING, QtWebEngineWidgets.QWebEnginePage.WarningMessageLevel: logging.WARNING,
QtWebEngineCore.QWebEnginePage.ErrorMessageLevel: logging.ERROR QtWebEngineWidgets.QWebEnginePage.ErrorMessageLevel: logging.ERROR
} }
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class WebPage(QtWebEngineCore.QWebEnginePage): class WebPage(QtWebEngineWidgets.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
""" """
@ -49,6 +50,7 @@ class WebPage(QtWebEngineCore.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):