9 |
9 |
10 from PyQt6.QtCore import pyqtSignal |
10 from PyQt6.QtCore import pyqtSignal |
11 from PyQt6.QtNetwork import QNetworkInformation |
11 from PyQt6.QtNetwork import QNetworkInformation |
12 from PyQt6.QtWidgets import QLabel |
12 from PyQt6.QtWidgets import QLabel |
13 |
13 |
14 from eric7 import Preferences |
|
15 from eric7.EricGui import EricPixmapCache |
14 from eric7.EricGui import EricPixmapCache |
16 |
15 |
17 |
16 |
18 class EricNetworkIcon(QLabel): |
17 class EricNetworkIcon(QLabel): |
19 """ |
18 """ |
26 """ |
25 """ |
27 |
26 |
28 onlineStateChanged = pyqtSignal(bool) |
27 onlineStateChanged = pyqtSignal(bool) |
29 reachabilityStateChanged = pyqtSignal(QNetworkInformation.Reachability) |
28 reachabilityStateChanged = pyqtSignal(QNetworkInformation.Reachability) |
30 |
29 |
31 def __init__(self, parent=None): |
30 def __init__(self, dynamicOnlineCheck=True, parent=None): |
32 """ |
31 """ |
33 Constructor |
32 Constructor |
34 |
33 |
|
34 @param dynamicOnlineCheck flag indicating to perform online checks during |
|
35 runtime (defaults to True) |
|
36 @type bool (optional) |
35 @param parent reference to the parent widget |
37 @param parent reference to the parent widget |
36 @type QWidget |
38 @type QWidget |
37 """ |
39 """ |
38 super().__init__(parent) |
40 super().__init__(parent) |
39 |
41 |
40 if Preferences.getUI("DynamicOnlineCheck") and QNetworkInformation.load( |
42 if dynamicOnlineCheck and QNetworkInformation.load( |
41 QNetworkInformation.Feature.Reachability |
43 QNetworkInformation.Feature.Reachability |
42 ): |
44 ): |
43 self.__online = ( |
45 self.__online = ( |
44 QNetworkInformation.instance().reachability() |
46 QNetworkInformation.instance().reachability() |
45 == QNetworkInformation.Reachability.Online |
47 == QNetworkInformation.Reachability.Online |