Mon, 30 Aug 2021 20:02:39 +0200
Next batch of changes for QtWebEngine as of Qt 6.2.0.
--- a/eric7/EricNetwork/EricSslInfoWidget.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/EricNetwork/EricSslInfoWidget.py Mon Aug 30 20:02:39 2021 +0200 @@ -15,6 +15,7 @@ import Utilities +# FIXME: don't use QMenu class EricSslInfoWidget(QMenu): """ Class implementing a widget to show SSL certificate infos.
--- a/eric7/Preferences/ConfigurationPages/WebBrowserPage.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/Preferences/ConfigurationPages/WebBrowserPage.py Mon Aug 30 20:02:39 2021 +0200 @@ -66,6 +66,10 @@ Preferences.getWebBrowser("ScreenCaptureEnabled")) self.webGLCheckBox.setChecked( Preferences.getWebBrowser("WebGLEnabled")) + self.accelerated2dCanvasCheckBox.setChecked( + Preferences.getWebBrowser("Accelerated2dCanvasEnabled")) + self.autoloadIconsCheckBox.setChecked( + Preferences.getWebBrowser("AutoLoadIconsForPage")) self.autoplayMediaCheckBox.setChecked( Preferences.getWebBrowser("PlaybackRequiresUserGesture")) self.webRtcPublicOnlyCheckBox.setChecked( @@ -239,8 +243,14 @@ Preferences.setWebBrowser( "WebGLEnabled", self.webGLCheckBox.isChecked()) + Preferences.setWebBrowser( + "Accelerated2dCanvasEnabled", + self.accelerated2dCanvasCheckBox.isChecked()), Preferences.setWebBrowser( + "AutoLoadIconsForPage", + self.autoloadIconsCheckBox.isChecked()), + Preferences.setWebBrowser( "PlaybackRequiresUserGesture", self.autoplayMediaCheckBox.isChecked()) Preferences.setWebBrowser(
--- a/eric7/Preferences/ConfigurationPages/WebBrowserPage.ui Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/Preferences/ConfigurationPages/WebBrowserPage.ui Mon Aug 30 20:02:39 2021 +0200 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>650</width> - <height>2084</height> + <height>1630</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_6"> @@ -128,6 +128,26 @@ </widget> </item> <item row="4" column="1"> + <widget class="QCheckBox" name="accelerated2dCanvasCheckBox"> + <property name="toolTip"> + <string>Select to enable support for accelerated 2D canvas using OpenGL</string> + </property> + <property name="text"> + <string>Enable Accelerated 2D Canvas</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="autoloadIconsCheckBox"> + <property name="toolTip"> + <string>Select to load web site icons automatically</string> + </property> + <property name="text"> + <string>Load Icons automatically</string> + </property> + </widget> + </item> + <item row="5" column="1"> <widget class="QCheckBox" name="autoplayMediaCheckBox"> <property name="toolTip"> <string>Select, to inhibit playback of media content until the user interacts with the page</string> @@ -137,7 +157,7 @@ </property> </widget> </item> - <item row="5" column="0"> + <item row="6" column="0"> <widget class="QCheckBox" name="webRtcPublicOnlyCheckBox"> <property name="toolTip"> <string>Select to limit WebRTC to public IP addresses only</string> @@ -147,7 +167,7 @@ </property> </widget> </item> - <item row="5" column="1"> + <item row="6" column="1"> <widget class="QCheckBox" name="dnsPrefetchCheckBox"> <property name="toolTip"> <string>Select to try to pre-fetch DNS entries to speed up browsing</string> @@ -1173,6 +1193,8 @@ <tabstop>fullscreenCheckBox</tabstop> <tabstop>screenCaptureCheckBox</tabstop> <tabstop>webGLCheckBox</tabstop> + <tabstop>accelerated2dCanvasCheckBox</tabstop> + <tabstop>autoloadIconsCheckBox</tabstop> <tabstop>autoplayMediaCheckBox</tabstop> <tabstop>webRtcPublicOnlyCheckBox</tabstop> <tabstop>dnsPrefetchCheckBox</tabstop>
--- a/eric7/Preferences/__init__.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/Preferences/__init__.py Mon Aug 30 20:02:39 2021 +0200 @@ -22,7 +22,6 @@ import shutil import json import sys -import contextlib from PyQt6.QtCore import ( QDir, QPoint, QLocale, QSettings, QFileInfo, QCoreApplication, QByteArray, @@ -1055,9 +1054,9 @@ if QWebEngineSettings is None: return -## webEngineSettings = QWebEngineSettings.defaultSettings() webEngineSettings = QWebEngineProfile.defaultProfile().settings() cls.webBrowserDefaults.update({ + # fonts "StandardFontFamily": webEngineSettings.fontFamily( QWebEngineSettings.FontFamily.StandardFont), "FixedFontFamily": webEngineSettings.fontFamily( @@ -1070,6 +1069,10 @@ QWebEngineSettings.FontFamily.CursiveFont), "FantasyFontFamily": webEngineSettings.fontFamily( QWebEngineSettings.FontFamily.FantasyFont), + "PictographFontFamily": webEngineSettings.fontFamily( + QWebEngineSettings.FontFamily.PictographFont), + + # font sizes "DefaultFontSize": webEngineSettings.fontSize( QWebEngineSettings.FontSize.DefaultFontSize), "DefaultFixedFontSize": webEngineSettings.fontSize( @@ -1078,6 +1081,11 @@ QWebEngineSettings.FontSize.MinimumFontSize), "MinimumLogicalFontSize": webEngineSettings.fontSize( QWebEngineSettings.FontSize.MinimumLogicalFontSize), + + # text encoding + "DefaultTextEncoding": webEngineSettings.defaultTextEncoding(), + + # web attributes "AutoLoadImages": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.AutoLoadImages), "JavaScriptEnabled": webEngineSettings.testAttribute( @@ -1086,34 +1094,36 @@ QWebEngineSettings.WebAttribute.JavascriptCanOpenWindows), "JavaScriptCanAccessClipboard": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.JavascriptCanAccessClipboard), - "PluginsEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.WebAttribute.PluginsEnabled), + "LinksIncludedInFocusChain": webEngineSettings.testAttribute( + QWebEngineSettings.WebAttribute.LinksIncludedInFocusChain), "LocalStorageEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.LocalStorageEnabled), - "DefaultTextEncoding": webEngineSettings.defaultTextEncoding(), - "SpatialNavigationEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.WebAttribute.SpatialNavigationEnabled), - "LinksIncludedInFocusChain": webEngineSettings.testAttribute( - QWebEngineSettings.WebAttribute.LinksIncludedInFocusChain), "LocalContentCanAccessRemoteUrls": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute .LocalContentCanAccessRemoteUrls), + "XSSAuditingEnabled": webEngineSettings.testAttribute( + QWebEngineSettings.WebAttribute.XSSAuditingEnabled), + "SpatialNavigationEnabled": webEngineSettings.testAttribute( + QWebEngineSettings.WebAttribute.SpatialNavigationEnabled), "LocalContentCanAccessFileUrls": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.LocalContentCanAccessFileUrls), - "XSSAuditingEnabled": webEngineSettings.testAttribute( - QWebEngineSettings.WebAttribute.XSSAuditingEnabled), "ScrollAnimatorEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.ScrollAnimatorEnabled), "ErrorPageEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.ErrorPageEnabled), + "PluginsEnabled": webEngineSettings.testAttribute( + QWebEngineSettings.WebAttribute.PluginsEnabled), "FullScreenSupportEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.FullScreenSupportEnabled), - "PictographFontFamily": webEngineSettings.fontFamily( - QWebEngineSettings.FontFamily.PictographFont), "ScreenCaptureEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.ScreenCaptureEnabled), "WebGLEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.WebGLEnabled), + # TODO: add support for these attributes + "Accelerated2dCanvasEnabled": webEngineSettings.testAttribute( + QWebEngineSettings.WebAttribute.Accelerated2dCanvasEnabled), + "AutoLoadIconsForPage": webEngineSettings.testAttribute( + QWebEngineSettings.WebAttribute.AutoLoadIconsForPage), "FocusOnNavigationEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.FocusOnNavigationEnabled), "PrintElementBackgrounds": webEngineSettings.testAttribute( @@ -1144,18 +1154,10 @@ "DnsPrefetchEnabled": webEngineSettings.testAttribute( QWebEngineSettings.WebAttribute.DnsPrefetchEnabled), - # TODO: add support for these attributes -# "HyperlinkAuditingEnabled" -# "Accelerated2dCanvasEnabled" -# "AutoLoadIconsForPage" + "PdfViewerEnabled": + webEngineSettings.testAttribute( + QWebEngineSettings.WebAttribute.PdfViewerEnabled), }) - with contextlib.suppress(AttributeError): - # Qt 5.13 - cls.webBrowserDefaults.update({ - "PdfViewerEnabled": - webEngineSettings.testAttribute( - QWebEngineSettings.WebAttribute.PdfViewerEnabled), - }) cls.webEngineSettingsIntitialized = True @@ -2830,6 +2832,7 @@ "WebRTCPublicInterfacesOnly", "DnsPrefetchEnabled", "VirusTotalEnabled", "VirusTotalSecure", "PdfViewerEnabled", "AlwaysRejectFaultyCertificates", + "Accelerated2dCanvasEnabled", "AutoLoadIconsForPage", ]: return toBool(prefClass.settings.value( "WebBrowser/" + key, prefClass.webBrowserDefaults[key]))
--- a/eric7/WebBrowser/AdBlock/AdBlockManager.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/AdBlock/AdBlockManager.py Mon Aug 30 20:02:39 2021 +0200 @@ -425,7 +425,7 @@ else: subscriptions = ( [self.__defaultSubscriptionUrlString] + - self.__additionalDefaultSubscriptionUrlStrings + + list(self.__additionalDefaultSubscriptionUrlStrings) + [self.__customSubscriptionUrlString] ) for subscription in subscriptions:
--- a/eric7/WebBrowser/AdBlock/AdBlockSubscription.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/AdBlock/AdBlockSubscription.py Mon Aug 30 20:02:39 2021 +0200 @@ -437,14 +437,14 @@ # ignore Third-party advertisers rules for performance # whitelist rules at the end will be used index = response.indexOf( - "!---------------------------" - "Third-party advertisers" - "---------------------------!") + b"!---------------------------" + b"Third-party advertisers" + b"---------------------------!") part1 = response.left(index) index = response.indexOf( - "!-----------------------" - "Whitelists to fix broken sites" - "------------------------!") + b"!-----------------------" + b"Whitelists to fix broken sites" + b"------------------------!") part2 = response.mid(index) f.write(part1) f.write(part2)
--- a/eric7/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Mon Aug 30 20:02:39 2021 +0200 @@ -7,8 +7,6 @@ Module implementing the feature permission manager object. """ -import contextlib - from PyQt6.QtCore import QObject from PyQt6.QtWidgets import QDialog from PyQt6.QtWebEngineCore import QWebEnginePage @@ -65,13 +63,11 @@ QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], }, - } - with contextlib.suppress(AttributeError): - # this was re-added in Qt 5.13.0 - self.__featurePermissions[QWebEnginePage.Feature.Notifications] = { + QWebEnginePage.Feature.Notifications: { QWebEnginePage.PermissionPolicy.PermissionGrantedByUser: [], QWebEnginePage.PermissionPolicy.PermissionDeniedByUser: [], } + } self.__featurePermissionsKeys = { (QWebEnginePage.Feature.Geolocation, @@ -116,17 +112,13 @@ (QWebEnginePage.Feature.DesktopAudioVideoCapture, QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): "DesktopAudioVideoCaptureDenied", + (QWebEnginePage.Feature.Notifications, + QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): + "NotificationsGranted", + (QWebEnginePage.Feature.Notifications, + QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): + "NotificationsDenied", } - with contextlib.suppress(AttributeError): - # this was re-added in Qt 5.13.0 - self.__featurePermissionsKeys.update({ - (QWebEnginePage.Feature.Notifications, - QWebEnginePage.PermissionPolicy.PermissionGrantedByUser): - "NotificationsGranted", - (QWebEnginePage.Feature.Notifications, - QWebEnginePage.PermissionPolicy.PermissionDeniedByUser): - "NotificationsDenied", - }) self.__loaded = False
--- a/eric7/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py Mon Aug 30 20:02:39 2021 +0200 @@ -37,23 +37,21 @@ # add the various lists - if hasattr(QWebEnginePage, "Notifications"): - # this was re-added in Qt 5.13.0 - self.notifList = QTreeWidget() - self.notifList.setAlternatingRowColors(True) - self.notifList.setSelectionMode( - QAbstractItemView.SelectionMode.ExtendedSelection) - self.notifList.setRootIsDecorated(False) - self.notifList.setItemsExpandable(False) - self.notifList.setAllColumnsShowFocus(True) - self.notifList.setObjectName("notifList") - self.notifList.setSortingEnabled(True) - self.notifList.headerItem().setText(0, self.tr("Host")) - self.notifList.headerItem().setText(1, self.tr("Permission")) - self.tabWidget.addTab( - self.notifList, - UI.PixmapCache.getIcon("notification"), - self.tr("Notifications")) + self.notifList = QTreeWidget() + self.notifList.setAlternatingRowColors(True) + self.notifList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) + self.notifList.setRootIsDecorated(False) + self.notifList.setItemsExpandable(False) + self.notifList.setAllColumnsShowFocus(True) + self.notifList.setObjectName("notifList") + self.notifList.setSortingEnabled(True) + self.notifList.headerItem().setText(0, self.tr("Host")) + self.notifList.headerItem().setText(1, self.tr("Permission")) + self.tabWidget.addTab( + self.notifList, + UI.PixmapCache.getIcon("notification"), + self.tr("Notifications")) self.geoList = QTreeWidget() self.geoList.setAlternatingRowColors(True) @@ -135,55 +133,47 @@ UI.PixmapCache.getIcon("mouse"), self.tr("Mouse Lock")) - if hasattr(QWebEnginePage, "DesktopVideoCapture"): - # these are shown as of Qt 5.10.0/PyQt 5.10.0 - self.deskVidList = QTreeWidget() - self.deskVidList.setAlternatingRowColors(True) - self.deskVidList.setSelectionMode( - QAbstractItemView.SelectionMode.ExtendedSelection) - self.deskVidList.setRootIsDecorated(False) - self.deskVidList.setItemsExpandable(False) - self.deskVidList.setAllColumnsShowFocus(True) - self.deskVidList.setObjectName("deskVidList") - self.deskVidList.setSortingEnabled(True) - self.deskVidList.headerItem().setText(0, self.tr("Host")) - self.deskVidList.headerItem().setText(1, self.tr("Permission")) - self.tabWidget.addTab( - self.deskVidList, - UI.PixmapCache.getIcon("desktopVideoCapture"), - self.tr("Desktop Video")) - - self.deskAudVidList = QTreeWidget() - self.deskAudVidList.setAlternatingRowColors(True) - self.deskAudVidList.setSelectionMode( - QAbstractItemView.SelectionMode.ExtendedSelection) - self.deskAudVidList.setRootIsDecorated(False) - self.deskAudVidList.setItemsExpandable(False) - self.deskAudVidList.setAllColumnsShowFocus(True) - self.deskAudVidList.setObjectName("deskAudVidList") - self.deskAudVidList.setSortingEnabled(True) - self.deskAudVidList.headerItem().setText(0, self.tr("Host")) - self.deskAudVidList.headerItem().setText(1, self.tr("Permission")) - self.tabWidget.addTab( - self.deskAudVidList, - UI.PixmapCache.getIcon("desktopAudioVideoCapture"), - self.tr("Desktop Audio && Video")) + self.deskVidList = QTreeWidget() + self.deskVidList.setAlternatingRowColors(True) + self.deskVidList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) + self.deskVidList.setRootIsDecorated(False) + self.deskVidList.setItemsExpandable(False) + self.deskVidList.setAllColumnsShowFocus(True) + self.deskVidList.setObjectName("deskVidList") + self.deskVidList.setSortingEnabled(True) + self.deskVidList.headerItem().setText(0, self.tr("Host")) + self.deskVidList.headerItem().setText(1, self.tr("Permission")) + self.tabWidget.addTab( + self.deskVidList, + UI.PixmapCache.getIcon("desktopVideoCapture"), + self.tr("Desktop Video")) - if hasattr(QWebEnginePage, "Notifications"): - self.setTabOrder(self.tabWidget, self.notifList) - self.setTabOrder(self.notifList, self.geoList) - else: - self.setTabOrder(self.tabWidget, self.geoList) + self.deskAudVidList = QTreeWidget() + self.deskAudVidList.setAlternatingRowColors(True) + self.deskAudVidList.setSelectionMode( + QAbstractItemView.SelectionMode.ExtendedSelection) + self.deskAudVidList.setRootIsDecorated(False) + self.deskAudVidList.setItemsExpandable(False) + self.deskAudVidList.setAllColumnsShowFocus(True) + self.deskAudVidList.setObjectName("deskAudVidList") + self.deskAudVidList.setSortingEnabled(True) + self.deskAudVidList.headerItem().setText(0, self.tr("Host")) + self.deskAudVidList.headerItem().setText(1, self.tr("Permission")) + self.tabWidget.addTab( + self.deskAudVidList, + UI.PixmapCache.getIcon("desktopAudioVideoCapture"), + self.tr("Desktop Audio && Video")) + + self.setTabOrder(self.tabWidget, self.notifList) + self.setTabOrder(self.notifList, self.geoList) self.setTabOrder(self.geoList, self.micList) self.setTabOrder(self.micList, self.camList) self.setTabOrder(self.camList, self.micCamList) self.setTabOrder(self.micCamList, self.mouseLockList) - if hasattr(QWebEnginePage, "DesktopVideoCapture"): - self.setTabOrder(self.mouseLockList, self.deskVidList) - self.setTabOrder(self.deskVidList, self.deskAudVidList) - self.setTabOrder(self.deskAudVidList, self.removeButton) - else: - self.setTabOrder(self.mouseLockList, self.removeButton) + self.setTabOrder(self.mouseLockList, self.deskVidList) + self.setTabOrder(self.deskVidList, self.deskAudVidList) + self.setTabOrder(self.deskAudVidList, self.removeButton) self.setTabOrder(self.removeButton, self.removeAllButton) self.__permissionStrings = { @@ -199,18 +189,11 @@ QWebEnginePage.Feature.MediaVideoCapture: self.camList, QWebEnginePage.Feature.MediaAudioVideoCapture: self.micCamList, QWebEnginePage.Feature.MouseLock: self.mouseLockList, + QWebEnginePage.Feature.DesktopVideoCapture: self.deskVidList, + QWebEnginePage.Feature.DesktopAudioVideoCapture: + self.deskAudVidList, + QWebEnginePage.Feature.Notifications: self.notifList, } - if hasattr(QWebEnginePage, "DesktopVideoCapture"): - self.__permissionsLists.update({ - QWebEnginePage.Feature.DesktopVideoCapture: - self.deskVidList, - QWebEnginePage.Feature.DesktopAudioVideoCapture: - self.deskAudVidList, - }) - if hasattr(QWebEnginePage, "Notifications"): - self.__permissionsLists[QWebEnginePage.Feature.Notifications] = ( - self.notifList - ) for feature, permissionsList in self.__permissionsLists.items(): for permission in featurePermissions[feature]: @@ -281,7 +264,7 @@ while currentList.topLevelItemCount() > 0: itm = currentList.takeTopLevelItem(0) # __IGNORE_WARNING__ del itm - self.__updateGeoButtons() + self.__updateButtons() def getData(self): """
--- a/eric7/WebBrowser/Network/SslErrorExceptionsDialog.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/Network/SslErrorExceptionsDialog.py Mon Aug 30 20:02:39 2021 +0200 @@ -31,50 +31,59 @@ self.setupUi(self) self.__errorDescriptions = { - QWebEngineCertificateError.Error.SslPinnedKeyNotInCertificateChain: + QWebEngineCertificateError.Type.SslPinnedKeyNotInCertificateChain: self.tr("The certificate did not match the built-in public" " keys pinned for the host name."), - QWebEngineCertificateError.Error.CertificateCommonNameInvalid: + QWebEngineCertificateError.Type.CertificateCommonNameInvalid: self.tr("The certificate's common name did not match the" " host name."), - QWebEngineCertificateError.Error.CertificateDateInvalid: + QWebEngineCertificateError.Type.CertificateDateInvalid: self.tr("The certificate is not valid at the current date" " and time."), - QWebEngineCertificateError.Error.CertificateAuthorityInvalid: + QWebEngineCertificateError.Type.CertificateAuthorityInvalid: self.tr("The certificate is not signed by a trusted" " authority."), - QWebEngineCertificateError.Error.CertificateContainsErrors: + QWebEngineCertificateError.Type.CertificateContainsErrors: self.tr("The certificate contains errors."), - QWebEngineCertificateError.Error.CertificateNoRevocationMechanism: + QWebEngineCertificateError.Type.CertificateNoRevocationMechanism: self.tr("The certificate has no mechanism for determining if" " it has been revoked."), - QWebEngineCertificateError.Error + QWebEngineCertificateError.Type .CertificateUnableToCheckRevocation: self.tr("Revocation information for the certificate is" " not available."), - QWebEngineCertificateError.Error.CertificateRevoked: + QWebEngineCertificateError.Type.CertificateRevoked: self.tr("The certificate has been revoked."), - QWebEngineCertificateError.Error.CertificateInvalid: + QWebEngineCertificateError.Type.CertificateInvalid: self.tr("The certificate is invalid."), - QWebEngineCertificateError.Error.CertificateWeakSignatureAlgorithm: + QWebEngineCertificateError.Type.CertificateWeakSignatureAlgorithm: self.tr("The certificate is signed using a weak signature" " algorithm."), - QWebEngineCertificateError.Error.CertificateNonUniqueName: + QWebEngineCertificateError.Type.CertificateNonUniqueName: self.tr("The host name specified in the certificate is" " not unique."), - QWebEngineCertificateError.Error.CertificateWeakKey: + QWebEngineCertificateError.Type.CertificateWeakKey: self.tr("The certificate contains a weak key."), - QWebEngineCertificateError.Error + QWebEngineCertificateError.Type .CertificateNameConstraintViolation: self.tr("The certificate claimed DNS names that are in" " violation of name constraints."), - QWebEngineCertificateError.Error.CertificateValidityTooLong: + QWebEngineCertificateError.Type.CertificateValidityTooLong: self.tr("The certificate has a validity period that is" " too long."), - QWebEngineCertificateError.Error.CertificateTransparencyRequired: + QWebEngineCertificateError.Type.CertificateTransparencyRequired: self.tr("Certificate Transparency was required for this" " connection, but the server did not provide" " information that complied with the policy."), + QWebEngineCertificateError.Type + .CertificateKnownInterceptionBlocked: + self.tr("The certificate is known to be used for interception" + " by an entity other than the device owner."), + QWebEngineCertificateError.Type.SslObsoleteVersion: + self.tr("The connection uses an obsolete version of SSL/TLS."), + QWebEngineCertificateError.Type.CertificateSymantecLegacy: + self.tr("The certificate is a legacy Symantec one that's no" + " longer valid."), } for host, errors in errorsDict.items():
--- a/eric7/WebBrowser/SafeBrowsing/SafeBrowsingInfoWidget.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/SafeBrowsing/SafeBrowsingInfoWidget.py Mon Aug 30 20:02:39 2021 +0200 @@ -13,6 +13,7 @@ import UI.PixmapCache +# FIXME: don't use QMenu class SafeBrowsingInfoWidget(QMenu): """ Class implementing a widget to show some threat information.
--- a/eric7/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py Mon Aug 30 20:02:39 2021 +0200 @@ -89,10 +89,10 @@ if len(url.split('://')) <= 1: url = Preferences.getWebBrowser("DefaultScheme") + url url = quote(fullUnescape(url)) - urlParts = urllib.parse.parse.urlsplit(url) + urlParts = urllib.parse.urlsplit(url) if not urlParts[0]: url = Preferences.getWebBrowser("DefaultScheme") + url - urlParts = urllib.parse.parse.urlsplit(url) + urlParts = urllib.parse.urlsplit(url) protocol = urlParts.scheme host = fullUnescape(urlParts.hostname) path = fullUnescape(urlParts.path)
--- a/eric7/WebBrowser/SiteInfo/SiteInfoWidget.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/SiteInfo/SiteInfoWidget.py Mon Aug 30 20:02:39 2021 +0200 @@ -158,6 +158,9 @@ horizontalLayout.addWidget(moreButton) moreButton.clicked.connect(self.__showSiteInfo) layout.addLayout(horizontalLayout, rows, 0, 1, -1) + + # TODO: check, if this changes anything + layout.activate() def showAt(self, pos): """
--- a/eric7/WebBrowser/VirusTotal/VirusTotalApi.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/VirusTotal/VirusTotalApi.py Mon Aug 30 20:02:39 2021 +0200 @@ -8,6 +8,7 @@ API class. """ +import contextlib import json from PyQt6.QtCore import pyqtSignal, QObject, QUrl, QUrlQuery, QByteArray @@ -169,7 +170,7 @@ WebBrowser.WebBrowserWindow.WebBrowserWindow.networkManager() ) reply = nam.post(request, params) - reply.finished.connect(self.__submitUrlFinished) + reply.finished.connect(lambda: self.__submitUrlFinished(reply)) self.__replies.append(reply) def __submitUrlFinished(self, reply): @@ -216,7 +217,8 @@ WebBrowser.WebBrowserWindow.WebBrowserWindow.networkManager() ) reply = nam.post(request, params) - reply.finished.connect(self.__getUrlScanReportUrlFinished) + reply.finished.connect( + lambda: self.__getUrlScanReportUrlFinished(reply)) self.__replies.append(reply) def __getUrlScanReportUrlFinished(self, reply): @@ -252,7 +254,8 @@ WebBrowser.WebBrowserWindow.WebBrowserWindow.networkManager() ) reply = nam.post(request, params) - reply.finished.connect(self.__getFileScanReportUrlFinished) + reply.finished.connect( + lambda: self.__getFileScanReportUrlFinished(reply)) self.__replies.append(reply) def __getFileScanReportUrlFinished(self, reply): @@ -293,7 +296,8 @@ WebBrowser.WebBrowserWindow.WebBrowserWindow.networkManager() ) reply = nam.get(request) - reply.finished.connect(self.__getIpAddressReportFinished) + reply.finished.connect( + lambda: self.__getIpAddressReportFinished(reply)) self.__replies.append(reply) def __getIpAddressReportFinished(self, reply): @@ -365,6 +369,13 @@ @param reply reference to the network reply @type QNetworkReply """ + categoriesMapping = { + "bitdefender": ("BitDefender category",), + "sophos": ("sophos category", "Sophos category"), + "valkyrie": ("Comodo Valkyrie Verdict category",), + "alpha": ("alphaMountain.ai category",), + "forcepoint": ("Forcepoint ThreatSeeker category",), + } if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if result["response_code"] == 0: @@ -388,29 +399,29 @@ subdomains = result["subdomains"] except KeyError: subdomains = [] - try: - bdCategory = result["BitDefender category"] - except KeyError: - bdCategory = self.tr("not available") - try: - tmCategory = result["TrendMicro category"] - except KeyError: - tmCategory = self.tr("not available") - try: - wtsCategory = result["Websense ThreatSeeker category"] - except KeyError: - wtsCategory = self.tr("not available") + categories = {} + for key, vtCategories in categoriesMapping.items(): + for vtCategory in vtCategories: + with contextlib.suppress(KeyError): + categories[key] = result[vtCategory] + break + else: + categories[key] = "--" try: whois = result["whois"] except KeyError: whois = "" + # TODO: add "Webutation domain info" with subdict + # "Adult content" (yes/no) + # "Safety score" (0-100, integer) + # "Verdict" (string) from .VirusTotalDomainReportDialog import ( VirusTotalDomainReportDialog ) self.__domainReportDlg = VirusTotalDomainReportDialog( self.__lastDomain, resolutions, urls, subdomains, - bdCategory, tmCategory, wtsCategory, whois) + categories, whois) self.__domainReportDlg.show() self.__replies.remove(reply) reply.deleteLater()
--- a/eric7/WebBrowser/VirusTotal/VirusTotalDomainReportDialog.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/VirusTotal/VirusTotalDomainReportDialog.py Mon Aug 30 20:02:39 2021 +0200 @@ -20,7 +20,7 @@ Class implementing a dialog to show the VirusTotal domain report. """ def __init__(self, domain, resolutions, urls, subdomains, - bdCategory, tmCategory, wtsCategory, whois, parent=None): + categories, whois, parent=None): """ Constructor @@ -32,12 +32,9 @@ @type list of dict @param subdomains list of subdomains @type list of str - @param bdCategory BitDefender categorization - @type str - @param tmCategory TrendMicro categorization - @type str - @param wtsCategory Websense ThreatSeeker categorization - @type str + @param categories dictionary with various categorizations with keys + 'bitdefender', 'sophos', 'valkyrie', 'alpha', 'forcepoint' + @type dict @param whois whois information @type str @param parent reference to the parent widget @@ -62,8 +59,6 @@ self.resolutionsList.resizeColumnToContents(1) self.resolutionsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) - if not urls: - self.detectedUrlsGroup.setVisible(False) for url in urls: QTreeWidgetItem( self.urlsList, @@ -77,15 +72,15 @@ self.urlsList.resizeColumnToContents(2) self.urlsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) - if not subdomains: - self.subdomainsGroup.setVisible(False) - else: + if subdomains: self.subdomainsList.addItems(subdomains) self.subdomainsList.sortItems() - self.bdLabel.setText(bdCategory) - self.tmLabel.setText(tmCategory) - self.wtsLabel.setText(wtsCategory) + self.bdLabel.setText(categories["bitdefender"]) + self.soLabel.setText(categories["sophos"]) + self.vvLabel.setText(categories["valkyrie"]) + self.amLabel.setText(categories["alpha"]) + self.ftsLabel.setText(categories["forcepoint"]) self.__whois = whois self.__whoisDomain = domain
--- a/eric7/WebBrowser/VirusTotal/VirusTotalDomainReportDialog.ui Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/VirusTotal/VirusTotalDomainReportDialog.ui Mon Aug 30 20:02:39 2021 +0200 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>900</width> - <height>700</height> + <height>750</height> </rect> </property> <property name="windowTitle"> @@ -48,11 +48,18 @@ </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="1"> + <widget class="QPushButton" name="whoisButton"> + <property name="text"> + <string>Whois</string> + </property> + </widget> + </item> + <item row="0" column="0" rowspan="2"> <widget class="QGroupBox" name="groupBox"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -60,75 +67,137 @@ <property name="title"> <string>Categorizations</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string notr="true">BitDefender:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="bdLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string notr="true">TrendMicro:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="tmLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string notr="true">Websense ThreatSeeker:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="wtsLabel"> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string notr="true">BitDefender:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="bdLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string notr="true">Sophos:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="soLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Valkyrie Verdict:</string> + </property> + </widget> </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item row="2" column="1"> + <widget class="QLabel" name="vvLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>alphaMountain:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="amLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>690</width> - <height>20</height> - </size> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string notr="true">Forcepoint ThreatSeeker:</string> </property> - </spacer> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLabel" name="ftsLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> </item> </layout> </widget> </item> - <item> - <widget class="QPushButton" name="whoisButton"> - <property name="text"> - <string>Whois</string> + <item row="1" column="1"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> </property> - </widget> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>108</height> + </size> + </property> + </spacer> </item> </layout> </item> @@ -148,6 +217,12 @@ <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QTreeWidget" name="resolutionsList"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="alternatingRowColors"> <bool>true</bool> </property> @@ -189,6 +264,12 @@ <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QListWidget" name="subdomainsList"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="alternatingRowColors"> <bool>true</bool> </property> @@ -216,6 +297,12 @@ <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QTreeWidget" name="urlsList"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="alternatingRowColors"> <bool>true</bool> </property>
--- a/eric7/WebBrowser/WebBrowserLanguagesDialog.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/WebBrowserLanguagesDialog.py Mon Aug 30 20:02:39 2021 +0200 @@ -38,9 +38,10 @@ self.__model.setStringList(languages) allLanguages = [] - for index in range(QLocale.Language.C + 1, - QLocale.Language.LastLanguage + 1): - allLanguages += self.expand(QLocale.Language(index)) + for language in QLocale.Language: + if language == QLocale.Language.C: + continue + allLanguages += self.expand(language) self.__allLanguagesModel = QStringListModel() self.__allLanguagesModel.setStringList(allLanguages) self.addCombo.setModel(self.__allLanguagesModel)
--- a/eric7/WebBrowser/WebBrowserPage.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/WebBrowserPage.py Mon Aug 30 20:02:39 2021 +0200 @@ -111,6 +111,16 @@ self.__setupChannelTimer.setInterval(100) self.__setupChannelTimer.timeout.connect(self.__setupChannelTimeout) + def view(self): + """ + Public method to get a reference to the WebBrowserView associated with + the page. + + @return reference to the WebBrowserView associated with the page + r@type WebBrowserView + """ + return self.__view + @pyqtSlot() def __setupChannelTimeout(self): """
--- a/eric7/WebBrowser/WebBrowserWindow.py Sun Aug 29 20:21:41 2021 +0200 +++ b/eric7/WebBrowser/WebBrowserWindow.py Mon Aug 30 20:02:39 2021 +0200 @@ -4377,7 +4377,7 @@ feedsManager.newWindow.connect(self.openUrlNewWindow) feedsManager.newPrivateWindow.connect(self.openUrlNewPrivateWindow) feedsManager.rejected.connect( - lambda fm: self.__feedsManagerClosed(fm)) + lambda: self.__feedsManagerClosed(feedsManager)) feedsManager.show() def __feedsManagerClosed(self, feedsManager):