eric7/EricNetwork/EricNetworkIcon.py

branch
eric7
changeset 8586
6a315398a554
parent 8585
c9996d52a1b9
child 8663
a925267d1545
diff -r c9996d52a1b9 -r 6a315398a554 eric7/EricNetwork/EricNetworkIcon.py
--- a/eric7/EricNetwork/EricNetworkIcon.py	Wed Sep 08 19:53:16 2021 +0200
+++ b/eric7/EricNetwork/EricNetworkIcon.py	Thu Sep 09 19:04:53 2021 +0200
@@ -7,7 +7,7 @@
 Module implementing a statusbar icon tracking the network status.
 """
 
-from PyQt6.QtCore import pyqtSlot, pyqtSignal
+from PyQt6.QtCore import pyqtSignal
 from PyQt6.QtNetwork import QNetworkInformation
 from PyQt6.QtWidgets import QLabel
 
@@ -47,8 +47,11 @@
             self.__reachabilityChanged(
                 QNetworkInformation.instance().reachability())
             
-            QNetworkInformation.instance().reachabilityChanged.connect(
-                self.__reachabilityChanged)
+            # TODO: remove this 'contextlib' with official relelase
+            import contextlib
+            with contextlib.suppress(Exception):
+                QNetworkInformation.instance().reachabilityChanged.connect(
+                    self.__reachabilityChanged)
         else:
             # assume to be 'always online' if no backend could be loaded or
             # dynamic online check is switched of

eric ide

mercurial