src/eric7/WebBrowser/Network/NetworkManager.py

branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 9653
e67609152c5e
diff -r 0b936ff1bbb9 -r a2bc06a54d9d src/eric7/WebBrowser/Network/NetworkManager.py
--- a/src/eric7/WebBrowser/Network/NetworkManager.py	Sun Nov 06 11:22:39 2022 +0100
+++ b/src/eric7/WebBrowser/Network/NetworkManager.py	Mon Nov 07 17:19:58 2022 +0100
@@ -20,9 +20,13 @@
 from PyQt6.QtWidgets import QDialog, QStyle
 
 from eric7 import Preferences
-from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired
+from eric7.EricNetwork.EricNetworkProxyFactory import (
+    EricNetworkProxyFactory,
+    proxyAuthenticationRequired,
+)
 from eric7.EricWidgets import EricMessageBox
 from eric7.EricWidgets.EricApplication import ericApp
+from eric7.UI.AuthenticationDialog import AuthenticationDialog
 from eric7.Utilities.AutoSaver import AutoSaver
 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow
 
@@ -34,6 +38,7 @@
     SSL_AVAILABLE = False
 
 from ..Tools.WebBrowserTools import getHtmlPage, pixmapToDataUrl
+from .EricSchemeHandler import EricSchemeHandler
 from .NetworkUrlInterceptor import NetworkUrlInterceptor
 
 
@@ -55,8 +60,6 @@
         """
         super().__init__(parent)
 
-        from eric7.EricNetwork.EricNetworkProxyFactory import EricNetworkProxyFactory
-
         self.__proxyFactory = EricNetworkProxyFactory()
         if Preferences.getUI("UseSystemProxy"):
             QNetworkProxyFactory.setUseSystemConfiguration(True)
@@ -85,15 +88,15 @@
             lambda reply, auth: self.authentication(reply.url(), auth)
         )
 
-        from .EricSchemeHandler import EricSchemeHandler
-
         self.__ericSchemeHandler = EricSchemeHandler()
         WebBrowserWindow.webProfile().installUrlSchemeHandler(
             QByteArray(b"eric"), self.__ericSchemeHandler
         )
 
         if engine:
-            from .QtHelpSchemeHandler import QtHelpSchemeHandler
+            from .QtHelpSchemeHandler import (  # __IGNORE_WARNING_I101__
+                QtHelpSchemeHandler,
+            )
 
             self.__qtHelpSchemeHandler = QtHelpSchemeHandler(engine)
             WebBrowserWindow.webProfile().installUrlSchemeHandler(
@@ -112,8 +115,6 @@
         if not self.__loaded:
             return
 
-        from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow
-
         if not WebBrowserWindow.isPrivate():
             dbString = json.dumps(self.__permanentlyIgnoredSslErrors)
             Preferences.setWebBrowser("SslExceptionsDB", dbString)
@@ -145,15 +146,21 @@
         # set proxy factory to None to avoid crashes
         QNetworkProxyFactory.setApplicationProxyFactory(None)
 
-    def showSslErrorExceptionsDialog(self):
+    def showSslErrorExceptionsDialog(self, parent=None):
         """
         Public method to show the SSL error exceptions dialog.
+
+        @param parent reference to the parent widget
+        @type QWidget
         """
+        from .SslErrorExceptionsDialog import SslErrorExceptionsDialog
+
         self.__load()
 
-        from .SslErrorExceptionsDialog import SslErrorExceptionsDialog
-
-        dlg = SslErrorExceptionsDialog(self.__permanentlyIgnoredSslErrors)
+        dlg = SslErrorExceptionsDialog(
+            self.__permanentlyIgnoredSslErrors,
+            parent=parent,
+        )
         if dlg.exec() == QDialog.DialogCode.Accepted:
             self.__permanentlyIgnoredSslErrors = dlg.getSslErrorExceptions()
             self.changed.emit()
@@ -293,9 +300,6 @@
             else self.tr("<b>Enter username and password for '{0}'</b>").format(urlRoot)
         )
 
-        from eric7.UI.AuthenticationDialog import AuthenticationDialog
-        from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow
-
         dlg = AuthenticationDialog(
             info,
             auth.user(),

eric ide

mercurial